✓
Passing This code compiles and runs correctly.
Code
// SUBFLOW-IMPLEMENTED EFFECTS, record-fire wall (pure .k, no proc) — a
// record payload arm is fired with NAMED fields, never positionally.
// `token(1, n)` against `! token { kind: i64, val: i64 }` reads as punning
// and hides which value lands in which field; it must be rejected with a
// wall that spells the named form. (Identity payloads keep the bare single
// value — `pong(x)` — which cannot pun: there is no field name to pun on.)
import std/io
pub event scan { n: i64 }
! token { kind: i64, val: i64 } -> i64
| done i64
scan = token(1, n): t => done t
scan(n: 41)
! token t -> t.kind + t.val
| done r |> std/io:print.ln("{{ r:d }}")
Backend must reject with:
CONTAINS error[KORU030]
CONTAINS fire it with named fieldsError Verification
Actual Compiler Output
error[KORU030]: effect 'token' carries a record payload — fire it with named fields: token(kind: ..., val: ...)
--> tests/regression/400_RUNTIME_FEATURES/400_140_effect_record_fire_requires_named_fields/input.k:15:0
error[KORU030]: effect 'token' carries a record payload — fire it with named fields: token(kind: ..., val: ...)
--> tests/regression/400_RUNTIME_FEATURES/400_140_effect_record_fire_requires_named_fields/input.k:15:0
error[KORU022]: effect 'token' payload field 'kind' missing at the firing site (token(kind: ..., val: ...))
--> tests/regression/400_RUNTIME_FEATURES/400_140_effect_record_fire_requires_named_fields/input.k:15:0
error[KORU022]: effect 'token' payload field 'val' missing at the firing site (token(kind: ..., val: ...))
--> tests/regression/400_RUNTIME_FEATURES/400_140_effect_record_fire_requires_named_fields/input.k:15:0
❌ Compiler coordination error: Validation failed (see errors above)
error: CompilerCoordinationFailed
/Users/larsde/src/koru/tests/regression/400_RUNTIME_FEATURES/400_140_effect_record_fire_requires_named_fields/backend.zig:95:13: 0x1008979d3 in emit (backend)
return error.CompilerCoordinationFailed;
^
/Users/larsde/src/koru/tests/regression/400_RUNTIME_FEATURES/400_140_effect_record_fire_requires_named_fields/backend.zig:202:28: 0x100898b63 in main (backend)
const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
^Flows
subflow ~scan click a branch to expand · @labels scroll to their anchor
token (1, n)
flow ~scan click a branch to expand · @labels scroll to their anchor
scan (n: 41)
Test Configuration
MUST_FAIL