✓
Passing This code compiles and runs correctly.
Code
// TEST: Reject `|> _` after a void event — redundant terminator.
//
// A void event call has nothing to continue from. Writing `|> _` after
// it is pure noise: the program is bit-identical with or without the
// terminator. The flow checker rejects this so trailing `|> _` cannot
// creep in as a habit.
//
// Legal: ~hello()
// Legal: ~hello() |> next()
// Illegal: ~hello() |> _
~event hello {}
~proc hello {}
~hello()
|> _
pub fn main() void {}
Expected
error[KORU010]: '|>' cannot start a line
--> tests/regression/200_COMPILER_FEATURES/220_FLOW_CHECKER/220_005_reject_void_redundant_terminator/input.kz:17:0
|
17 | |> _
| ^^
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
redundant terminator after void eventActual Compiler Output
error[KORU010]: '|>' cannot start a line
--> tests/regression/200_COMPILER_FEATURES/220_FLOW_CHECKER/220_005_reject_void_redundant_terminator/input.kz:17:0
|
17 | |> _
| ^^
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