✓
Passing Passing: the compiler rejects this program as expected.
Code
// PINS: a `const { }` field list takes each name once — a second `a:` is
// refused KORU176 naming the twice-bound name, not emitted as a duplicate
// `const` member for the Zig backend to reject.
import std/io
const {
a: @as(i32, 5), a: @as(i32, 2)
}
std/io:print.ln("unreachable")
Actual compiler output
error[KORU176]: field 'a' is bound twice — a field list takes each name once
--> tests/regression/300_ADVANCED_FEATURES/320_STDLIB/320_117_const_field_duplicate_name_refused/input.k:7:0Must fail at runtime with:
CONTAINS error[KORU176]
CONTAINS 'a' is bound twice
ERROR_AT 7
NOT_CONTAINS output_emitted.zigFlows
flow ~const click a branch to expand · @labels scroll to their anchor
const (source: a: @as(i32, 5), a: @as(i32, 2))
flow ~print.ln click a branch to expand · @labels scroll to their anchor
print.ln (expr: "unreachable")
Test Configuration
MUST_ERROR