Files
scriptc/tests/corpus/class-factory-static-members.mjs
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

24 lines
969 B
JavaScript

function apply(value, operations) {
for (const operation of operations) value = operation(value);
return value;
}
function make(label) {
return class Counter {
static count = 0;
static label = label;
static empty;
static get description() { return this.label + ":" + this.count; }
static increment() { this.count += 1; return this.description; }
static pipe() { return apply(this, arguments); }
static [Symbol.iterator]() { return [label][Symbol.iterator](); }
};
}
const Left = make("left"), Right = make("right");
console.log(Left.increment(), Left.increment(), Right.increment());
console.log(Left.description, Right.description, Left.empty);
console.log(Left[Symbol.iterator]().next().value);
class Child extends make("child") {}
console.log(Child.increment(), Child.description);
console.log("label" in Child, Object.hasOwn(Child, "count"));
console.log(Child.pipe((Type) => Type.label), Left.pipe((Type) => Type.description));