fix(javascript): separate erased types from runtime semantics

Record erasure during definition indexing and reuse it across runtime references, captures, effects, module links, routes, Electron and Vite. Preserve source type links and emitted decorator and computed-key effects; keep actual runtime reads and escapes conservative.

Validation: 1,647 focused tests and 9 documentation tests passed, with build, static and documentation gates. The inherited reference-lifetimes stress file exhausts a 512 MiB worker on both unmodified 18451e479 and this change; that file remains unverified. TypeScript 7.0.2 emit was inspected for ES2022 and ES2018 without executing emitted code.
This commit is contained in:
morluto committed 2026-10-24 18:00:43 +08:00
1 parent cab78de506
commit 89006609f1
32 files changed
+756 -328

No files matched your search

@@ -926,3 +926,32 @@ describe("results of methods on an escaped receiver", () => {
});
}, 30000);
});
it.each([
["named", "@dec abstract slot: { mode: string };"],
["computed literal", '@dec abstract ["slot"]: { mode: string };'],
])(
"retains the possible inherited alias through a decorated abstract %s field",
(_name, field) => {
// An emit that erases the field lets this write reach Base.slot. The
// analysis must still invalidate shared even if another emit shadows it.
const setup = `
function dec(...args: unknown[]) {}
const shared = { mode: "initial" };
class Base { slot = shared; }
abstract class Derived extends Base { ${field} }
const Constructor = Derived as unknown as new () => Base;
`;
expect(resultValue(`${setup} return shared.mode;`)).toEqual({
status: "literal",
value: "initial",
});
expect(
resultValue(`
${setup}
new Constructor().slot.mode = "updated";
return shared.mode;
`),
).toMatchObject({ status: "unknown" });
},
);