bynk.types.empty_range_pattern
Error A range pattern or via schema(...) range has its bounds inverted (lo > hi), so it can never match.
A range pattern lo..hi matches every Int from lo to hi, both inclusive, so the low bound comes first. With lo > hi no value can match, so the arm is dead and almost certainly a typo, and the same goes for a range in a via schema(...) clause. Swap the bounds. A refinement written InRange(150, 0) is the separate bynk.types.inverted_range.
Example
fn band(n: Int) -> String { match n { 9..3 => "mid" // ✗ the low bound is above the high bound _ => "other" }}
fn band(n: Int) -> String { match n { 3..9 => "mid" // ✓ _ => "other" }}In the Book
See also
- The grammar rule it governs:
int_range. - Every code in its category, Type checking, on the diagnostic index.
bynk explain bynk.types.empty_range_patternshows the same from the installed toolchain, without a network.