✓
Passing This code compiles and runs correctly.
Code
// TEST: Reject a continuation provided without any branch handler.
//
// Every continuation in a flow must be a response to a named branch of the
// preceding event. Bare `|>` tries to chain the next event without naming
// which branch it handles — there is no implicit "positive case," no
// default, no fallback. Every branch must be named explicitly.
//
// Legal: | ok |> next()
// Legal: | err _ |> next()
// Illegal: |> next() (no branch handler — which branch is this?)
~event ping {}
| ok
| err []const u8
~proc ping {
return .{ .ok = .{} };
}
~ping()
|> _
| err _ |> _
pub fn main() void {}
Expected
error[KORU010]: '|>' cannot start a line
--> tests/regression/200_COMPILER_FEATURES/220_FLOW_CHECKER/220_007_reject_continuation_without_branch_handler/input.kz:21:0
|
21 | |> _
| ^^
hint: '|>' is inline glue only — it joins a body to its branch handler, or chains void events on one line. Three legal layouts: (1) fold inline `~A() |> B()`; (2) split into separate top-level statements `~A()` then `~B()`; (3) delete the redundant `|> _` if the head suffices.
Error Verification
Expected Error Pattern
continuation without branch handlerActual Compiler Output
error[KORU010]: '|>' cannot start a line
--> tests/regression/200_COMPILER_FEATURES/220_FLOW_CHECKER/220_007_reject_continuation_without_branch_handler/input.kz:21:0
|
21 | |> _
| ^^
hint: '|>' is inline glue only — it joins a body to its branch handler, or chains void events on one line. Three legal layouts: (1) fold inline `~A() |> B()`; (2) split into separate top-level statements `~A()` then `~B()`; (3) delete the redundant `|> _` if the head suffices.Test Configuration
MUST_FAIL
Expected Behavior:
FRONTEND_COMPILE_ERROR