✓
Passing Passing: the compiler rejects this program as expected.
Code
// 690_365 — a store subscript whose index is PROVABLY not a row handle is
// refused at compile time (KORU161), not left to the runtime brand panic.
//
// res[world.focus] indexes res with a SCALAR store's column read. A scalar
// column can never carry a res row handle — handles are minted by `| row`,
// row cursors, or a handle-carrying column of the SAME store (the self-FK
// shape, `nodes[a.next]`, is sanctioned and stays legal — 690_048 is the
// control). world.focus is provably not any of those, so this program must
// be refused; today it compiles and panics in __koru_resolve at runtime.
//
// Shape surfaced by koru-libs/metal: drift.k/tilt.k keyed touch on
// res[world.focus]; the first real keypress panicked with 'does not
// address a row'. The fix on the consumer side is the guarded sweep
// (! query r when r.id == world.focus); this pin covers the refusal.
import std/store
import std/io
std/store:new(world) { focus: 0[i64] }
std/store:new(res, capacity: 8) { id: i64, touched: i64 }
std/store:insert(res) { id: 0, touched: 0 }
| row _ |> std/store:stored { res[world.focus].touched: 1 }
Actual compiler output
error[KORU161]: std/store: 'res[world.focus]' does not address a row — the index is a scalar-store column read, not a handle this store issued (handles come from `| row`, row cursors, or a handle-carrying column of the same store)
--> tests/regression/600_STDLIB/690_STORE/690_365_store_scalar_column_subscript_refused/input.k:23:1Must contain:
KORU161Error output must contain
std/store: 'res[world.focus]' does not address a row — the index is a scalar-store column read, not a handle this store issued (handles come from `| row`, row cursors, or a handle-carrying column of the same store)Flows
flow ~new click a branch to expand · @labels scroll to their anchor
new (world, source: focus: 0[i64])
flow ~new click a branch to expand · @labels scroll to their anchor
new (res, capacity: 8, source: id: i64, touched: i64)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (res, source: id: 0, touched: 0)
Test Configuration
MUST_ERROR