✓
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 tor 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'Flows
flow ~request click a branch to expand · @labels scroll to their anchor
request (payload: 20)