Files
scriptc/tests
Chris Tate d1963dc8a5 Test a scalar optional left of ?? in JavaScript on the typed path
In JavaScript, `counts.get(key) ?? 0` on a Map the compiler types as
Map<string, number> is typed `any` by the checker, so `??` was lowered
on checked-dynamic values: the `number | undefined` read converted to a
dynamic value, which allocated a heap union for every read, and the test
ran on that value.

When the left of such a `??` is a union of one number, boolean or string
arm with undefined or null, and the default has the same type, the test
and the default now run on the typed path, where the read needs no heap
union, and only the result converts to a dynamic value. Other defaults
keep the dynamic path.

New corpus program: untyped-nullish-scalar-defaults.mjs.
2026-10-26 11:12:57 -05:00
..
…
2026-10-26 04:25:15 -05:00