✓
Passing Passing: the compiler rejects this program as expected.
Code
import std/io
import std/proto
import std/store
std/proto:i64(Strength)
std/proto:i64(Mana)
std/proto(Player) {
str: Strength
mana: Mana
}
std/store:new(Player, capacity: 8) { Player }
std/store:insert(Player) { str: 18, mana: 12 }
std/store:query(Player)
! query e when e is Player |> std/io:print.ln("p {{ e.str:d }}")
Actual compiler output
error[KORU161]: std/store:query(Player): the guard reads `e is ...`, but store 'Player' declares no members - `is` reads the kind tag over union members (`new(Player) { player: Player, ... }`)
--> tests/regression/600_STDLIB/690_STORE/690_289_is_guard_on_lone_store_refused/input.k:17:0Must fail at runtime with:
CONTAINS declares no membersFlows
flow ~i64 click a branch to expand · @labels scroll to their anchor
i64 (expr: Strength)
flow ~i64 click a branch to expand · @labels scroll to their anchor
i64 (expr: Mana)
flow ~std/proto click a branch to expand · @labels scroll to their anchor
std/proto (Player, source: str: Strength
mana: Mana)
flow ~new click a branch to expand · @labels scroll to their anchor
new (Player, capacity: 8, source: Player)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (Player, source: str: 18, mana: 12)
flow ~query click a branch to expand · @labels scroll to their anchor
query (Player)
Test Configuration
MUST_ERROR