E4198#
Compiler diagnostic name: struct_constr_not_implemented.
When a struct declares a constructor signature, that constructor must be
implemented as the corresponding Type::new method. The declaration only gives
the constructor signature; it does not create the implementation body.
Erroneous example#
///|
priv struct Point {
x : Int
fn new(Int) -> Point
}
Suggestion#
Define the matching Type::new method.
///|
priv struct Point {
x : Int
fn new(Int) -> Point
}
///|
fn Point::new(x : Int) -> Point {
{ x, }
}
///|
test {
let point = Point(4)
inspect(point.x, content="4")
}