Files
scriptc/tests/diagnostics/index-signature-values.ts
Chris Tate 176d963ea1 Index signatures carry function, Map, and Set values through the overflow store
- isSupportedIndexValue admits func/map/set: the overflow map's RC and trace machinery is already fully type-directed (scr_closure/scr_map adapters, the cycle fixpoint's map rule recursing on the value), and nested index-signature records rode the record kind all along
- the C keyed-read miss trap can now describe Map/Set-typed slots (dynDesc), reachable only through that message — no dynCheck ever expects a container
- SC2006's message and hint name the real value domain (functions, Maps, Sets, RegExps, Promises, ...) and the honest blockers left: symbol keys, dual signatures with unequal value types, and values with no representation at all
- diagnostics fixtures pivot to still-fenced shapes (Uint8Array values, unequal duals, a Date-valued bag); corpus 2558/2559 pin the command-registry and container-table patterns — declared+overflow hybrids, enumeration, delete, registry-capturing cycles, container churn — byte-identical vs Node on both backends
2026-07-23 20:36:21 -05:00

20 lines
799 B
TypeScript

// SC2006: index-signature object types outside the supported shape.
// String- and number-keyed signatures over the supported value types
// compile — functions (the command-registry pattern), Maps, Sets, and
// nested index-signature records included (differential corpus); these
// do not.
// A symbol-keyed signature has no lowering.
const bySymbol: { [s: symbol]: number } = {};
console.log(bySymbol);
// A value type with no representation in the overflow store.
const buffers: Record<string, Uint8Array> = {};
console.log(buffers);
// Dual signatures whose value types intern DIFFERENTLY cannot share the
// one store (tsc requires only assignability, but the store gives one
// answer per key).
const dual: { [k: string]: string | number; [n: number]: number } = {};
console.log(dual);