✓
Passing Passing: the compiler rejects this program as expected.
Code
// Test: a clamp whose range cannot satisfy the field's bounds refines to
// nothing — `clamp(0,100)` saturates every write into [0,100], so `>200`
// can never hold. The meet is empty and the refusal names the two terms
// that disagree — same KORU205 discipline as `>20000 & <=1000`.
//
// Expected: the compile refuses with "refines to nothing" (EXPECT).
import std/proto
import std/refine
std/proto(Mixer) {
gain: i64
}
std/refine(Mixer) {
gain: i64 & clamp(0, 100) & >200
}
Actual compiler output
error[KORU205]: std/refine(Mixer): field 'gain' refines to nothing — 'clamp(0,100)' and '>200' cannot both hold
--> tests/regression/600_STDLIB/671_REFINE/671_013_refine_clamp_empty_meet_refused/input.k:14:0Must contain:
refines to nothingFlows
flow ~std/proto click a branch to expand · @labels scroll to their anchor
std/proto (Mixer, source: gain: i64)
flow ~std/refine click a branch to expand · @labels scroll to their anchor
std/refine (Mixer, source: gain: i64 & clamp(0, 100) & >200)
Test Configuration
MUST_ERROR