You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Named class expression: inner name unresolvable from a static method, and self-binding not captured into nested arrows #9104
Two shapes of a named class expression's self-binding remain broken after #9099, which fixed the per-evaluation identity problem (#9089) that hid them. Both are wrong on main too, so neither is a regression from that PR — but #9099 is what makes them worth separating out, since everything around them now works.
Measured against node v26.5.1.
1. The inner name is not visible from a static method when the class is also bound outside
Unchanged by #9099 (main throws the same ReferenceError). Note the closely-related shapes now DO work — class c { static self() { return c; } } returns the right per-evaluation object, and c.name resolves — so this looks specific to referencing the inner binding by name from a static method body rather than to the self-binding machinery generally.
2. An arrow closure inside a static method cannot reach the static private
Worth noting the direction changed here even though both are wrong: main returned [undefined, undefined, undefined] silently, and after #9099 it throws a TypeError instead. Throwing is the better failure — it is loud rather than silently producing wrong data — but it is still not node's answer, and code that happened to tolerate the undefined will now break. The non-arrow equivalent (static f() { c.#v++; return c.#v; }) is correct after #9099, so the gap is the capture of the self-binding into a nested arrow.
Regression guard
These are the only 2 of 23 shapes still failing; the other 21 match node exactly after #9099, including two evaluations keeping separate static private state, A.peek.call(B) staying lexical, compound ++/--/+= through the self-binding, a nested class closing over the outer evaluation, the lru-cache construction gate, foreign-class brand rejection, and Outer.#o by name. Whoever fixes these should keep that set green.
Activity