✓
Passing Passing: the compiler rejects this program as expected.
Code
// PINS: a nested record literal inside a constructor field —
// `=> ok { inner: { a: x b: x }, z: 1 }` — refuses PARSE003 naming the fused
// inner field. The outer field's value is itself a `{ name: value }` list;
// the same parser checks it.
import std/io
tor f { a: i64 }
| ok { inner: { a: i64, b: i64 }, z: i64 }
| bad i64
f => ok { inner: { a: a b: a }, z: 1 }
f(a: 4)
| ok o |> std/io:print.ln("{{ o.z:d }}")
| bad _ |> _
Actual compiler output
error[PARSE003]: malformed record value `{ a: a b: a }` in the branch constructor — missing comma — 'b: a' 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_292_ctor_nested_record_fused_refused/input.k:11:0
|
11 | f => ok { inner: { a: a b: a }, z: 1 }
| ^Frontend must reject with:
CONTAINS error[PARSE003]
CONTAINS missing comma
CONTAINS 'b: a'
ERROR_AT 11
NOT_CONTAINS output_emitted.zigFlows
flow ~f click a branch to expand · @labels scroll to their anchor
f (a: 4)
Test Configuration
MUST_ERROR