✗
Failing This test is currently failing.
Failed: wrong-error
Failure Output
Showing last 10 of 11 lines
--> tests/regression/300_ADVANCED_FEATURES/320_STDLIB/320_048_reject_for_terminal_each/input.kz:22:0
❌ Compiler coordination error: Incomplete branch coverage
error: CompilerCoordinationFailed
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/320_STDLIB/320_048_reject_for_terminal_each/backend.zig:94:13: 0x1004a23b3 in emit (backend)
return error.CompilerCoordinationFailed;
^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/320_STDLIB/320_048_reject_for_terminal_each/backend.zig:190:28: 0x1004a309f in main (backend)
const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
^ Code
// Test 320_048: MUST_FAIL — reject the pre-migration `for(...) | each |>` form.
//
// `for`'s `each` is an EFFECT branch (declared `! each *` in std/control), so
// handling it with a terminal `|` continuation is illegal. The compiler must
// reject it with a clear KORU025 error whose hint points the user at the fix
// (`! each`). This pins the rejection of the old terminal-each syntax after the
// for→effect-branch migration; the legal form lives next door in 320_040
// (`! each _ |> _`). Lars's requirement: the invalid form must fail with a
// SENSIBLE message, not just fail — hence the CONTAINS assertions on the hint.
~import std/control
const std = @import("std");
~event start {}
~proc start|zig {
}
~start() |> for(&[_]i32{1, 2, 3})
| each _ |> _
| done |> _
Must contain:
error[KORU025]Error Verification
Expected Error Pattern
Pre-migration `for(...) | each |>` (terminal handler on an effect branch) must be
rejected with KORU025, AND the error must carry a sensible hint telling the user
to write `! each`.
INTENTIONAL PIN — currently RED, do NOT "fix" by deleting the hint assertion.
The rejection + message render correctly (first two CONTAINS pass). The third
CONTAINS (`write \`! each`) FAILS because Stage-C/backend errors drop their hint:
hints render in the Stage-A/frontend path (compile_kz.err) but NOT in the
metacircular backend path (backend.err) — 0 of all backend.err files render a
`hint:` line. The fix is compiler-side (plumb the hint through Stage-C error
serialization), not a test edit. When that lands, this test goes green.Actual Compiler Output
error[KORU025]: branch 'each' is declared as effect `!` but the handler uses terminal `|`
--> tests/regression/300_ADVANCED_FEATURES/320_STDLIB/320_048_reject_for_terminal_each/input.kz:22:0
❌ Compiler coordination error: Incomplete branch coverage
error: CompilerCoordinationFailed
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/320_STDLIB/320_048_reject_for_terminal_each/backend.zig:94:13: 0x1004a23b3 in emit (backend)
return error.CompilerCoordinationFailed;
^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/320_STDLIB/320_048_reject_for_terminal_each/backend.zig:190:28: 0x1004a309f in main (backend)
const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
^Test Configuration
MUST_FAIL