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
bug: built-in function .name own-property undefined (Promise.race.name, Math.min.name, Array.isArray.name) — follow-up to #2060 #2144
A built-in function's name own-property is undefined. Promise.race.name, Math.min.name, etc. all return undefined where the spec requires the function's name. #2060 fixed .name for user-defined function declarations and expressions; it didn't populate .name for built-ins.
built-ins/Function was 16% on the re-harvest, with 38× Cannot read … (reading 'name') — the dominant signature. Most of those trace to a separate gap (built-in proto methods being undefined, then .name of undefined throwing — tracked in the sibling issue filed alongside). Once that lands, the residual .name === undefined cases (tests that explicitly inspect a real built-in's name) all hit this gap. Also degrades assert.throws reporting, which prints expectedErrorConstructor.name for messages — any built-in Error constructor reports as undefined instead of TypeError / RangeError / etc.
Likely cause
Whatever populated name on user-defined function objects in #2060 needs to also run when the engine creates built-in function values (the per-intrinsic setup code for Promise.*, Math.*, Array.isArray, error constructors, etc.).
Surfaced by the #799 Test262 radar re-harvest. Follow-up to #2060. Part of #793.
Fixed by #2185 (merged as f3812fbc6 on 2026-05-28). The PR title referenced this issue but didn't include a closing keyword, so GitHub left it open.
HIR-level constant fold added in lower/expr_member.rs + lower/expr_call/native_module.rs:
<BuiltinCtor>.name → Expr::String("<Ctor>")
<BuiltinNs>.<staticFn>.name → Expr::String("<fn>") (gated on a spec-defined function table — numeric constants like Math.PI.name stay unfolded, matching Node)
Object.getOwnPropertyDescriptor(<BuiltinFn>, "name") → spec-compliant data descriptor object literal
Both fold sites gate on the lowered receiver matching GlobalGet(0) / PropertyGet { GlobalGet(0), … }, so a locally-shadowed const Math = … lowers to a LocalGet and correctly bypasses the fold.
Activity
fix(hir): built-in function `.name` own-property (#2144) (#2185)
proggeramlug commentedon May 28, 2026
Fixed by #2185 (merged as
f3812fbc6on 2026-05-28). The PR title referenced this issue but didn't include a closing keyword, so GitHub left it open.HIR-level constant fold added in
lower/expr_member.rs+lower/expr_call/native_module.rs:<BuiltinCtor>.name→Expr::String("<Ctor>")<BuiltinNs>.<staticFn>.name→Expr::String("<fn>")(gated on a spec-defined function table — numeric constants likeMath.PI.namestay unfolded, matching Node)Object.getOwnPropertyDescriptor(<BuiltinFn>, "name")→ spec-compliant data descriptor object literalBoth fold sites gate on the lowered receiver matching
GlobalGet(0)/PropertyGet { GlobalGet(0), … }, so a locally-shadowedconst Math = …lowers to aLocalGetand correctly bypasses the fold.