Files
scriptc/tests/diagnostics/retained-generic-rest-order.ts
Chris Tate 6310dfb960 Reuse reachability lowering output (#178)
* Reuse reachability lowering output

- Retain reachable IR and assemble the emitted module without lowering bodies a second time
- Preserve reached-only artifact filtering, coverage remainder behavior, and add lowering phase timing

* Preserve record order in retained lowering

* Preserve record order in retained helpers

* Preserve generic lowering record order

* Recheck retained generic rest order

* Record retained lowering parity fixtures

* Preserve retained lowering failure parity
2026-08-20 14:01:39 -05:00

27 lines
733 B
TypeScript

class Pair {
a = 1;
b = 2;
}
function earlierGenericSource<T>(_: T): void {
const value = { b: 2, a: 1 };
console.log(Object.keys(value).length);
}
function earlierOrdinary(): void {
earlierGenericSource(1);
}
function laterGeneric<T>(_: T): void {
const sameShape = { a: 1, b: 2 };
console.log(Object.keys(sameShape).length);
earlierOrdinary();
// The deferred rest-order rejection must poison this whole statement:
// the later WeakMap declarator is never visited, and the next statement
// sees rest as a blocked binding just like the historical emit pass.
const { ...rest } = new Pair(), blocked = new WeakMap<object, number>();
console.log(Object.keys(rest).join(","), blocked);
}
laterGeneric(1);