✓
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:f64(Wobble)
std/proto(Player) {
str: Strength
}
std/proto(Enemy) {
str: Wobble
}
std/store:new(Player, capacity: 8) { Player }
std/store:new(Enemy, capacity: 8) { Enemy }
std/store:view(Entities) {
Player
Enemy
}
std/store:insert(Player) { str: 18 }
std/store:insert(Enemy) { str: 2.5 }
std/store:query(Entities)
! query e |> std/io:print.ln("s {{ e.str:d }}")
Actual compiler output
error[KORU161]: std/store:view(Entities): member 'Enemy': leaf 'str' as 'Wobble' collides with 'Strength' — one bare name, one identity; type-divergent same-name leaves across a view are refused
--> tests/regression/600_STDLIB/690_STORE/690_290_view_divergent_leaf_refused/input.k:27:0Must fail at runtime with:
CONTAINS type-divergent same-name leaves across a view are refusedFlows
flow ~i64 click a branch to expand · @labels scroll to their anchor
i64 (expr: Strength)
flow ~f64 click a branch to expand · @labels scroll to their anchor
f64 (expr: Wobble)
flow ~std/proto click a branch to expand · @labels scroll to their anchor
std/proto (Player, source: str: Strength)
flow ~std/proto click a branch to expand · @labels scroll to their anchor
std/proto (Enemy, source: str: Wobble)
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 ~view click a branch to expand · @labels scroll to their anchor
view (Entities, source: Player
Enemy)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (Player, source: str: 18)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (Enemy, source: str: 2.5)
flow ~query click a branch to expand · @labels scroll to their anchor
query (Entities)
Test Configuration
MUST_ERROR