✓
Passing This code compiles and runs correctly.
Code
// Test 020_032: An event with a declared output, INVOKED in the flow, but with
// NO implementation anywhere (no proc, no bare-return impl, no subflow) must be
// a COMPILE ERROR — never a silent zero-default stub.
//
// Today the emitter's !found_impl path (visitor_emitter.zig) synthesizes
// `return .{ .<first-terminal> = 0 }` and the program prints a confident wrong
// answer. That silent fallback is how five AoC honest-red days printed zeros
// instead of failing. The stub is legitimate ONLY where the handler is provably
// never called (template procs, effect-only events, auto-proc passthrough) —
// an invoked event with no implementation is a hole in the program and must
// fail loudly at the koru level.
//
// Grounded on 020_021_event_arrow_return with the `~double -> a * 2`
// implementation line deleted.
~import std/io
~pub event double { a: i32 } -> i32
~double(a: 21): d |> std/io:print.ln("{{ d:d }}")
Must fail at runtime:
Program must error when executed.
Error Verification
Actual Compiler Output
error[KORU047]: event 'input:double' is invoked but has no implementation — without one the compiler would silently stub it to return zero-defaults. Implement it with a proc (`~proc double|zig { ... }`), a bare-return impl (`~double -> <value>`), a branch constructor (`~double => <branch> <value>`), or a subflow (`~double = <flow>`)
--> tests/regression/000_CORE_LANGUAGE/020_EVENTS_FLOWS/020_032_reject_unimplemented_event_invocation/input.kz:20:0
❌ Compiler coordination error: Validation failed (see errors above)
error: CompilerCoordinationFailed
/Users/larsde/src/koru/tests/regression/000_CORE_LANGUAGE/020_EVENTS_FLOWS/020_032_reject_unimplemented_event_invocation/backend.zig:95:13: 0x10092f9d3 in emit (backend)
return error.CompilerCoordinationFailed;
^
/Users/larsde/src/koru/tests/regression/000_CORE_LANGUAGE/020_EVENTS_FLOWS/020_032_reject_unimplemented_event_invocation/backend.zig:202:28: 0x100930b63 in main (backend)
const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
^Flows
flow ~double click a branch to expand · @labels scroll to their anchor
double (a: 21)
Test Configuration
MUST_FAIL
Expected Error:
no implementation