bynk.types.is_refined_pattern
Error A refined (where) pattern was used on the right of is; refined patterns are match-only.
is tests a value against a type or a variant. An inline refinement, _ where Positive, is a pattern for a match arm, and is not accepted after is: a rule worth testing is worth a name, which also lets every other place use it. Declare a refined type and write n is Natural, or move the test into a match arm.
Example
n is _ where Positive // ✗ not a pattern for `is`
type Natural = Int where Positive
n is Natural // ✓ name the refinementIn 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_refined_patternshows the same from the installed toolchain, without a network.