✓
Passing This code compiles and runs correctly.
Code
// Multi-arm resume: the `=>` construct must name one of the DECLARED arms.
// `tripled` is not in `ask`'s resume sum { halved, timeout }; without this
// wall the unknown arm sails through to a raw Zig error in the emitted union
// construction. The koru-level diagnostic lists the legal arms.
~import std/io
~pub event request { payload: i32 }
! ask i32
| halved i32
| timeout
| done i32
~proc request|zig {
const r = ask(payload);
return switch (r) {
.halved => |v| .{ .done = v },
.timeout => .{ .done = -1 },
};
}
~request(payload: 20)
! ask n => tripled n
| done r |> std/io:print.ln("{{ r:d }}")
Must fail at runtime with:
CONTAINS KORU021
CONTAINS has no resume arm 'tripled'Error Verification
Actual Compiler Output
error[KORU021]: effect 'ask' has no resume arm 'tripled' (arms: halved, timeout)
--> tests/regression/400_RUNTIME_FEATURES/400_126_reject_unknown_resume_arm/input.kz:23:0
❌ Compiler coordination error: Incomplete branch coverage
error: CompilerCoordinationFailed
/Users/larsde/src/koru/tests/regression/400_RUNTIME_FEATURES/400_126_reject_unknown_resume_arm/backend.zig:95:13: 0x1030479d3 in emit (backend)
return error.CompilerCoordinationFailed;
^
/Users/larsde/src/koru/tests/regression/400_RUNTIME_FEATURES/400_126_reject_unknown_resume_arm/backend.zig:202:28: 0x103048b63 in main (backend)
const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
^Flows
flow ~request click a branch to expand · @labels scroll to their anchor
request (payload: 20)
Test Configuration
MUST_FAIL