✓
Passing Passing: the compiler rejects this program as expected.
Code
// PINS: `captured { ... }` is a Source-argument field list — a repeated `p`
// is refused by struct_literal's one-name rule, surfacing as KORU164 through
// the transform's own parse path. At HEAD it compiled and RAN, silently
// overwriting the first binding (printed `1 0`).
import std/io
pub tor tick { n: i64 }
tick = capture { p: 0[i64], m: 0[i64] }
! as st |> captured { p: st.m, m: st.p, p: st.m + 1 }
| captured r |> std/io:print.ln("{{ r.p:d }} {{ r.m:d }}")
tick(n: 1)
Actual compiler output
error[KORU164]: captured: field 'p' is bound twice — a field list takes each name once
--> tests/regression/200_COMPILER_FEATURES/210_PARSER/210_255_dup_field_captured_source_refused/input.k:10:0Must succeed:
Compile and run without errors.
Flows
subflow ~tick click a branch to expand · @labels scroll to their anchor
capture (source: p: 0[i64], m: 0[i64])
flow ~tick click a branch to expand · @labels scroll to their anchor
tick (n: 1)
Test Configuration
MUST_ERROR