✓
Passing This code compiles and runs correctly.
Code
// Test 210_130: MUST_FAIL — --panic-branches=strict makes unhandled panic
// branches compile errors (the crash-surface map).
//
// Panic branches are ignorable by default (210_127: unhandled | ?!oom
// compiles, synthesizing a @panic arm). The --panic-branches=strict flag
// flips the dev/production behavior: every UNHANDLED panic branch becomes a
// compile error (KORU022) listing where the program can crash on a rare
// failure. Same source — the flag flips it. Dev = silent auto-panic
// (ergonomic); production/audit = handle each or explicitly mute.
//
// This is "see where you're ignoring your panics" as a compiler pass: run
// with the flag, compilation fails enumerating every ignored panic branch.
//
// Expected: backend fails with KORU022 naming the unhandled panic branch
// 'oom' and pointing at the flow. (Same input compiles WITHOUT the flag —
// see 210_127.)
~pub event alloc { n: usize }
| success []u8
| ?!oom usize
~proc alloc|zig {
return .{ .success = &.{} };
}
~alloc(n: 4)
| success _ |> _
// NO `| oom _ |> _` handler — strict mode rejects this.
Output must match:
BACKEND_EXEC_ERRORError Verification
Actual Compiler Output
error[KORU022]: panic branch 'oom' is unhandled — in strict mode (--panic-branches=strict) panic branches must be handled or explicitly muted (| oom _ |> ...). Without strict mode this synthesizes @panic at runtime.
--> tests/regression/200_COMPILER_FEATURES/210_PARSER/210_130_panic_branch_strict_flag/input.kz:27:0
❌ Compiler coordination error: Auto-discharge failed (multiple disposal options or no disposal event)
error: CompilerCoordinationFailed
/Users/larsde/src/koru/tests/regression/200_COMPILER_FEATURES/210_PARSER/210_130_panic_branch_strict_flag/backend.zig:94:13: 0x1051cb373 in emit (backend)
return error.CompilerCoordinationFailed;
^
/Users/larsde/src/koru/tests/regression/200_COMPILER_FEATURES/210_PARSER/210_130_panic_branch_strict_flag/backend.zig:190:28: 0x1051cc05f in main (backend)
const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
^Flows
flow ~alloc click a branch to expand · @labels scroll to their anchor
alloc (n: 4)
Test Configuration
MUST_FAIL
Compiler Flags:
--panic-branches=strict