`bynk.types.is_base_mismatch`
[bynk.types.is_base_mismatch] `is Quantity` checks an `Int` value, but got `String`What it means
Section titled “What it means”value is RefinedType narrows a value to a refined type by checking its
predicates at runtime. That only makes sense when the value’s type matches the
refined type’s base — you cannot check a String against an Int-based
refinement.
type Quantity = Int where InRange(1, 100)
fn f(s: String) -> Bool { s is Quantity -- Quantity is Int-based; s is a String}Check the value against a refined type of its own base type, or convert first:
- For an
Intvalue, use anInt-based refined type (Quantity = Int where …). - For a
Stringvalue, use aString-based one (Code = String where …).
Related
Section titled “Related”- Narrow and bind with
is - Reference: Refined types