# Sema: ensure resolveTypeFields is called for optional and error union types · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/3fa5415253695001149ad65ae6f2ca8d0fa63565)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 3fa5415253695001149ad65ae6f2ca8d0fa63565

Requested commit: 3fa5415253695001149ad65ae6f2ca8d0fa63565

Commit: 3fa5415253695001149ad65ae6f2ca8d0fa63565

Tree: 0dfb0d0db54dd2d7c00490daf7e41aef4107fdaf

Author: martinhath

Committer: GitHub

## Message

```
Sema: ensure resolveTypeFields is called for optional and error union types

We call `sema.resolveTypeFields` in order to get the fields of structs
and unions inserted into their data structures. If it isn't called, it
can happen that the fields of a type is queried before those fields are
inserted into (for instance) `Module.Union.fields`, which would result in
a wrong 'no field named' error.

Fixes: #12486
```

## Parents

- [bcaa9df5b42747577dcb529a99f6da6d69e09309](https://git.cafe/gitcafe/zig/commit/bcaa9df5b42747577dcb529a99f6da6d69e09309?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/3fa5415253695001149ad65ae6f2ca8d0fa63565?format=markdown)
