Files
scriptc/tests/diagnostics/optional-fields.ts
Chris Tate 94fd361b54 Implement sparse native arrays and missing-value parity (#297)
Represent ordinary JavaScript arrays with hole, value, and explicit-undefined states; add sparse side storage and carry missing values through the frontend, native backends, runtime, and Node-facing consumers.
2026-09-12 22:39:07 -05:00

13 lines
653 B
TypeScript

// The fences around optional fields. Optional fields themselves compile —
// record fields AND class fields (undefined-armed union slots; corpus 967
// and 2047) — and `{a: string}` values COERCE into `{a?: string}` slots
// (the width-copy field lift). The string | undefined root compiles now
// (corpus 2788); number | undefined remains a BARE undefined-armed union
// with no root stringify lowering. Record FIELDS get Node's drop treatment;
// the CAST direction compiles — the checked-dynamic tree holds first-class undefined.
function mkMaybe(): number | undefined {
return undefined;
}
const stringifyBare = JSON.stringify(mkMaybe());