E4091

E4091#

The type has no field with the given name.

It is possible that you made a typo and use a wrong field name to access the field of a struct.

错误示例#

struct Point {
  x : Double
  y : Double
}

fn main {
  let point = Point::{ x : 1.0, y : 2.0 }
  println(point.z) // Error: The type Point has no field z.
}

建议#

You can either add the missing field to the struct, or use an existing field to access the struct.

struct Point {
  x : Double
  y : Double
}

fn main {
  let point = Point::{ x : 1.0, y : 2.0 }
  println(point.x)
  println(point.y)
}