✓
Passing This code compiles and runs correctly.
Code
// ============================================================================
// Test 210_091: MUST_RUN — explicit `name: value` form is REQUIRED (and must
// be accepted) when the value cannot pun to the same
// name. Guard against false positives in PARSE005.
//
// Cases covered (none should trigger PARSE005):
// - Literal value: echo(v: 5)
// - Bare-name mismatch: echo(v: other) // last segment != 'v'
// - Path mismatch: echo(v: box.other) // last segment 'other' != 'v'
// - Expression value: echo(v: 1 + 2) // has operator at depth 0
//
// If any of these are rejected, PARSE005 has started over-firing and the rule
// has lost calibration. The negative twins live in 210_088/089/090.
// ============================================================================
~import std/io
~event echo { v: i32 } -> i32
~echo -> v
~event get-box { } -> { v: i32, other: i32 }
~proc get-box|zig {
return .{ .v = 7, .other = 11 };
}
// Literal value — cannot pun, label required.
~echo(v: 5): r1 |> std/io:print.ln("literal: {{ r1:d }}")
// Expression value — cannot pun, label required.
~echo(v: 1 + 2): r2 |> std/io:print.ln("expr: {{ r2:d }}")
// Path mismatch — `box.other` puns to 'other', not 'v', so label required.
~get-box(): box |> echo(v: box.other): r3 |> std/io:print.ln("path mismatch: {{ r3:d }}")
Actual
literal: 5
expr: 3
path mismatch: 11
Expected output
literal: 5
expr: 3
path mismatch: 11
Flows
flow ~echo click a branch to expand · @labels scroll to their anchor
echo (v: 5)
flow ~echo click a branch to expand · @labels scroll to their anchor
echo (v: 1 + 2)
flow ~get-box click a branch to expand · @labels scroll to their anchor
get-box
Test Configuration
MUST_RUN