Skip to content

runtime/object-model: support primitive receiver boxing and temporary property visibility #3577

Closed

Description

@andrewtdiz

Summary

Primitive property access and writes follow ECMAScript wrapper semantics for number primitives, including visible temporary values only where the spec permits.

Affected Test262 rows

Perry actual behavior from report

  • 1 x runtime-fail: Uncaught exception: (5).x == 5
  • 1 x runtime-fail: Uncaught exception: (5).x === 5
  • 1 x runtime-fail: Uncaught exception: typeof (5).x Expected SameValue(«"undefined"», «"number"») to be true
  • 1 x runtime-fail: Uncaught exception: typeof (5).x Expected SameValue(«"undefined"», «"object"») to be true

Node / ECMAScript expected behavior

Primitive property access and writes follow ECMAScript wrapper semantics for number primitives, including visible temporary values only where the spec permits.

Likely subsystem

ToObject/primitive wrapper object model

Acceptance criteria

  • The (5).x and typeof (5).x rows match Node/Test262.
  • Number primitive ToObject behavior remains consistent with Number.prototype access.
  • No persistent property is incorrectly stored on primitive values.

Validation

Run the Test262 differential against the affected area and confirm these rows leave the gap report:

scripts/test262_subset.py --root vendor/test262 --dir language/function-code --sample-cap 99999 --report /tmp/FUNC_PRIMITIVE_BOXING.json

This is Perry language/runtime semantics triage, not a Node core API compatibility issue.

Activity

  1. andrewtdiz commented on Jun 2, 2026

    @andrewtdiz
    ContributorAuthor

    Claiming this as part of the same primitive wrapper/ToObject slice.

    Scope: temporary primitive receiver boxing for number primitives and no persistent property storage on primitive values, coordinated with the Object/String wrapper fixes in #3986/#3987.

  2. andrewtdiz commented on Jun 2, 2026

    @andrewtdiz
    ContributorAuthor

    Opened draft PR for this cut: #4161

    Scope covered here:

    • primitive Object(value) / wrapper constructor identity for Number/String/Boolean-family wrappers
    • boxed String virtual indices, length, descriptors, keys, and own property names
    • temporary primitive receiver boxing for dynamic Number/String/Boolean prototype method calls

    The broader Object.assign descriptor/proxy tail remains outside this PR.

  3. andrewtdiz commented on Jun 3, 2026

    @andrewtdiz
    ContributorAuthor

    PR #4161 merged on June 3, 2026 with the focused primitive wrapper/ToObject cut for this issue.

    Merged scope:

    • primitive Object(value) / wrapper constructor identity for Number/String/Boolean-family wrappers
    • boxed String virtual indices, length, descriptors, keys, and own property names
    • temporary primitive receiver boxing for dynamic Number/String/Boolean prototype method calls

    The corresponding regression fixture is test-parity/node-suite/object/primitive-wrapper-toobject.ts. This issue looks stale-open and ready for maintainer closure.

  4. proggeramlug commented on Jun 13, 2026

    @proggeramlug
    Contributor

    Verified resolved via the actual TC39 test262 differential (corpus @ pinned 4249661388):

    python3 scripts/test262_subset.py --root <test262> --dir language/function-code → diff=0, the only 4 rt-fails are -64/-65/-83/-84gs (a different, non-this category)
    

    The 4 rows this issue lists — 10.4.3-1-103/104/105/106 (primitive this ToObject wrapper visibility in a getter) — are present in the corpus and pass (not in the failure set).

    Independently confirmed vs node --experimental-strip-types: a sloppy getter on Number.prototype sees this boxed (typeof (5).x === "object", (5).x == 5 true, === 5 false), a strict getter sees the primitive (typeof === "number", === 5 true), and a plain n.x = v; n.x write/read round-trips to undefined (no persistent property on the primitive).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions