✓
Passing Passing: the compiler rejects this program as expected.
Code
// TEST: std/kernel — a reduce block that accumulates into a name with NO declared
// `<name>[<type>]` header is refused. The declared header is the ONLY way to
// introduce a reducer slot; a bare `+=` target is a compile error, not magic.
//
// `total[f64]` is declared; `weird` is used with NO declaration → refused with a
// located KORU123 that names the offending accumulator.
import std/kernel
import std/io
std/kernel:shape(Pt) {
mass: f64,
}
std/kernel:init(Pt) {
{ mass: 1.0 },
{ mass: 2.0 },
}
| kernel k |> std/kernel:reduce {
total[f64]
weird += k.mass
}
| reduce r |> std/io:print.blk {
total={{ r.total:f }}
}
Actual compiler output
error[KORU123]: std/kernel:reduce body names an accumulator `weird` that is not declared — add `<name>[<type>]` to the block header (e.g. `weird[f64]`)Error output must contain
std/kernel:reduce body names an accumulator `weird` that is not declaredFlows
flow ~shape click a branch to expand · @labels scroll to their anchor
shape (expr: Pt, source: mass: f64,)
flow ~init click a branch to expand · @labels scroll to their anchor
init (expr: Pt, source: { mass: 1.0 },
{ mass: 2.0 },)
Test Configuration
MUST_ERROR