Files
scriptc/tests/corpus/class-factory-record-base.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

29 lines
1.1 KiB
JavaScript

class YieldableError extends Error {}
const Failure = (function () {
const key = Symbol("args");
const named = {
BaseFailure: class extends YieldableError {
constructor(args) {
super(args.message);
Object.assign(this, args);
Object.defineProperty(this, key, { value: args });
}
},
};
return named.BaseFailure;
})();
function tagged(tag) {
const named = { TaggedFailure: class extends Failure { _tag = tag; } };
named.TaggedFailure.prototype.name = tag;
return named.TaggedFailure;
}
class Rejected extends tagged("Rejected") {}
const error = new Rejected({ message: "invalid", detail: 42 });
console.log(error.name, error.message, error.detail, error._tag, error instanceof Error);
console.log(error.toString(), Object.hasOwn(error, "name"));
error.name = "Custom";
console.log(error.name, error.toString(), Object.hasOwn(error, "name"));
console.log(Object.prototype.propertyIsEnumerable.call(error, "name"));
const other = new Rejected({ message: "next" });
console.log(other.name, other.toString(), Object.hasOwn(other, "name"));