Commit Graph
866 Commits
Author SHA1 Message Date
Chris Tate d6b57cf2be Sidecar tables define-or-refuse on order-ambiguous declarations
- SC4010 refuses tabled types gathered from multiple declaration sites, naming every site; SC4011 refuses conditional and mapped types with a point-at-one-declaration teaching
- Spread-composed unions flatten depth-first in source order; duplicate arms across constituents keep the first occurrence
- Conformance fixtures pin cross-file payload order, a global-shadowing enum member, and alias transparency on both emissions
- Contract facts now collect across the program's source files, and type-only modules join source_hash/build_id
2026-07-23 17:59:14 -05:00
Chris Tate 9d811bf7b5 Pin declaration-order conformance and define-or-refuse for order-ambiguous sidecar inputs
- 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.
2026-07-23 17:57:09 -05:00
Chris Tate b2b880e462 Record order-parity baselines for the generics-frontier fixtures
- Baselines added for corpus 2550-2555 (plus the previously unrecorded 2490-2500 entries the sweep now sees); no recorded entry changed.
- tests/diagnostics/generics.ts keeps its alias/annotation sections as reached COMPILING bodies (their absence from the snapshot is the point), fixing the dangling calls the earlier edit left.
2026-07-23 17:51:13 -05:00
Chris Tate f1b0048325 Structured trap teachings: the library sink message grows a versioned encoding
- A library-mode trap that carries a diagnostic code and/or the trapping symbol is assembled as 0x01 text 0x1F code 0x1F symbol [0x1F remediation]: the teaching text leads so plain-text hosts degrade gracefully, the whole remediation field is absent when the profile supplies none, and the frozen sink signature is untouched — all structure lives in the message bytes. The compiler assembles the buffer once at export resolution (library/trap-teaching.ts), both backends emit the same bytes, and the runtime funnel carries them opaque; the first wired site is the inbound-bytes host-contract trap (new runtime code SC4010), naming the trapping export's C symbol.
- The profile's determinism riders now feed the encoding: teachings gains a remediations sibling, both keyed by code, with keys validated only as tokens free of the reserved bytes (SC space stays the compiler registry's; embedder codes are embedder-prefixed) and values refused at load (SC4001) when they contain 0x01 or 0x1F.
- The escaped-exception renderer honors the verbatim rule: a thrown string or Error message that already begins with 0x01 reaches the sink byte-for-byte — no "Uncaught " prefix, no added newline — which is how facade-authored structured teachings ride the throw channel; everything else keeps the baseline shape, whose printable first byte is what makes the marker unambiguous.
- New K11 conformance fixture (tests/library-mode/teach) drives all of it through a real C host on both emissions: exact structured byte layout via the spec's parse rule, verbatim 0x01-led throws (Error and string), and the printable-first-byte pin on baseline trap and throw messages; library-profile tests cover the remediations round-trip and the reserved-byte refusals.
- The executable lane is untouched: every change sits behind SCR_LIB or the library emission path, verified by byte-identical executable binaries on both backends before and after.
2026-07-23 17:45:44 -05:00
Chris Tate e528169a37 Keyed record writes take the literal-key type rule
- `o[k] = v` whose key identifier's type proves one literal — a keyof-bound parameter inside a generic instance, or a literal-typed const — lowers to a static field write, mirroring the read side.
- Literal-UNION keys keep the fence (a runtime-keyed write needs an index signature), with the instantiation context naming the binding.
- Fixture 2555 (writes, read-modify-write, literal-typed key consts, per-literal swaps), byte-identical vs Node on both backends.
2026-07-23 17:41:18 -05:00
Chris Tate ced1822c24 Destructuring assignment targets, class-instance sources, class rest, and accessor defaults go static
- Nested patterns and member targets in assignment position, with JS's reference-before-value evaluation order pinned
- Class-instance sources call getters exactly once per element; a latent double-call in the accessor-default path is fixed
- Class rest packs the inheritance chain in Node's key order, fencing where enumeration can't be reproduced
- Fixtures 2536-2540 for the promotions; 2530-2535 and 2541 pin the already-static declaration-position surface

