✓
Passing This code compiles and runs correctly.
Code
// SUBFLOW-IMPLEMENTED EFFECTS, the ownership wall (pure .k, no proc) — only
// the declaring event's own implementation may fire its arms. Here a SECOND
// event's impl calls `pong`, which is ping's effect arm, not an event. That
// must be rejected — and with a GUIDING diagnostic naming the owner, not a
// bare "unknown event": firing from outside the impl is an understandable
// mistake, and the wall should point at the rule that was broken.
import std/io
pub event ping { x: i64 }
! pong i64
ping = pong(x)
pub event other { x: i64 }
! stray i64
other = pong(x)
ping(x: 41)
! pong reply |> std/io:print.ln("{{ reply + 1:d }}")
Backend must reject with:
CONTAINS error[KORU040]
CONTAINS only that event's own implementation may fire itError Verification
Actual Compiler Output
error[KORU040]: 'pong' is an effect arm of event 'input:ping' — only that event's own implementation may fire it
--> tests/regression/400_RUNTIME_FEATURES/400_138_effect_arm_call_outside_impl_rejected/input.k:19:0
❌ Compiler coordination error: Unknown event referenced
error: CompilerCoordinationFailed
/Users/larsde/src/koru/tests/regression/400_RUNTIME_FEATURES/400_138_effect_arm_call_outside_impl_rejected/backend.zig:95:13: 0x102c379d3 in emit (backend)
return error.CompilerCoordinationFailed;
^
/Users/larsde/src/koru/tests/regression/400_RUNTIME_FEATURES/400_138_effect_arm_call_outside_impl_rejected/backend.zig:202:28: 0x102c38b63 in main (backend)
const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
^Flows
subflow ~ping click a branch to expand · @labels scroll to their anchor
pong (x)
subflow ~other click a branch to expand · @labels scroll to their anchor
pong (x)
flow ~ping click a branch to expand · @labels scroll to their anchor
ping (x: 41)
Test Configuration
MUST_FAIL