bynk.types.is_base_mismatch
Error An is refinement check is applied to a value of the wrong base type.
value is Quantity runs a refined type's predicates against the value. A refined type is a base type plus predicates, so the value must have that base: an Int can be checked against Int where …, but a String has nothing for an Int range to test. Check the value against a refined type over its own type, or convert it first, for example by parsing the String.
Example
type Quantity = Int where InRange(1, 100)
s is Quantity // ✗ `s` is a `String`, `Quantity` is over `Int`
n is Quantity // ✓ `n` is an `Int`In the Book
See also
- The grammar rule it governs:
is_expr. - Every code in its category, Type checking, on the diagnostic index.
bynk explain bynk.types.is_base_mismatchshows the same from the installed toolchain, without a network.