✓
Passing This code compiles and runs correctly.
Code
// ============================================================================
// Test 210_083: MUST_ERROR — metatype residual with discard binding AND
// discard body is still pay-for-nothing.
//
// `|* Transition _ |> _` asks the compiler to build the Transition
// reflection struct on every unhandled branch, bind it to `_`, then do
// nothing. Strictly worse than the no-residual default: synthesis cost
// for the metatype struct PLUS routing cost PLUS zero information gain.
//
// The pay-for-nothing rule applies regardless of whether a metatype is
// named. What matters is whether the body does real work. `|* Transition
// t |> log(t)` is fine — the binding `t` is used, real work happens.
// `|* Transition _ |> log("unhandled")` is also fine — binding is `_`
// but the body emits work that uses the *fact* a branch fired. But
// `|* Transition _ |> _` does neither.
//
// Expected: parser rejects `|* Transition _ |> _` with a message
// pointing at the residual and explaining the no-engagement rule.
// ============================================================================
~tor process { value: u32 }
| success u32
| ?warning string
| ?debug string
~proc process|zig {
return .{ .success = value * 2 };
}
~process(value: 10)
| success _ |> _
|* Transition _ |> _
Must fail at frontend compile:
Parsing or type-checking must reject the program.
Expected patterns
Each line is a regex that must match the program output.
error\[KORU026\]
pay-for-nothing residual
\|\* Transition _ \|> _