E4045

E4045#

The field is not defined in the record type.

Erroneous Example#

struct S { a : Int, b : Int }
let a : Int = match S::{ a: 2, b: 3 } {
  { c: 2, .. } => 5
  _ => 6
}

The example above tries to match a record with a nonexistent field c, giving the following error on line 3:

The fields c is not defined in the record type S.

Suggestion#

Make sure to provide all fields with the correct names in the pattern.

struct S { a : Int, b : Int }
let a : Int = match S::{ a: 2, b: 3 } {
  { a: 2, .. } => 5
  _ => 6
}