✓
Passing Passing: the compiler rejects this program as expected.
Code
// `{ i: i }` in a produce stage is the redundant rename — the pun spelling
// `{ i }` already says it, so must-pun refuses it. `:` inside produce
// braces is for renames and computations (`{ i: i + 1 }`, `{ x: it.k }`),
// never the same name on both sides.
import std/io
for(1..4)
! each i { i: i } |> std/io:print.ln("{{ i:d }}")
Actual compiler output
error[PARSE001]: Redundant rename 'i: i' in a produce stage — write '{ i }' (the pun already means this).
--> tests/regression/200_COMPILER_FEATURES/210_PARSER/210_330_each_produce_redundant_rename_refused/input.k:8:6
|
8 | ! each i { i: i } |> std/io:print.ln("{{ i:d }}")
| ^Frontend must reject with:
CONTAINS error[PARSE001]
CONTAINS Redundant rename 'i: i'
NOT_CONTAINS output_emitted.zigTest Configuration
MUST_ERROR