✓
Passing Passing: the compiler rejects this program as expected.
Code
// PINS: a nameless entry in a bare-return record produce — `-> { a: 1, : 2 }` —
// refuses PARSE003. A field with no name parses to an empty name in the shared
// parser and emits `. = 2` in Zig; the refusal names the malformed field at
// the authored line.
import std/io
pub tor f { a: i64 } -> { a: i64, b: i64 }
f -> { a: 1, : 2 }
f(a: 4): r |> std/io:print.ln("{{ r.a:d }}")
Actual compiler output
error[PARSE003]: malformed record value `{ a: 1, : 2 }` in the bare return — field has no name — a field is `name: value` or a bare punnable name; `: value` dropped the name
--> tests/regression/200_COMPILER_FEATURES/210_PARSER/210_289_bare_return_nameless_field_refused/input.k:8:0
|
8 | f -> { a: 1, : 2 }
| ^Frontend must reject with:
CONTAINS error[PARSE003]
CONTAINS field has no name
ERROR_AT 8
NOT_CONTAINS output_emitted.zigFlows
flow ~f click a branch to expand · @labels scroll to their anchor
f (a: 4)
Test Configuration
MUST_ERROR