E3019#
Inclusive range pattern a..=b cannot have _ as upper bound.
Writing a..=_ does not make sense, because _ is a wildcard that matches any
value. It is unclear what does "equals to any value" mean. If you want to
express the meaning of "greater than or equal to a", you can use a..<_
instead.
Erroneous example#
///|
fn describe(value : Int) -> String {
match value {
0..=_ => "non-negative"
_ => "negative"
}
}
///|
test {
inspect(describe(0), content="non-negative")
}
Suggestion#
Replace ..=_ with ..<_:
///|
fn describe(value : Int) -> String {
match value {
0..<_ => "non-negative"
_ => "negative"
}
}
///|
test {
inspect(describe(0), content="non-negative")
}