Arms and clauses are tried top to bottom, and the earlier ones already match every value this one could, so it can never run. That usually means the order is wrong; the fix removes it.
Wrong#
fn sign(n: int): str = match n {
_ => "other"
0 => "zero"
}Fixed#
fn sign(n: int): str = match n {
0 => "zero"
_ => "other"
}Common causes#
- A catch-all
_or bare name placed before more specific patterns. - A duplicated arm after a copy-paste.
- A clause
fn f(n: int)placed abovefn f(0).