✓
Passing Passing: the compiler rejects this program as expected.
Code
// PINS: a bare-return record produce written on one line without the comma —
// `-> { a: 1 b: 2 }` — refuses PARSE003 naming the fused field. The produce
// value is the same `{ name: value }` list struct_literal parses; its errors
// were swallowed by the bind-once pass and the text reached emitted Zig.
import std/io
pub tor f { a: i64 } -> { a: i64, b: i64 }
f -> { a: 1 b: 2 }
f(a: 4): r |> std/io:print.ln("{{ r.a:d }}")
Actual compiler output
error[PARSE003]: malformed record value `{ a: 1 b: 2 }` in the bare return — missing comma — 'b: 2' began a new field but was read as part of the field above it; separate fields with commas
--> tests/regression/200_COMPILER_FEATURES/210_PARSER/210_288_bare_return_fused_record_refused/input.k:8:0
|
8 | f -> { a: 1 b: 2 }
| ^Frontend must reject with:
CONTAINS error[PARSE003]
CONTAINS malformed record value
CONTAINS missing comma
CONTAINS 'b: 2'
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