✓
Passing Passing: the compiler rejects this program as expected.
Code
// TEST: unspaced `-` between bound names inside a control-flow branch body
//
// 220_052 pins the produce carrier; this pins the same ruling inside a
// conditional's named branch (`| then -> q-b`). Branch bodies are nested
// AST — the checker must descend through conditional/foreach/switch branch
// lists to see their expressions, or the token slips past and Zig reads
// subtraction silently.
import std/io
tor diff { q: i64, b: i64 } -> i64
diff = if(q > 0)
| then -> q-b
| else -> 0
diff(q: 10, b: 3): r |> std/io:print.ln("{{ r:d }}")
Actual compiler output
error[KORU181]: 'q-b' reads as one name, not subtraction — `-` joins identifiers (kebab), and no 'q-b' is declared
--> tests/regression/200_COMPILER_FEATURES/220_FLOW_CHECKER/220_054_unspaced_minus_in_branch_body/input.k:13:5
|
13 | | then -> q-b
| ^
hint: write 'q - b' for subtractionFrontend must reject with:
CONTAINS error[KORU181
CONTAINS reads as one name, not subtraction
CONTAINS write 'q - b' for subtractionFlows
subflow ~diff click a branch to expand · @labels scroll to their anchor
if (q > 0)
flow ~diff click a branch to expand · @labels scroll to their anchor
diff (q: 10, b: 3)
Test Configuration
MUST_ERROR