✓
Passing Passing: the compiler rejects this program as expected.
Code
// A lifecycle interceptor that BINDS a row field but never uses it must be
// rejected — the same KORU100 discipline every other binding obeys (bind it
// or discard with `_`). Here `! inserted { hp }` names `hp`, but the body only
// maintains a count and never reads it; the honest form is `! inserted _`.
//
// This wall has to live in the store transform: flow_checker's KORU100 pass
// deliberately SKIPS `[transform]` invocations, and `std/store:new` is one, so
// the normal unused-binding check never sees these arms.
~import std/io
~import std/store
~std/store:new(stats) { count: 0[i64] }
~std/store:new(pool, capacity: 64) { hp: i64 }
! inserted { hp } |> std/store:stored { stats.count: stats.count + 1 }
~std/store:watch(stats)
! count c |> std/io:print.ln("count {{ c:d }}")
~std/store:insert(pool) { hp: 1 }
| row _ |> _
| full |> _
Actual compiler output
error[KORU161]: std/store:new(pool): `! inserted` binds 'hp' but never uses it — discard the payload (`! inserted _`), or use the field in the body
--> tests/regression/600_STDLIB/690_STORE/690_032_store_reject_unused_interceptor_binding/input.kz:15:0Backend must reject with:
CONTAINS inserted
CONTAINS hp
CONTAINS never uses
CONTAINS inserted _Error output must contain
std/store:new(pool): `! inserted` binds 'hp' but never uses it — discard the payload (`! inserted _`), or use the field in the bodyFlows
flow ~new click a branch to expand · @labels scroll to their anchor
new (stats, source: count: 0[i64])
flow ~new click a branch to expand · @labels scroll to their anchor
new (pool, capacity: 64, source: hp: i64)
flow ~watch click a branch to expand · @labels scroll to their anchor
watch (stats)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (pool, source: hp: 1)
Test Configuration
MUST_ERROR