Files
scriptc/tests/fixtures/self-hosting/opaque-class-view.ts
Chris Tate 2069684b40 Expand static Effect support across common APIs (#598)
* Expand static Effect support across common APIs

* Preserve compiler parity across expanded Effect patterns

* Fix compiler regressions exposed by Effect coverage

* Bound shared type conversion traversal

* Clarify conversion contracts and tidy fixtures

* Run every Effect fixture in CI shards

* Preserve inferred array assignments in concurrent Effect programs

* Record inferred array fixture compiler ordering
2026-10-01 02:49:31 -05:00

21 lines
911 B
TypeScript

class Context {
readonly values = new Map<string, number>();
readonly members = new Set<string>();
readonly count = (...values: number[]): number => values.length;
value = 7;
bump(): number { this.values.set("value", ++this.value); return this.value; }
}
function throughUnknown(value: unknown): unknown { return value; }
const original = new Context();
const opaque = throughUnknown(original);
for (let i = 0; i < 3; i++) {
try { JSON.stringify(opaque); throw new Error("view should refuse"); }
catch (error) {
if (!(error instanceof TypeError) || !error.message.includes("class fields")) throw error;
}
const restored = opaque as Context;
if (restored !== original || restored.bump() !== 8 + i) throw new Error("capsule identity lost");
if (restored.count(1, 2) !== 2) throw new Error("native rest callback lost");
}
console.log(original.values.get("value"), original.members.size);