bynk.types.is_range_pattern
Error A range pattern was used directly on the right of is; is tests type/refinement, not value ranges (use match, a guard or InRange).
is tests a value's variant or refined type, not whether a number lies in a range, so age is 13..19 would read as a type test while comparing values. Bynk refuses it. Compare the bounds, write a match arm 13..19, or declare a refined type with InRange(13, 19) and test against that. The literal case is bynk.types.is_literal_pattern.
Example
fn teen(age: Int) -> Bool { age is 13..19 // ✗ `is` tests a type, not a range}
fn teen(age: Int) -> Bool { age >= 13 && age <= 19 // ✓}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_range_patternshows the same from the installed toolchain, without a network.