Files
scriptc/tests/diagnostics/generic-signature-values.ts
Chris Tate 44cde1510e Split the SC2001 catch-all into named type-fence families
- New codes, minted in badType's classification order: SC2005 values whose type keeps a generic call signature, SC2006 index-signature shapes outside the supported set, SC2007 overloaded function types, SC2008 intersections with no resolved lowering, SC2009 supported container/function/record shapes over a component outside its slot — the SC2009 message names the offending component (Map/Set key-value domains, array/tuple elements, union arms, function rest/params/returns, record members) via describeComponentBlocker/describeRecordMemberBlocker in frontend/types.ts, which mirror mapType's own rules on the failure path only.
- Standard-library nominal types with no lowering at all (Date, ArrayBuffer, WeakMap, the iterator and constructor interfaces) now route to the existing SC2020 story instead of the supported-set recitation; stdlib provenance is checked after the container claims so Map/Set/Promise instantiation failures keep their component story.
- SC2001 keeps the honest remainder — bigint and symbol primitives, constructor objects, and library-derived or unresolved generic shapes — and its registry name now says so; across the diagnostics corpus its rendered sites drop from 57 to 5.
- Every new code flows through the diagnostics registry, the regenerated surface manifest, and coverage-report grouping; five new tests/diagnostics programs pin one rendered frame per code, and the ts7 order-parity baselines re-record to include them.
- Zero behavior change to accepted programs: the differential corpus (900 programs) is untouched and green, and the full suite passes.
2026-07-23 16:55:31 -05:00

12 lines
351 B
TypeScript

// SC2005: a value whose type keeps a generic call signature — no concrete
// instance exists for the slot to hold (the monomorphization rule).
const id = <T>(x: T): T => x;
const stored = id;
console.log(stored(1));
// A slot ANNOTATED with a generic signature fences the same way.
let held: <T>(x: T) => T = id;
held = id;
console.log(held(2));