Files
scriptc/tests/diagnostics/blocked-binding-cascade.ts
Chris Tate bf21f47827 Compile collection metadata and heterogeneous JavaScript tables natively
- Preserve async factory results and mixed table layouts through inference and destructuring.
- Support checked Map and Object.fromEntries construction with native weak collections.
- Keep native weak-key lifetimes and engine-backed collection identities intact.
2026-09-28 22:20:24 -05:00

20 lines
820 B
TypeScript

// Uses of a binding whose DECLARATION was blocked report the SC2004
// cascade — "inherits the blocker on its declaration" — instead of
// misattributing the reference itself. The root diagnostic stays on the
// declaration site; every use points back at it.
// A poisoned declaration (WeakRef values are fenced, and the type can't
// be salvaged): uses of 'w' cascade — reads and writes alike. (This
// battery used Symbol before symbol values grew a lowering.)
let w = new WeakRef<object>({});
console.log(typeof w);
w = new WeakRef<object>({});
// A signature-blocked function (WeakRef return type) used as a value: the
// deferred signature diagnostic flushes at the reference, and the value
// use itself cascades.
function makeWm(): WeakRef<object> {
return new WeakRef<object>({});
}
const f = makeWm;