✓
Passing Passing: the compiler rejects this program as expected.
Code
// PINS: a record literal carried by an invocation argument —
// `f(p: { a: 1 b: 2 })` — refuses PARSE003 naming the fused field. Argument
// values are record literals the emitter lowers with emitStructLiteral; the
// field list is parsed by struct_literal and its errors must surface.
import std/io
pub tor f { p: { a: i64, b: i64 } }
| done i64
| bad i64
f => done p.a + p.b
f(p: { a: 1 b: 2 })
| done d |> std/io:print.ln("{{ d:d }}")
| bad _ |> _
Actual compiler output
error[PARSE003]: malformed record value `{ a: 1 b: 2 }` in the call arguments — 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_291_invocation_arg_fused_record_refused/input.k:13:0
|
13 | f(p: { a: 1 b: 2 })
| ^Frontend must reject with:
CONTAINS error[PARSE003]
CONTAINS missing comma
CONTAINS 'b: 2'
ERROR_AT 13
NOT_CONTAINS output_emitted.zigFlows
flow ~f click a branch to expand · @labels scroll to their anchor
f (p: { a: 1 b: 2 })
Test Configuration
MUST_ERROR