✓
Passing Passing: the compiler rejects this program as expected.
Code
// PINS: a `|>` step following an `if`'s arms must sit at the ARM column
// (`| then` / `| else`), not the `|> if` column. KORU010's generic "step
// directly above" text did not teach that; the refusal names the arm
// column so the fix is re-indent, not guesswork.
import std/io
import std/store
std/store:new(st) { x: 0[i64] }
pub tor w { } -> i64
w = std/store:stored { st.x: 0 }
|> if(st.x == 0)
| then |> std/store:stored { st.x: 1 }
| else |> std/store:stored { st.x: 2 }
|> std/store:stored { st.x: st.x + 10 }: _ -> st.x
w(): _ -> 0
std/io:print.ln("{{ st.x:d }}")
Actual compiler output
error[KORU010]: stray continuation line without Koru construct
--> tests/regression/200_COMPILER_FEATURES/210_PARSER/210_325_stray_pipe_under_if_arm_column_hint/input.k:15:5
|
15 | |> std/store:stored { st.x: st.x + 10 }: _ -> st.x
| ^
hint: the construct at line 14 ended before this line — a `|>` line chains onto the step directly above it. If this `|>` continues the armed construct above, re-indent it to the arm column (9, where `| then` / `| else` / `| done` sit — e.g. line 14), not the `|>` column.Frontend must reject with:
CONTAINS error[KORU010]
CONTAINS stray continuation
CONTAINS arm column
ERROR_AT 15
NOT_CONTAINS output_emitted.zigFlows
flow ~new click a branch to expand · @labels scroll to their anchor
new (st, source: x: 0[i64])
subflow ~w click a branch to expand · @labels scroll to their anchor
stored (source: st.x: 0)
flow ~w click a branch to expand · @labels scroll to their anchor
w
flow ~print.ln click a branch to expand · @labels scroll to their anchor
print.ln (expr: "{{ st.x:d }}")
Test Configuration
MUST_ERROR LANGUAGES: zig cs