✓
Passing Passing: the compiler rejects this program as expected.
Code
// PINS: a redundant explicit label in a bare-return produce — `{ a: a }` —
// refuses the pun law (PARSE005), same as the constructor-field path.
// `a: a` puns to `a`; writing the label is the redundant form the law drops
// at emit time, leaving `missing struct field` errors.
import std/io
pub tor f { a: i64 } -> { a: i64, z: i64 }
f -> { a: a, z: 1 }
f(a: 4): r |> std/io:print.ln("{{ r.a:d }}")
Actual compiler output
error[PARSE005]: redundant explicit label 'a:' in the bare return — punning is mandatory
--> tests/regression/200_COMPILER_FEATURES/210_PARSER/210_293_bare_return_redundant_label_refused/input.k:8:0
|
8 | f -> { a: a, z: 1 }
| ^
hint: drop the label: write the bare pun insteadFrontend must reject with:
CONTAINS error[PARSE005]
CONTAINS redundant explicit label
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