Files
scriptc/tests/diagnostics/retained-generic-rest-order.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

27 lines
727 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 WeakRef 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 WeakRef<object>({});
console.log(Object.keys(rest).join(","), blocked);
}
laterGeneric(1);