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
getOwnPropertyNames(C.prototype) omits accessors and leaks a symbol key as the literal string "@@iterator" #9226
For a class with an accessor and a symbol-keyed method, Object.getOwnPropertyNames on the prototype is wrong in two directions at once, and is internally inconsistent with getOwnPropertyDescriptor.
Accessors are missing — g and s do not appear at all.
A symbol key leaks into the string list as the literal "@@iterator", where it should appear only in getOwnPropertySymbols.
getOwnPropertySymbols returns nothing, so the symbol is not merely misfiled — it is absent from the list it belongs in.
Internally inconsistent
The information is present; only the enumeration is wrong:
Object.prototype.hasOwnProperty.call(C.prototype,"g")// trueObject.getOwnPropertyDescriptor(C.prototype,"g")// the accessor descriptor
So this is an own-keys enumeration bug on class prototypes, not a missing property.
Impact
Silent and structural. Anything that reflects over a class prototype — decorators, DI containers, serializers, mixin/Object.assign-based composition, test frameworks discovering methods — sees a wrong key set: accessors vanish, and a "@@iterator" string appears that no correct program expects. Because hasOwnProperty and getOwnPropertyDescriptor disagree with the enumeration, a two-step "list then inspect" pattern gives self-contradictory results.
How it was found
A 104-assertion differential over class prototypes, run against node --experimental-strip-types on unmodified main (84185b5656) as a control before landing an unrelated change. It surfaced 8 pre-existing divergences; this is the sharpest of them. Minimal repro above; the full harness is on the #9214 branch.
Not related to #9214, #9192 or #9219 — reproduces on pristine main.
Fix direction
The own-keys enumeration for class prototypes needs to (a) include accessor-backed entries, (b) route symbol keys to getOwnPropertySymbols rather than stringifying them into the names list, and (c) keep Reflect.ownKeys as the union in spec order — integer-like keys ascending, then strings in insertion order, then symbols in insertion order. Whatever produces the "@@iterator" spelling is the tell: an internal symbol representation is reaching a string-key path unconverted.
Activity
test: expose class prototype own-key gap (PerryTS#9226)
fix: enumerate declared class own keys (PerryTS#9226)
docs(changelog): record the PerryTS#9226 own-keys fix and its measure…
test: expose class prototype own-key gap (PerryTS#9226)
fix: enumerate declared class own keys (PerryTS#9226)
docs(changelog): record the PerryTS#9226 own-keys fix and its measure…
fix(runtime): class-prototype own-keys enumeration — accessors listed…
fix(hir): keep the Symbol.iterator vtable entry alongside #9226's own…