`lhs or rhs` with failable operands now lowers as a full short-circuit chain (was a loud bail). Each failing attempt routes to the next operand; the chain resolves when an operand succeeds or a value terminator absorbs; total failure propagates to the function — or, when the chain is the operand of a `catch`, to the handler. All in ir/lower.zig. - Dispatch (lowerBinaryOp .or_op): structural `orIsFailableChain` (an operand is a `try`, error-channel-typed, or a nested failable `or` chain) instead of the type-only `exprIsFailable(lhs)`, which missed nested chains (a try-chain's value type is non-failable T). - inferExprType .or_op: a failable chain reports its success type via `orChainSuccessType` (was `.bool`). - lowerFailableOr rewritten: flatten the left-assoc chain, lower operands left-to-right. Non-final failure → push frame + fall to next operand block (no function exit, so onfail doesn't fire). Success → clear trace + merge. Final failure → push frame + route to a `catch` target (chain_fail_target field) if set, else propagate (cleanup + error return). Value terminator → clear + merge the terminator value. Subsumes the E2.4a path. Widening factored into `checkEscapeWidening`, checked only at a propagating final operand. - Catch-over-chain: lowerCatchOverChain sets chain_fail_target so the chain's total failure reaches the handler (binds the final tag, may inspect the trace, clears on non-diverging exit). Verified JIT + AOT: 2-/3-operand chains, bare chain + value terminator, void chains, all-fail propagation (exit 1 + trace), catch-over-chain, trace clear-on-absorb, onfail gating. examples/246-failable-or-chain.sx (exit 120), 247-failable-or-chain-propagate.sx (exit 1 + trace).
2 lines
4 B
Plaintext
2 lines
4 B
Plaintext
120
|