/** * Runner-native ERROR substrate (Slice 1) — explicit `throw new Error("…")`. * * This is the third "leg" of the error-message differential oracle: the * ReferenceRunner executes an EXPLICIT canonical-Error throw natively, byte- * matching both emitted legs (TS `new Error("x").message` === Python * `str(Exception("x"))`). The caught-binding `.message` READ is handled in * `portable-scalar.ts`'s `member` case (it reads the tagged caught-error value * this module's {@link makeCaughtErrorValue} builds and `try.ts` binds). * * DOMAIN (admitted) — exactly the shape both emitters lower identically: * - `throw new Error("")` where the argument evaluates to a * portable STRING (a literal, a template, a string-binding read). The * evaluated literal message is carried on the canonical error's `message` * field (NOT messagePattern — that stays the imprecise path for implicit * primitive throws whose raw text diverges across runtimes). * * FAIL-CLOSE (refused — the runner ABSTAINS so it never emits a one-leg value): * - a bare-value throw (`throw "raw"`, `throw 42`) — JS `"raw".message` is * `undefined` but Python wraps to `Exception` so `str(e)` === "raw". DIVERGE. * {@link isExplicitErrorThrow} returns false for these → throw primitive * precondition fails → abstain. */ import type { ValueIR } from '../../value-ir.js'; import type { SemanticEnv } from './index.js'; import { type CaughtErrorValue } from './portable-scalar.js'; import type { CanonicalError } from './trace.js'; /** Build a tagged caught-error value from a canonical error that carries an * evaluated literal `message`. Returns `null` for an error WITHOUT a literal * message (an implicit/primitive throw modeled by messagePattern) — those are * out of this slice's domain, so the catch binding stays unset and any read of * it abstains. */ export declare function makeCaughtErrorValue(error: CanonicalError): CaughtErrorValue | null; /** True iff `node` is the canonical explicit-throw shape `new Error()` — * a `new` whose argument is a CALL of the bare `Error` ident with exactly one * argument. This is the SAME shape the emitters recognize (TS keeps * `new Error(x)`; Python remaps `Error` → `Exception`). Any other throw value * (a bare string/number, `new TypeError(...)`, `new Error()` with no arg) is * NOT matched → the runner abstains. */ export declare function isExplicitErrorThrow(node: ValueIR): node is Extract; /** * Evaluate an explicit `new Error("")` throw value to a canonical * error carrying the evaluated LITERAL message. Throws (→ runner abstains) when: * - `node` is not the canonical `new Error()` shape, or * - the single argument does not evaluate to a portable STRING (e.g. a number * — the slice is scoped to string-literal messages, the only form both * emitters and the oracle exercise). */ export declare function evalExplicitThrowError(node: ValueIR, env: SemanticEnv): CanonicalError;