E4091#
该类型没有具有给定名称的字段。
您可能输入了错误的字段名称来访问结构体的字段。
错误示例#
///|
priv struct Point {
x : Double
y : Double
}
///|
test {
let point = Point::{ x: 1.0, y: 2.0 }
inspect(point.z) // Error: The type Point has no field z.
}
建议#
您可以向结构体添加缺失的字段,或者使用现有字段来访问结构体。
///|
priv struct Point {
x : Double
y : Double
}
///|
test {
let point = Point::{ x: 1.0, y: 2.0 }
inspect(point.x, content="1")
inspect(point.y, content="2")
}