✓
Passing Passing: the compiler rejects this program as expected.
Code
// [parallel]for: a @rem-fold whose MODULUS is item-bound isn't a fold —
// the join would replay @rem(_, i) with `i` unbound. Refuse, don't emit.
import std/io
capture { acc: 0[i64] }
! as a |> [parallel]for(2..101)
! each i |> captured { acc: @rem(a.acc + 7, @as(i64, @intCast(i))) }
| captured r |> std/io:print.ln("{{ r.acc:d }}")
Actual compiler output
error[KORU212]: [parallel]for: `@rem(a.acc + 7, @as(i64, @intCast(i)))` is not a provably additive write to `a.acc` — partition needs a combine law (provable monoid); write `acc: a.acc + <expr>` (or `*` / `@rem` fold) or drop [parallel]
--> tests/regression/400_RUNTIME_FEATURES/400_219_parallel_for_item_bound_modulus_refused/input.k:8:5Error output must contain
is not a provably additive writeFlows
flow ~capture click a branch to expand · @labels scroll to their anchor
capture (source: acc: 0[i64])
Test Configuration
MUST_ERROR