✓
Passing Passing: the compiler rejects this program as expected.
Code
// PINS: a constructor field value ending in `p.*` is a VALUE tail, not a
// type prefix — `{ a: p.* b: 2 }` fuses `b: 2` into `a`'s value. The
// fused-field boundary in struct_literal.fusedFieldLine exempts bare `*`
// prefix tokens (`*const mod:Type`), never a `*`-ending expression.
import std/io
tor f { p: *i64 }
| ok { a: i64, b: i64 }
| bad i64
f => ok { a: p.* b: 2 }
f(p: @ptrFromInt(0x1000))
| ok o |> std/io:print.ln("{{ o.a:d }}")
| bad _ |> _
Actual compiler output
error[PARSE003]: 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_286_ctor_value_fused_after_deref_refused/input.k:11:1
|
11 | f => ok { a: p.* b: 2 }
| ^Frontend must reject with:
CONTAINS error[PARSE003]
CONTAINS missing comma
CONTAINS 'b: 2'
ERROR_AT 11
NOT_CONTAINS output_emitted.zigTest Configuration
MUST_ERROR