XO0304: alternatives of an or pattern bind different names or types
The arm body of p1 | p2 runs for either alternative, so every alternative must bind the same names with the same types; otherwise a name would be unbound in one case. Bind the name in every alternative, or bind it in none and use separate arms. See core 3.5.
Example
fn f(r: Result[Int, Int]) -> Int {
match r {
Ok(v) | Err(_) => v
}
}Fix
fn f(r: Result[Int, Int]) -> Int {
match r {
Ok(v) | Err(v) => v
}
}Run xo explain XO0304 for this text in a terminal, or see
section 10.6 of the specification.