# E4202

Compiler diagnostic name: `update_struct_with_priv_field`.

Struct update syntax copies every field from the original value before applying
the explicit field changes. If the struct has private fields from another
package, code outside that package cannot perform the copy directly.

## Erroneous example

The imported package defines a struct with a private field:

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

The caller cannot use update syntax on that struct:

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

## Suggestion

Move the update into the package that owns the private fields, or expose a
helper that performs the update.

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

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