Files
scriptc/tests/diagnostics/intersection-values.ts
T
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

10 lines
424 B
TypeScript

// SC2008: intersection types that resolve to no runtime shape. Object-member
// intersections intern through the record path and callable hybrids map to
// '%call' records — what fences is the remainder, like a primitive part
// against an object part (inhabited only per the checker, never buildable).
type Branded = number & { __brand: "id" };
declare function mint(): Branded;
const kept = mint();
console.log(kept);