Files
scriptc/tests/diagnostics/local-class-boundaries.ts
Chris Tate 31332427b6 Compile local class factories and spread calls natively
- Preserve fresh constructor identity and shared captures across local class instances.
- Carry constructors through unknown values without a JavaScript engine.
- Support runtime-length spreads into fixed and rest parameters.
2026-09-28 20:11:25 -05:00

15 lines
537 B
TypeScript

function privateBrand() { return class { #value = 1; read(): number { return this.#value; } }; }
function selfName() { return class Local { copy() { return new Local(); } }; }
class Base {}
function derived() { return class extends Base {}; }
function generic() { return class { read<T>(value: T): T { return value; } }; }
privateBrand();
selfName();
derived();
generic();
function genericFactory<T>(value: T) {
return class Stored { read(): T { return value; } };
}
genericFactory<number>(7);
// End of unsupported local-class forms.