✓
Passing Passing: the compiler rejects this program as expected.
Code
// Test: bounds on a terminal that resolves to a non-integer scalar refuse —
// `email: Email` where Email minted by `std/proto:string(Email)` cannot take
// `& >5`. The terminal resolves to []const u8 and legality judges THAT, not
// the name — the refusal names the field's spelled base.
//
// Expected: the compile refuses with "integer scalars only" (EXPECT).
import std/proto
import std/refine
std/proto:string(Email)
std/proto(Contact) {
email: Email
}
std/refine(Contact) {
email: Email & >5
}
Actual compiler output
error[KORU205]: std/refine(Contact): field 'email' constrains base 'Email' — bounds and clamps refine integer scalars only
--> tests/regression/600_STDLIB/671_REFINE/671_017_refine_nonint_terminal_refused/input.k:16:0Must contain:
integer scalars onlyFlows
flow ~string click a branch to expand · @labels scroll to their anchor
string (expr: Email)
flow ~std/proto click a branch to expand · @labels scroll to their anchor
std/proto (Contact, source: email: Email)
flow ~std/refine click a branch to expand · @labels scroll to their anchor
std/refine (Contact, source: email: Email & >5)
Test Configuration
MUST_ERROR