✓
Passing Passing: the compiler rejects this program as expected.
Code
// WALL: plural `! updated` binds the write contract — the written field's
// { old, new } images — never row fields. Destructuring a row field here
// confuses the lifecycle grammar (`inserted`/`removed` project ROW fields
// by pun; `updated` carries the DELTA) and must be rejected with a message
// that teaches the contract, at the koru level.
import std/io
import std/store
std/store:new(reserve) { pool: 0[i64] }
std/store:new(squad, capacity: 64) { hp: i64 }
! updated { hp } |> std/store:stored { reserve.pool: reserve.pool + hp }
std/store:insert(squad) { hp: 10 }
Actual compiler output
error[KORU161]: std/store:new(squad): `! updated` binds the written field's images — destructure exactly { old, new } (row fields ride `inserted`/`removed`)
--> tests/regression/600_STDLIB/690_STORE/690_039_store_plural_updated_bad_destructure/input.k:12:0Compiler must reject:
Compilation must fail with a diagnostic.
Error output must contain
std/store:new(squad): `! updated` binds the written field's images — destructure exactly { old, new } (row fields ride `inserted`/`removed`)Flows
flow ~new click a branch to expand · @labels scroll to their anchor
new (reserve, source: pool: 0[i64])
flow ~new click a branch to expand · @labels scroll to their anchor
new (squad, capacity: 64, source: hp: i64)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (squad, source: hp: 10)
Test Configuration
MUST_ERROR