✓
Passing This code compiles and runs correctly.
Code
// A compound `is`-guard over a THREE-member view: `e is Player or e is Enemy`
// picks two of three. The guard proves members by the UNION of positively
// named members (guardProvenMembers), and the emitter skips unproven members
// at emit time — the Boss loop is never generated, not merely filtered. The
// surviving loops' guards fold to constants. Negative-cost filtering: the
// narrowed query runs only the chosen members' loops.
import std/io
import std/proto
import std/store
std/proto:i64(Strength)
std/proto:i64(Mana)
std/proto:i64(Armor)
std/proto:i64(Rage)
std/proto(Player) {
str: Strength
mana: Mana
}
std/proto(Enemy) {
str: Strength
armor: Armor
}
std/proto(Boss) {
str: Strength
rage: Rage
}
std/store:new(Player, capacity: 8) { Player }
std/store:new(Enemy, capacity: 8) { Enemy }
std/store:new(Boss, capacity: 8) { Boss }
std/store:view(Entities) {
Player
Enemy
Boss
}
std/store:insert(Player) { str: 18, mana: 12 }
std/store:insert(Enemy) { str: 10, armor: 5 }
std/store:insert(Boss) { str: 42, rage: 1 }
std/store:query(Entities)
! query e when e is Player or e is Enemy |> std/io:print.ln("entity {{ e.str:d }}")
Actual
entity 18
entity 10
Expected output
entity 18
entity 10
Flows
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 ~i64 click a branch to expand · @labels scroll to their anchor
i64 (expr: Armor)
flow ~i64 click a branch to expand · @labels scroll to their anchor
i64 (expr: Rage)
flow ~std/proto click a branch to expand · @labels scroll to their anchor
std/proto (Player, source: str: Strength
mana: Mana)
flow ~std/proto click a branch to expand · @labels scroll to their anchor
std/proto (Enemy, source: str: Strength
armor: Armor)
flow ~std/proto click a branch to expand · @labels scroll to their anchor
std/proto (Boss, source: str: Strength
rage: Rage)
flow ~new click a branch to expand · @labels scroll to their anchor
new (Player, capacity: 8, source: Player)
flow ~new click a branch to expand · @labels scroll to their anchor
new (Enemy, capacity: 8, source: Enemy)
flow ~new click a branch to expand · @labels scroll to their anchor
new (Boss, capacity: 8, source: Boss)
flow ~view click a branch to expand · @labels scroll to their anchor
view (Entities, source: Player
Enemy
Boss)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (Player, source: str: 18, mana: 12)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (Enemy, source: str: 10, armor: 5)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (Boss, source: str: 42, rage: 1)
flow ~query click a branch to expand · @labels scroll to their anchor
query (Entities)
Test Configuration
MUST_RUN