E4044#
Record fields are missing. Use ..
to ignore them in patterns.
Erroneous Example#
struct S { a : Int; b: Int }
let a : Int = match S::{ a: 2, b: 3 } {
{ a: 2 } => 4
_ => 6
}
The example above tries to match a record with a missing field b
,
giving the following error on line 3:
Record fields b are unmatched, use `..` to ignore them.
Suggestion#
Make sure to provide all fields in the pattern,
or simply ignore the missing fields using ..
:
struct S { a : Int; b: Int }
let a : Int = match S::{ a: 2, b: 3 } {
{ a: 2, b: 3 } => 4
{ a: 2, .. } => 5
_ => 6
}