Skip to content

runtime: propagate ReferenceError, Symbol, BigInt, and ToPrimitive errors through addition #3564

Description

@andrewtdiz

Summary

Abrupt completions from operand GetValue, ToPrimitive, Symbol-to-string, and mixed BigInt/Number addition propagate as the same error Node/Test262 expects.

Affected Test262 rows

Perry actual behavior from report

  • 1 x runtime-fail: TypeError: Cannot read properties of undefined (reading 'name')
  • 1 x runtime-fail: Uncaught exception: ?GetValue(lhs) throws. Expected a MyError but got a undefined
  • 1 x runtime-fail: Uncaught exception: Support custom menu bar items #1.2: 1 + y throw ReferenceError. Actual: Test262Error: Support custom menu bar items #1.1: 1 + y throw ReferenceError. Actual: 1
  • 1 x runtime-fail: Uncaught exception: Support custom menu bar items #1.2: x + 1 throw ReferenceError. Actual: Test262Error: Support custom menu bar items #1.1: x + 1 throw ReferenceError. Actual: 1
  • 1 x runtime-fail: Uncaught exception: Support custom menu bar items #1.3: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x + y throw "x". Actual: Test262Error: Support custom menu bar items #1.1: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x + y throw "x". Actual: NaN
  • 1 x runtime-fail: Uncaught exception: Expected a to be thrown but no exception was thrown at all

Node / ECMAScript expected behavior

Abrupt completions from operand GetValue, ToPrimitive, Symbol-to-string, and mixed BigInt/Number addition propagate as the same error Node/Test262 expects.

Likely subsystem

runtime completion records / error construction / operator lowering

Acceptance criteria

  • ReferenceError and user-thrown values are not swallowed or replaced by computed numeric results.
  • Symbol and BigInt/Number addition throw the expected TypeError shape.
  • The affected rows report the expected thrown constructor/value under Test262.

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_ERROR_PROP.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