Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editorial: Add an assertion for PrivateEnvironment cannot be null #3485

Merged
merged 1 commit into from
Nov 21, 2024

Conversation

kimjg1119
Copy link
Contributor

In RelationalExpression, evaluation of RelationalExpression : PrivateIdentifier in ShiftExpression makes an alarm in ESMeta since it is not trivial to know that running execution context's PrivateEnvironment never becomes null.

It can be resolved in the same way with step 2 of MakePrivateReference; add an assertion to annotate it.

ESMeta alarm:

[ParamTypeMismatch] Call[9993] argument assignment to first parameter _privateEnv_ when Call[9993] function call from RelationalExpression[7,0].Evaluation (step 6, 7:33-92) to ResolvePrivateIdentifier
- expected: Record[PrivateEnvironmentRecord]
- actual  : Record[PrivateEnvironmentRecord] | Null

@michaelficarra
Copy link
Member

I don't see why it's not possible for the running execution context's PrivateEnvironment to be null here. It seems like a spec bug to me.

@bakkot
Copy link
Contributor

bakkot commented Nov 20, 2024

I don't see why it's not possible for the running execution context's PrivateEnvironment to be null here. It seems like a spec bug to me.

PrivateEnvironment can only be *null* if there is no containing class, in which case early errors statically prevent using the a.#b syntax.

@michaelficarra
Copy link
Member

Oh okay, I didn't see the early errors, but I figured that was it.

@bakkot
Copy link
Contributor

bakkot commented Nov 20, 2024

It's the ones which refer to AllPrivateIdentifiersValid. Mechanically it says that you can't refer to a.#name unless #name is declared in a containing class, but since you can't declare a private name without a class, that ends up meaning you can't use the syntax at all outside of a class.

@michaelficarra michaelficarra added the ready to merge Editors believe this PR needs no further reviews, and is ready to land. label Nov 21, 2024
ljharb pushed a commit to kimjg1119/ecma262 that referenced this pull request Nov 21, 2024
@ljharb ljharb force-pushed the relational-expression-private branch from 0780c51 to 727afe3 Compare November 21, 2024 21:07
@ljharb ljharb force-pushed the relational-expression-private branch from cd56222 to cf5938e Compare November 21, 2024 21:27
@ljharb ljharb merged commit cf5938e into tc39:main Nov 21, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editorial change ready to merge Editors believe this PR needs no further reviews, and is ready to land.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants