mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-23 06:10:02 +08:00
- New contract-order conformance fixture (both emissions): union arms anti-alphabetical with payload records declared in a separate file (import order never perturbs table order), an anti-alphabetical enum with a global-shadowing "Infinity" member, and a union referenced through a type alias (the table derives from the aliased declaration; the alias adds no entry and no reordering). - Contract facts now scan the whole program graph, not just the entry: type-only modules join (they have no runtime edge, so they ride the program's source files rather than moduleOrder), non-entry modules anchor after the entry in bytewise path order, and the identity hashes cover type-only modules so contract-bearing edits always move source_hash/build_id. - SC4010: a tabled or designated type whose members gather from multiple declaration sites (interface merging, module augmentation, a same-name exported type in another module) refuses with every site named file:line. - SC4011: a conditional or mapped type producing a tabled/designated type refuses with its own teaching. - Union composition (type Msg = A | B where A/B are kind-tagged unions) is allowed and pinned: arms flatten depth-first in source order, each constituent in its own declaration order, and an arm name appearing in several constituents keeps its first occurrence; a repeat among one declaration's own inline arms still refuses.
18 lines
533 B
TypeScript
18 lines
533 B
TypeScript
// Payload records for lib.ts's Cargo union, deliberately declared in an
|
|
// order matching NEITHER the alphabet (Wisp, Yank, Zeta), NOR lib.ts's
|
|
// import list, NOR the order the union's arms reference them: the sidecar
|
|
// table must pin THIS file's declaration order — Zeta, Wisp, Yank — so a
|
|
// sorter anywhere (or any import-order leakage) reorders something the
|
|
// harness's exact-order assertions catch.
|
|
export interface Zeta {
|
|
z: number;
|
|
}
|
|
|
|
export interface Wisp {
|
|
w: boolean;
|
|
}
|
|
|
|
export interface Yank {
|
|
y: string;
|
|
}
|