# E4018

Cannot resolve trait for the given type.

## Erroneous Example

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

The example above tries to call the method `to_string` from the `Show` trait and
the method `f` from the `HasDefault` trait on type `S`, but since `S` does not
implement those traits, it gives the following error:

```
Type S does not implement trait Show: no `impl` is defined
Type S does not implement trait HasDefault: no `impl` is defined
```

```{hint}
For a trait that has default implementations for all its methods, an explicit
implementation declaration is still needed.
```

## Suggestion

Implement the `Show` trait and the `HasDefault` trait for the type `S`:

```{literalinclude} /sources/error_codes/4018_fixed/fix.mbt
:language: moonbit
```
