✓
Passing This code compiles and runs correctly.
Code
// Destructured fields are bindings: each named field must be USED or be
// spelled `_` — KORU100 per field, the same linear discipline as any
// binding. `age` is named but never read.
~import std/io
~pub event fetch {} -> { name: []const u8, age: i64 }
~proc fetch|zig { return .{ .name = "lars", .age = 44 }; }
~fetch(): { name, age } |> std/io:print.ln("only {{ name:s }}")
Frontend must reject with:
CONTAINS unused binding 'age'Error Verification
Actual Compiler Output
error[KORU100]: unused binding 'age'
--> tests/regression/000_CORE_LANGUAGE/020_EVENTS_FLOWS/020_019_reject_destructure_unused_field/input.kz:10:0
|
10 | ~fetch(): { name, age } |> std/io:print.ln("only {{ name:s }}")
| ^
hint: discard the destructured field using `_` if not neededFlows
flow ~fetch click a branch to expand · @labels scroll to their anchor
fetch
Test Configuration
MUST_FAIL