XO0171: `..` used more than once or not last in pattern fields
In variant and struct patterns, .. ignores the remaining fields and must come last: Db(msg: m, ..). A list pattern may contain .. once, anywhere: [first, .., last]. .. is not allowed outside list, variant, and struct patterns. See core 3.5.
Example
enum E { Db(msg: Str, code: Int) }
fn f(e: E) -> Int {
match e {
Db(.., code: c) => c
}
}Fix
enum E { Db(msg: Str, code: Int) }
fn f(e: E) -> Int {
match e {
Db(code: c, ..) => c
}
}Run xo explain XO0171 for this text in a terminal, or see
section 10.6 of the specification.