You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `extern fn error<T>(msg: String) -> T / Throws;` declared in
stdlib/effects.affine:29 was missing in every backend (`interp.ml`,
`js_codegen.ml`, `codegen_deno.ml`). Any caller of
`use effects::{error}` would compile and fail at run with "error is
not defined" — same shape as the STDLIB-04c/04e dead-surface traps.
Fix: mirror `panic`'s divergent semantics with a polymorphic return.
`<T>` unifies with the call-site expectation (unobservable at runtime
because the call never returns), so `error("…")` is well-typed in any
expression position regardless of the surrounding context's type.
* interp.ml — `VBuiltin "error"` returning `Error (RuntimeError msg)`
* codegen_deno.ml — lowers to `(() => { throw new Error(msg); })()`
* resolve.ml — seeded alongside `panic`
* typecheck.ml — `bind_scheme` with `poly1` (each call site
instantiates a fresh tyvar; same pattern as `len`/`show`/
`RuntimeError`)
* test_e2e.ml — 3 hermetic tests in "E2E STDLIB-04b error #329":
diverges at Int call site, diverges at String call site
(proves polymorphism), Deno codegen lowers to `throw new Error(…)`
Updates `docs/TECH-DEBT.adoc` row 04b → DONE per the audit-split
contract.
Closes#329. Refs #175.
0 commit comments