PR #7149 added test-files/test_gap_repsel_ptr_shape_elements.ts and had to
drop one case from it, because it is red on main:
class Row { id: number; /* … */ }
const short: Row[] = [];
short.push(new Row(9, "s", 9));
const missing = short[5]; // undefined
console.log(missing.id);
|
output |
| Node 26.5.1 |
TypeError: Cannot read properties of undefined (reading 'id') |
Perry (main, and PERRY_PTR_SHAPE_LOCALS=0) |
undefined |
Reproduced against the base commit and with the representation-selection knob
off, so it is not a Ptr<Shape> defect — the guarded field-read path
itself is not throwing for an undefined receiver when the binding carries a
class annotation.
The annotation looks load-bearing: const missing: Row = short[5] makes the
declared type Named("Row"), and the field read appears to take a path that
assumes the receiver is an object rather than going through
js_object_get_field_by_name_f64's ToObject check. Worth confirming whether an
Any-typed binding throws correctly, which would localise it to the typed
fast path.
This is a silent wrong answer, not a crash, which is the worse shape: the
program continues with undefined where Node would have aborted.
PR #7149 added
test-files/test_gap_repsel_ptr_shape_elements.tsand had todrop one case from it, because it is red on
main:TypeError: Cannot read properties of undefined (reading 'id')main, andPERRY_PTR_SHAPE_LOCALS=0)undefinedReproduced against the base commit and with the representation-selection knob
off, so it is not a
Ptr<Shape>defect — the guarded field-read pathitself is not throwing for an
undefinedreceiver when the binding carries aclass annotation.
The annotation looks load-bearing:
const missing: Row = short[5]makes thedeclared type
Named("Row"), and the field read appears to take a path thatassumes the receiver is an object rather than going through
js_object_get_field_by_name_f64's ToObject check. Worth confirming whether anAny-typed binding throws correctly, which would localise it to the typedfast path.
This is a silent wrong answer, not a crash, which is the worse shape: the
program continues with
undefinedwhere Node would have aborted.