Skip to content

runtime: coerce boxed Boolean, Number, and String objects in addition #3563

Description

@andrewtdiz

Summary

Boxed primitive objects participate in addition through OrdinaryToPrimitive, yielding primitive boolean/number/string values before numeric or string addition.

Affected Test262 rows

Perry actual behavior from report

Node / ECMAScript expected behavior

Boxed primitive objects participate in addition through OrdinaryToPrimitive, yielding primitive boolean/number/string values before numeric or string addition.

Likely subsystem

runtime object model / ToPrimitive for boxed primitives

Acceptance criteria

  • new Boolean(true) + 1, new Number(1) + null, and new String("1") + undefined match Node.
  • String concatenation vs numeric addition decisions follow the post-ToPrimitive operand types.
  • Boxed primitive object identity behavior outside coercion does not regress.

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/expressions/addition --sample-cap 99999 --report /tmp/COERCION_BOXED_PRIMITIVES.json

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

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