✓
Passing This code compiles and runs correctly.
Code
// Test: constraints layer onto a type declared in ANOTHER module — the
// CUE move of separating declaration from refinement. test_lib/defs.k
// declares `std/proto(Server)` plainly; this entry writes
// `std/refine(app/test_lib/defs:Server)` and the facet meets the
// library's declaration program-wide.
//
// Expected: Stage C prints the canonical meet pinned to the library's
// home (expected_comptime); runtime prints `layered`.
import app/test_lib/defs
import std/refine
import std/io
std/refine(app/test_lib/defs:Server) {
port: i64 & >1024 & <=65535
}
std/io:print.ln("layered")
Supporting Files
// The library's declaration — plain, no constraints. The constraint
// arrives later, in a module that imported this one.
import std/proto
std/proto(Server) {
port: i64
host: string
}
Actual
layered
Expected output
layered
Expected comptime output
refine app.test_lib.defs:Server: port: i64 & >1024 & <=65535Flows
flow ~std/refine click a branch to expand · @labels scroll to their anchor
std/refine (app/test_lib/defs: Server, source: port: i64 & >1024 & <=65535)
flow ~print.ln click a branch to expand · @labels scroll to their anchor
print.ln (expr: "layered")
Test Configuration
MUST_RUN