# E4213

Compiler diagnostic name: `constr_for_non_struct`.

Constructor methods can only be defined for `struct` types.

MoonBit's `Type::new` constructor mechanism belongs to structs. Enums,
newtypes, and other type forms already have their own construction syntax, so a
constructor method for those types is rejected.

## Erroneous example

```moonbit
enum Status {
  Ready
}

fn Status::new() -> Status {
  Ready
}
```

`Status` is an `enum`, not a `struct`, so `Status::new` cannot be used as a
struct constructor.

## Suggestion

Use the enum constructor directly, or change the type to a `struct` if you need a
custom constructor method.

```moonbit
struct Status {}

fn Status::new() -> Status {
  Status::{  }
}
```
