✓
Passing Passing: the compiler rejects this program as expected.
Code
// 698_016 — `ref(Ghost)` where Ghost is declared but no store holds its
// field set refuses at create: the column could only ever hold -1, which
// is a declaration bug, not a runtime state. Distinct from 698_011
// (unknown proto target) — here the target exists but has no home.
import std/proto
import std/store
std/proto(Ghost) {
hp: i64
}
std/store:new(refs, capacity: 4) {
g: ref(Ghost)
}
Actual compiler output
error[KORU161]: std/store:new(refs): field 'g' is ref(Ghost) but no store holds Ghost rows — a ref column needs a home: a container store whose row carries the target's fields (std/store:new(dogs, capacity: N) { Dog }); without one the column can only ever hold -1
--> tests/regression/600_STDLIB/698_OOP/698_016_proto_ref_no_home_refused/input.k:12:0Compiler must reject:
Compilation must fail with a diagnostic.
Flows
flow ~std/proto click a branch to expand · @labels scroll to their anchor
std/proto (Ghost, source: hp: i64)
flow ~new click a branch to expand · @labels scroll to their anchor
new (refs, capacity: 4, source: g: ref(Ghost))
Test Configuration
MUST_ERROR