# E4053

Compiler diagnostic name: `invalid_self_type`.

Invalid type for "self": must be a type constructor.

This error happens when you define a method or implement a trait for a type
that is not a type constructor.

Types that **are** type constructors:

- Tuple: `(Int, Bool)`
- `enum`s, `struct`s, `trait`s, new types (`type`), and error types (`type!`).

Types that **are not** type constructors:

- Function: `(Int) -> Bool`
- Type parameter: `T` in `fn f[T](x : T) -> T`

## Erroneous example

```{literalinclude} /sources/error_codes/4053_error/top.mbt
:language: moonbit
```

## Suggestion

Use a type constructor such as a struct, enum, trait, or new type. If you need
to attach methods to a function value, wrap the function in a named type first.

```{literalinclude} /sources/error_codes/4053_fixed/top.mbt
:language: moonbit
```
