✓
Passing Passing: the compiler rejects this program as expected.
Code
// Test 355_013: MUST_ERROR — a `|*` residual does not cover a REQUIRED
// branch.
//
// Pins the boundary the rest of the 355 cluster already assumes: `|*`
// routes OPTIONAL branches (355_001/002/005/010 name every required
// branch). A required branch left to the residual is missing coverage,
// not generic routing — the emitter never wires required arms into `|*`,
// so a checker that lets it count passes a program codegen cannot build.
// The refusal is KORU022 at the frontend, not a Zig switch-exhaustiveness
// crash two layers down.
~tor process { value: u32 }
| success u32
| failure string
~proc process|zig {
if (value > 5) return .{ .success = value };
return .{ .failure = "small" };
}
~pub tor observe { name: string }
~proc observe|zig {
_ = name;
}
// 'failure' is required and unnamed — |* cannot stand in for it.
~process(value: 10)
| success _ |> observe(name: "ok")
|* |> observe(name: "residual")
Actual compiler output
error[KORU022]: branch 'failure' must be handled but no continuation found
--> tests/regression/300_ADVANCED_FEATURES/355_OPTIONAL_BRANCHES/355_013_residual_does_not_cover_required/input.kz:27:0
❌ Compiler coordination error: Incomplete branch coverage
(set KORU_BACKEND_TRACE=1 for the backend return trace)Error output must contain
branch 'failure' must be handledFlows
flow ~process click a branch to expand · @labels scroll to their anchor
process (value: 10)
Test Configuration
MUST_ERROR