# Conflicts:
#	packages/compiler/test/ts7/baselines/order-parity.json
2026-07-23 17:32:49 -05:00
Chris Tate 057ac2cea2 Pin corpus coverage for the already-static destructuring surface
- 2530-2535 and 2541 lock in the destructuring forms the static tier already compiled but the corpus never pinned: object/array/tuple declarations (renames, defaults, holes, nesting, fresh rest tails), the options-object parameter pattern (element and whole-pattern defaults, tuple/rest parameter patterns), for-of heads (containers, defaults, rest, existing bindings), object rest freshness and key order, assignment basics (swaps, chains, expression value), and evaluation order (RHS once, elements left to right, lazy defaults that see earlier bindings).
- All byte-identical against Node under both backends, and each reports 100% static coverage.
2026-07-23 17:27:33 -05:00
Chris Tate 385b0a9199 Promote destructuring assignment targets, class-instance sources, class rest, and accessor defaults to the static tier
- Destructuring assignment now takes nested patterns (`({ p: { q } } = src)`, `[[a], b] = t`) and property/element targets (`[c.x, box.vals[i]] = arr`, `({ a: rec.f } = o)`, rest into members) — receivers temp at their pattern position, JS's reference-before-read order; defaults on member targets test against the target's own type. Defaults on nested targets keep a named fence (no single binding type to test against).
- Class instances destructure in assignment position like they already did in declarations: field slots and getter calls per element via the same fieldGetExpr dispatch, defaults, renames, and member targets; methods and undeclared names keep their pointed fences.
- Rest over class-instance sources packs the remaining instance FIELDS into a fresh record (JS's CopyDataProperties copies own enumerable properties — never prototype methods/accessors, matching the checker's rest type), in declarations and assignments; non-public fields, runtime-provided chains (Error/EventEmitter/stream), and key orders the packed shape cannot reproduce fence instead of diverging.
- Defaults on destructured getter results now lower (record and class accessors alike), with the getter result temped so the default's undefined test never calls it twice; numeric-literal pattern keys (`const { 2: x } = o`) fold to JS's canonical property name.
- Corpus 2536-2540 pin the new forms byte-identically against Node on both backends; the destructuring-fences diagnostics program keeps the honest residue (method extraction, non-public rest fields, nested-target defaults, index-signature rest).
- The ts7 order-parity baseline re-record backfills the entries the released file was missing (2490-2500 included) alongside the new fixtures; no existing entry changed.
2026-07-23 17:27:25 -05:00
Chris Tate ce0dc9ee70 Generic-signature annotations monomorphize their function initializers
- `const g: Mapper = (x) => x` under `type Mapper = <T>(x: T) => T` (aliases and inline generic function types alike) registers like `const g = <T>(x: T) => x`: the type parameters come off the annotation's one call signature, whose symbols are exactly what the checker types the initializer's parameters by (bindingContextualGenericFnNodeOf).
- Function-expression initializers, pinned-value uses, aliases of the annotated binding, and multi-parameter signatures with generic callbacks all ride the existing instance table.
- The SC2001 generic-signature message now names every binding shape that monomorphizes; escapes with no statically enumerable instantiations (generic-signature parameters, stored results) keep the fence with that precise wording.
- Fixtures 2553 (alias and inline annotations, function expressions, pinned values) and 2554 (keyof + aliases + signature bindings + interface methods composing), byte-identical vs Node on both backends.
2026-07-23 17:26:56 -05:00
Chris Tate f66a4e0bf2 Generic methods through interface-typed receivers monomorphize against the proven class
- `const r: Repo = new MemRepo()` over an interface whose every member is a generic-callable method keeps the initializer's CLASS representation (genericIfaceBindingKeepsClass): the record shape maps empty — generic members are excluded — so the width copy would drop the class the calls dispatch against, and in JS the binding IS the instance.
- Calls like `r.get(...)` resolve through exactInstanceClassOf to a class generic-method call on the exact class: `this` works, state mutates on the one real instance, and record-typed USES width-coerce at the use site instead of the declaration.
- Receivers with no provable class (parameters, `let`, produced values) keep the fence, now naming the actual blocker: static dispatch needs a const bound to its `new` expression.
- Fixture 2552 (stateful implementations, two classes, block scope, casts back to the class, record-typed uses), byte-identical vs Node on both backends.
2026-07-23 17:23:49 -05:00
Chris Tate 0386d8c00f keyof-constrained generics monomorphize per literal key; generic-fn aliases register their target
- Instantiations carry ts-level bindings alongside the mapped IrTypes: a `K extends keyof T` parameter keys its instance on the bound literal (no cross-literal sharing — the bodies read different fields), and literals forward through generic-to-generic calls.
- `T[K]` inside instance bodies resolves through the bound checker types (mapBoundIndexedAccess via the new resolveTypeParamTs hook), and `o[k]` reads whose key TYPE proves one literal — a keyof-bound parameter or a literal-typed const — lower to static field reads.
- `const h = id` registers the target's GenericFnInfo under the alias's symbol (chains, block scope, pinned values, and calls all resolve like the target's own name); non-const/reassigned aliases fence by name, and unpinned VALUE uses keep their fence at the reference.
- Fixtures 2550 (keyof/pick shapes, forwarding, runtime keys, literal-typed key vars) and 2551 (alias chains, contextual pinning, annotated generic aliases), byte-identical vs Node on both backends.
2026-07-23 17:20:03 -05:00
Chris Tate aa8d31c3cd SC2001 splits into named type-shape fences
- SC2005 generic call signatures, SC2006 index-signature shapes, SC2007 overloads, SC2008 unresolved intersections, SC2009 supported shapes over an unsupported component with the component named
- Stdlib nominal types reroute to the SC2020 story instead of a duplicate code
- SC2001 keeps only bigint/symbol, constructor objects, and unresolved library generics — its registry name now says so
- Five new diagnostics programs pin one frame per code; manifest entries added; zero behavior change to accepted programs

# Conflicts:
#	tests/harness/__snapshots__/regex.ts.txt
2026-07-23 17:17:31 -05:00
Chris Tate e5d4825a77 Private statics resolve through provably-exact class values
- X.#m() calls, const-bound class expressions, decorated names, and const aliases all reach static #private members when the receiver provably holds the declaring class
- The write path's exactClassOfReceiver and leaf-class rules extend to the call and read paths through one shared predicate
- Slots that can hold a descendant still fence; the read path gains the subclass-spelling fence the other paths had
- Fixtures 2520-2523 on both backends
2026-07-23 17:11:48 -05:00
Chris Tate 059d603786 Evolving-any arrays keep their handle-element lowering at method calls
- tsc's evolving-array analysis answers the pushed element type at later call sites; the monomorphizer trusted it while the receiver value lowered as array<jsval>, producing an ill-typed call the validator rejected
- The receiver value's element type now wins across the array method family, riding the explicit-any[] handle path; unannotated locals and file-scope aliases adopt the same spelling
- .find on handle-element arrays fences honestly instead of ICEing
- Fixtures 2510-2513 under --dynamic, byte-identical on both backends
2026-07-23 17:11:30 -05:00
Chris Tate 0685c867e9 Eleven coded stops on the formatter-runtime chain fixed at the compiler
- T[K] indexed access resolves against instantiations; Object.hasOwn/assign on records and DOM values; runtime-keyed writes to fixed shapes with a key-miss trap
- Regex union arms with instanceof RegExp as the tag test; string | RegExp shapes map
- Island literals gain getters, spreads, and real TemplateStringsArray identity for tagged templates
- JS variadics under --dynamic bind the engine's arguments array; fn(...args) lowers to engine apply
- Fixtures 2470-2476 on both backends; SEMANTICS entries 385-390

# Conflicts:
#	packages/compiler/src/frontend/types.ts
#	packages/compiler/test/ts7/baselines/order-parity.json
2026-07-23 17:11:29 -05:00
Chris Tate 64bcb304e2 Monomorphize evolved-any array methods on the value's handle element under --dynamic
- An evolving-any array (const fns = []; fns.push(() => 1)) lowers array<jsval> at its any[] declaration, but tsc's evolving-array analysis answers the pushed element type at later method calls, so the lowering handed monomorphized helpers a jsval-element receiver under a typed signature — the SC9001 validator ICE.
- lowerArrayMethodCall now adopts the receiver VALUE's element type when it is a jsval-element array, riding the explicit-any[] handle-element lowering; HOF callback lead params bind the handles via jsvalParamOverrides whatever the evolved contextual type spelled.
- Derived bindings keep the handle-element array instead of the evolved spelling: locals adopt the initializer's type in lowerVarDecl, and file-scope globals register the handle-element array for aliases and receiver-type-preserving chains (filter/slice/splice/concat) rooted at a registered one.
- concat over a handle-element receiver decides spread-vs-element by the argument VALUE's array-ness, exactly JS's IsArray, instead of the evolved checker spelling.
- Corpus fixtures 2510-2513 pin map, filter/forEach/some/every/findIndex, mixed push sites, and the slice/concat and function-scope derived shapes, byte-identical vs Node under --dynamic on both backends.
2026-07-23 17:01:32 -05:00
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
Chris Tate 5ba6cffcd4 Private statics resolve through provably-exact class values: const-bound class expressions, class aliases, and rebindable decorated names
- staticCallOn and lowerClassValueProperty fenced every #private static access with a through-a-VALUE receiver, so C.#m()/C.#f on a const-bound class expression, A.#f through a const alias of the class, and Example.#m() under a replacing decorator all died with SC1090 while the direct class-name spelling compiled.
- The static-WRITE path already knew the sound rule (exactClassOfReceiver plus the leaf-class arm); classValueIsExactlyOwn now shares it with the call and read paths: a receiver that provably IS the class, or a class with no strict descendants, always carries the declaring class's brand — the fence stays for slots a subclass can inhabit, where Node throws TypeError.
- Rebindable decorated names ride the leaf arm for free: replacement decorators fence any class with subclasses before minting the rebindable global, so the decoration result is always the declaring class object.
- The read path additionally gains the subclass-spelling fence (reading an inherited private static through a subclass-named binding) that the call and direct-read paths already had.
- Fixtures 2520-2523 pin the four call forms (class-name calls including static field initializers and subclassed declarers, const-bound class expressions with reads/writes/calls, decorated classes under both replacing and void decorators, aliased class values local/module/param) byte-identical vs Node on both backends; the private-members diagnostics fixture repins the residual fence on a descendant-capable slot.
2026-07-23 16:37:51 -05:00
Chris Tate 28c20eff00 2470 declares its one deferred fence (the Object.entries table loop)
- the mockImplementations body defers one statement in static builds (SC2011, never executed) — the @deferred-fences directive keeps the coverage sweep honest
2026-07-23 16:15:46 -05:00
Chris Tate 7261f05d87 Release 0.0.7 v0.0.7 2026-07-23 16:06:34 -05:00
Chris Tate f26e50b808 Re-pin the parity artifacts for the width-narrow and regex-union landings
- order-parity baselines re-record for corpus 2470-2476 (new fixtures only)
- regex.ts drops the RegExp | undefined fence (regex union arms compile)
- spread-fences.ts drops the optional-into-required SC2002 (the checked NARROW lift, divergence 38's stance: the flow traps at runtime where it used to fence at compile)
2026-07-23 15:51:04 -05:00
Chris Tate 50a3b1f9c5 The LLVM tier spells the net autosel-timeout runtime symbols correctly
- LIB_FN_SYMS mapped net.{get,set}AutoSelTimeout to scr_net_{get,set}_auto_sel_timeout; the runtime defines autosel — every LLVM-tier program touching the surface died at link
- The ABI guard gains a table-existence audit: every scr_* string the backend sources can emit must exist in scr_runtime.h as a prototype or extern data symbol
- Fixture 2500 exercises the surface differentially on both backends
2026-07-23 15:48:38 -05:00
Chris Tate 586683ccae Fix LLVM-tier link failure on net autosel timeouts; audit every emittable runtime symbol name
- LIB_FN_SYMS mapped net.getAutoSelTimeout/setAutoSelTimeout to scr_net_get_auto_sel_timeout/scr_net_set_auto_sel_timeout, but the runtime defines scr_net_get_autosel_timeout/scr_net_set_autosel_timeout (the C backend already used the correct spelling), so any program touching net.getDefaultAutoSelectFamilyAttemptTimeout on the LLVM tier died at link with undefined symbols.
- The ABI guard could not see this: the literal-declare source scan only checks fully-literal declare strings, and the emitted scan's corpus slice never exercises the net autosel surface — a table entry whose fixture doesn't exist was invisible from both directions.
- llvm-runtime-abi.test.ts grows a third, table-driven direction: every scr_* name the backend sources can ever emit — the static string tables plus every literal @scr_* template reference (interpolated per-type families excluded) — must exist in scr_runtime.h as a prototype or extern data symbol, so a two-string name skew now fails at test time instead of at the user's link step.
- parseHeader additionally collects extern data symbols (scr_emitter_vt, scr_error_vts) so vtable-global references audit cleanly.
- New corpus fixture 2500-net-autosel-timeout.ts round-trips the default attempt timeout (set then get, integers >= 10 to stay clear of Node's clamp) and is byte-identical vs Node through both backends.
2026-07-23 15:47:44 -05:00
Chris Tate b497f50aa8 Helper returns synthesize helpers_<name>: the member slot is the helper name
- The synthesized-name pattern is two-part: container helpers, member the helper's own name — no _return suffix
- Parameter synthesis (helpers_<name>_<param>) is unchanged
- A contract fixture helper with an inline-record return pins the spelling on both emissions
2026-07-23 15:42:40 -05:00
Chris Tate 1ea08e4f80 Helper returns synthesize helpers_<name>: the member slot is the helper name
- The return shapeRef now seeds container 'helpers' with the helper name as the member, so an inline-record helper return tables helpers_<name> instead of helpers_<name>_return; parameter naming (helpers_<name>_<param>) is unchanged
- The contract fixture gains 'extent', a helper returning an inline record, pinning the synthesized name helpers_extent in the type table and the value-kind helper return with the arena bit
- The anti-alphabetical suite asserts the new struct entry and helper row on both emissions; V13 byte-determinism stays green
2026-07-23 15:42:03 -05:00
Chris Tate f72a69e4b9 The formatter-runtime chain: eleven coded stops fixed at the compiler
- T[K] resolves against record bindings, Object.hasOwn/assign lower over records and the DOM, fixed shapes take runtime-keyed writes with the miss trap, and string|RegExp unions narrow by instanceof
- the width family gains the checked NARROW lift and the tuple-arm literal route (the option-table shapes)
- island literals complete: get accessors, plain spreads, tagged templates with .raw, jsval ??, and call-time fence deferral for unlowerable members (lambda poisons defer too)
- JS variadic rests under --dynamic bind the engine arguments array and re-invoke through apply; dyn values marshal into the island as the deep copy
- corpus 2470-2476 pin every landing against the Node oracle on both backends
2026-07-23 15:32:37 -05:00
Chris Tate 0334622abd The contract sidecar emits beside every sidecar-declaring library build
- All twenty schema fields: declaration-ordered type tables, wyhash-64 build_id, descriptor families
- Deterministic byte-equal emission on both backends, validated against rules V1-V14
- Identity getters synthesize as constants: pre-init and post-poison reads match the sidecar
- A computed determinism attestation from a conservative ambient-surface scan
2026-07-23 15:27:51 -05:00
Chris Tate 7cfd08295c No-arm unit comparisons answer constants instead of trapping
- A union lacking null or undefined compares against that literal as a constant, both orders
- Effectful operands still evaluate exactly once; switch unit cases ride the same lowering
- The external adversarial corpus stands at 52 of 53 byte-identical
2026-07-23 15:27:35 -05:00
Chris Tate 5eecd268ef Pin the sidecar contract: anti-alphabetical fixtures and the V1-V14 suite
- the contract fixture declares every order anti-alphabetically (type names, fields, enum members, union arms, msg arms, helpers) and the harness asserts the exact orders on both emissions
- its probe reads the identity getters before init and after a poisoning trap and the harness compares both reads to the sidecar's build_id (V12 plus the ratified exemption, end to end)
- V13 rides two independent identical invocations compared hash-equal; V11 rides nm both directions over the prefix
- the contract-attest fixture pins tuple-returning init/update, subscriptions presence, the default <out>.contract.json path, the empty absent forms, and Date.now demoting deterministic to false
- the validator suite passes a full-vocabulary conformance document and catches one targeted mutation per rule, plus SC4009 refusal coverage through compileLibrary
2026-07-23 14:44:57 -05:00
Chris Tate 5c1eaaad14 Emit the format-1 contract sidecar beside every sidecar-declaring library build
- lib-contract.ts reads the entry's exported types, function signatures, and the ratified exported-const conventions (modelUnbound/msgUnbound/appearanceMsg/chromeMsg/envMsgs) from the AST in statement order, never the checker
- sidecar.ts projects them into the schema's closed vocabulary: declaration-ordered type table with synthesized <Container>_<member> records, five-family msg descriptors (number-first pins number_bytes, bytes-first takes the record family), helper table with the arena bit, channels, and the canonical abi.exports order
- build_id follows the schema's worked definition (compiler version, profile bytes, sorted canonical module graph) and lands on IrLibSection.identity so both backends emit the getters from the one value the sidecar records; the getters are pure constant returns with no entry prologue — poisoned-guard exempt, callable pre-init and post-trap
- not-yet facts emit the stated absent forms: integer_slots [] with every numeric slot f64, deterministic computed by a conservative ambient-surface scan (moduleLibNondeterministicSurface), async_free structural behind SC4005
- sidecar-validate.ts implements the V1-V14 self-check run before writing; unprojectable designations refuse as SC4009 naming the declaration; the CLI prints the sidecar path beside the archive
2026-07-23 14:44:44 -05:00
Chris Tate b1af5f62ec Library profiles grow the ask-2 sidecar section over wyhash-64 identity
- profile.sidecar declares the echoed constants (wire/abi/snapshot), the identity-getter symbols, the model/msg designations, and the profile-selected "module-graph" source-hash contract; presence turns contract emission on
- wyhash.ts implements wyhash-64 final_version_3 (BigInt, vector-pinned) with the length-prefixed framing the schema's build_id definition requires
- the profile's exact bytes ride the resolved LibraryProfile (build_id input 2), getter symbols join the pairwise-distinct claim set, and unknown fields inside the section refuse as SC4001
2026-07-23 14:44:24 -05:00
Chris Tate 8ce27dfcb4 Release 0.0.6
- Recursive types compile statically
v0.0.6
2026-07-23 14:36:26 -05:00
Chris Tate 8d2b3bb2e0 No-arm unit comparisons answer constants instead of trapping
- lowerUnitComparison folds ===/!== against a union lacking the unit arm to the constant answer, both operand orders
- a non-droppable operand still evaluates exactly once, riding a throwaway tag test
- union-switch case null / case undefined take the unit-comparison lowering, so a lacking arm never matches
- the unionEq fallback had coerced the literal through the stranded-arm trap, throwing where Node answers false
- corpus 2490-2494: the find-miss repro, every strict and loose spelling, switch unit cases, effect preservation
2026-07-23 14:34:41 -05:00
Chris Tate 5197893468 Recursive record types compile statically
- Self-referential interfaces, mutual recursion, and recursive unions map to knotted shapes
- Cyclic values collect under the cycle collector; JSON.stringify throws V8's exact circular error
- console.log prints Node's circular reference markers, retiring a documented divergence
- Checked casts validate recursive shapes with path-exact failures
2026-07-23 13:54:51 -05:00
Chris Tate d8ee74f59b Re-record order-parity baselines for the recursive-record fixtures
- corpus 2480-2488 join the recorded set; utility-types re-pins without the now-compiling SelfP block
2026-07-23 13:32:17 -05:00
Chris Tate cb00ff773c Pin recursive-shape checked-cast failure paths in the dyncheck harness
- a lying cast three knots deep renders the full path ($.children[0].children[0].label)
2026-07-23 13:26:12 -05:00
Chris Tate b49052a389 Recursive record types compile statically as named recursive shapes
- mapType back-references mint placeholder shapes/unions finalized at frame exit; identity is per checker type, and context-sensitive (generic/mixin) knots stay fenced
- every type walk survives cyclic shape graphs: coinductive JSON/dyn-safety predicates, guarded formatIrType/jsvalLiftable, cycle headers via the existing collector fixpoint on both backends
- JSON.stringify throws V8's byte-exact circular TypeError (hop lines, ellipsis rule); cyclic values crossing into checked-dynamic slots trap instead of hanging
- console.log/util.inspect render <ref *N>/[Circular *N] exactly (SEMANTICS 129 resolved; depth:null lowers) and deepStrictEqual terminates through Node's pair memo
- corpus 2480-2488 green on C, LLVM, and the sanitized RC-audit lane, which proves child->parent cycles collect
2026-07-23 13:24:13 -05:00
Chris Tate db05c6534d Release 0.0.5
- Library mode ships; bundler-CJS packages type their exports under --npm-static
v0.0.5
2026-07-23 13:01:33 -05:00
Chris Tate ee57575c18 Parallelize CI: flavor and shard matrix with within-file corpus slicing
- Six jobs: plain/san across three sha1-keyed case shards; an aggregate check keeps the old name
- SCRIPTC_TEST_SHARD slices the corpus harnesses; unset means everything
- Two vitest passes per job so file-granular sharding cannot drop corpus slices
2026-07-23 12:26:22 -05:00
Chris Tate f2637da4ea Bundler-emitted CJS packages type their named exports
- A canonical-table rewrite recognizes getter-table and star re-export plumbing
- Chaseable getter bodies type by their resolved values; the lexer name set is the contract
- Consumer-anchored errors degrade the opted-in package with a note instead of gating
- Two lowering ICE classes fixed; untyped packages stay flag-invariant
2026-07-23 12:26:22 -05:00
Chris Tate ff0253ee35 Record order-parity baselines for npm cases 2465-2469
- purely additive: five new fixture entries, zero existing entries changed (2465 pins the flagless chunkGhost SC0001 — the lexer-only name the opt-in types)
2026-07-23 12:04:57 -05:00
Chris Tate 6a4a94fa26 Pin the getter-table shapes: npm cases 2465-2469
- 2465-2468 byte-match Node fully static: the esbuild __export table, the __reExport star, the tsc __exportStar barrel, and the defineProperty getter family
- 2469 pins consumer-anchored degradation: a type-only surface name drops exactly the named package to the island with the site-count note
- auto opts a getter-table bundle in (the marker relaxation), and the untyped-package stub pin replaces the accidental inferred-surface bonus
- the island differential lane excludes the opt-in-only cases by design
2026-07-23 11:47:44 -05:00
Chris Tate 9dc5a4f74c Plain-CJS dist idioms lower as their Node meanings, probes stop mutating
- the tsc __esModule stamp and the void-init preamble (with later real assignments) lower to nothing instead of fencing at module load
- require() spreads in a module.exports table are star-re-export plumbing: names resolve statically and the module load rides the import edge
- island/mixin/shadow probes use a read-only peekLocal so speculative queries never thread capture state
- a capture threading through a non-lifted function fences with the binding named (SC1090, statement-deferred in JS) instead of the lowerer assertion
2026-07-23 11:47:44 -05:00
Chris Tate c3dad81cfd Degrade opted-in packages on consumer-anchored surface breaks
- the fallback loop attributes import-site SC0001s by message (module specifiers and typeof-import paths) and drops the named package with a site-count note
- the solo-probe last resort runs for ALL modes with a note naming the type-only and type-guard inference gap; explicit opt-ins degrade like auto's (the old keep-the-errors stance is superseded)
- require() and default imports of opted-in packages are program-module edges like the import-declaration form, and a compiled-entry resolution maps to its .ts source sibling when the checker admitted the source
2026-07-23 11:47:44 -05:00
Chris Tate 63dc3f313c Type bundler-emitted CJS getter tables from the cjs-lexer name set
- the fs shadow serves opted-in bundle files with the plumbing space-padded and one canonical tail table: chased getter values as alias-plumbed entries, star re-exports as spreads plus per-name member reads, lexer-visible-but-unchaseable names as checked-dynamic any bindings valued undefined
- lexer parity is the contract: the rewritten text answers the same name set to the CJS lexer that the original answers Node, unused helper declarations sweep away, and esbuild's __esModule marker is deliberately omitted (Node never lexed it; spelling it flips default-import interop)
- npmStaticPackageOfPath answers for opted-in workspace realpaths, and the shadow registers a symlinked install's realpath the moment resolution touches it (nested-realm monorepo drivers)
- non-opted UNTYPED node_modules packages serve as an any-surface stub so maxNodeModuleJsDepth cannot change the program's own types under the flag
- auto eligibility refuses only bundler-runtime markers (__webpack_require__) now that degradation is graceful
2026-07-23 11:47:44 -05:00
Chris Tate e8f04b9054 Parallelize CI: flavor x shard matrix with within-file corpus slicing
- ci.yml runs test (plain|san, 1..3/3) on macos-15; an aggregate job keeps the old "test" check name for anything pinned to it
- each job runs vitest twice: --shard=i/3 over everything but the corpus lanes, then the four corpus lanes with only their case slice — a file lands in exactly one --shard slice, so mixing the axes would silently drop cases
- tests/harness/shard.ts: SCRIPTC_TEST_SHARD="i/n" slices case lists by sha1(name) mod n — stable across corpus growth, every case in exactly one shard, unset means everything
- differential, llvm-differential, npm, and server harnesses slice through it; the llvm tier-floor assertion checks only this shard's floor programs
- shard.test.ts pins the partition contract (union exact, disjoint, key-stable, env-driven default) and stays green with the job-wide env set
2026-07-23 11:13:11 -05:00
Chris Tate 3f8ebef595 Retry fs.watch triggers until the event lands
- A one-shot delayed touch can vanish inside the watch backend's async startup window
- Both watch fixtures kick on an interval until first delivery, bounded loudly
- Nothing pinned changes; stdout bytes identical
2026-07-23 10:36:09 -05:00
Chris Tate 08dc012f95 Retry fs.watch triggers until the event lands: the 1751 flake dies
- Node-on-macOS backs fs.watch with an FSEvents stream that starts asynchronously, so both fixtures' single delayed touch could slip into the startup window and vanish, the persistent watcher holding Node's loop until the 300s hang detector fired
- 1751 rewrites the target on a 50ms interval until the first delivery closes everything; the options-record pins (three-arg form with undocumented keys, options-only form, readline crlfDelay) and the exact stdout bytes are unchanged
- 1564 gets the same treatment in both phases: interval appends for the change phase, name flipped out of and back into existence for the rename phase
- a 600-kick bound turns a genuinely dead watcher into a loud nonzero exit instead of a silent hang
- the compiled side never raced (kqueue/inotify register synchronously at the fs.watch call), so only the Node oracle behavior changes
2026-07-23 10:22:30 -05:00
Chris Tate 0803a0fcd3 Library mode: compile a TypeScript module set to a linkable archive
- scriptc build --lib --profile emits ccc wrappers, init/sink/reset/collect entries, and a static archive
- async_free is structural: the async and event-loop units never link, symbol-audit proven
- Every runtime trap routes through one funnel; the sink contract covers both emissions
- The K-fixture conformance matrix runs a real C host against both backends
2026-07-23 09:42:26 -05:00
Chris Tate b5e3d019fc Rename the capability: library mode, never "core", surface and internals
- CLI: the core verb becomes `scriptc build --lib --profile <p.json>` (no positional; profile names the entry); artifact renames to <name>.lib.a with .lib.ll/.lib.c/.lib.ir.json siblings
- SC4xxx diagnostic text and hints say library, never core; trap-message strings likewise (LIBRARY RC AUDIT, library reset registry, library inbound bytes)
- internals: compileLibrary/compileLibArchive, IrModule.lib + IrLibSection/IrLibExport, moduleLibAsyncSurface, libRoots, loadLibraryProfile/LibraryProfile under src/library/, frontend/lib-exports.ts, emitLibEntries/emitLibDefs
- runtime: scr_core.c -> scr_library.c with scr_library_* symbols and the SCR_LIB macro (scr_lib_* was taken by the stdlib unit); scr_lib_session_cleanup
- tests: tests/library-mode/ fixtures (entries lib.ts), library-*.test.ts harness files
2026-07-23 09:24:44 -05:00