Repository navigation
Conversation
`{ A, B }` where `B` is a class declaration failed: the shorthand path
resolved locals, globals and functions but not class names, so a class
extending EventEmitter (and, in JavaScript, a plain class declaration)
reported "the reference to 'B' (a binding form with no lowering)" or a
deferred SC2002 shape mismatch, breaking `module.exports = { A, B }`.
The shorthand now lowers a class name exactly like the identifier
(shared classNameValue), so the property holds the class value.
A statically decided instanceof with computed operands
(`new o.B() instanceof B`, `p instanceof lib.Plain`) was refused because
folding dropped the operands' evaluation; it now evaluates both
operands, left then right, and answers the folded result.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Comment on lines
+3169
to
+3172
| // A class declaration's name (`{ Name }`): the class value, exactly | ||
| // like the long form `{ Name: Name }`. | ||
| const classValue = classNameValue(lowerer, resolved, propName, loc); | ||
| if (classValue) return classValue; |
Contributor
| answer: IrExpr, | ||
| ): IrExpr { | ||
| const stmts: IrStmt[] = []; | ||
| if (left.kind !== "varRef") stmts.push({ kind: "exprStmt", expr: left, loc: left.loc }); |
Contributor
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
{ A, B }whereBis a class declaration failed. The shorthand property path resolved locals, globals and functions but not class names, so a class extending EventEmitter (and, in JavaScript, a plain class declaration) reported "the reference to 'B' (a binding form with no lowering)", or in JavaScript a deferred SC2002 shape mismatch at run time. This brokemodule.exports = { Channel, Plain }and similar exports.The shorthand now lowers a class name exactly like the identifier
B(the class-name branch oflowerIdentifierExpris factored intoclassNameValueand shared), so the property holds the class value: construction through it,name, identity with the binding, andinstanceof.A statically decided
instanceofwith computed operands (new o.B() instanceof B,p instanceof lib.Plain) was refused with SC1090 because folding dropped the operands' evaluation. It now evaluates both operands, left then right, and then answers the folded result. Theinheritance.tsdiagnostics fixture no longer expects that refusal.Evidence:
Overlap: #1544 (
opt/ee-class-value-crash) also editsrelational.ts, in different hunks oflowerInstanceOf(untyped EventEmitter constructor values).🤖 Generated with Claude Code