# Sema: fix resolution of inferred error sets · gitcafe/zig

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

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

Visibility: public

Requested revision: 55ba335e0ffc2af76bf0743d98f5a959ccce0409

Requested commit: 55ba335e0ffc2af76bf0743d98f5a959ccce0409

Commit: 55ba335e0ffc2af76bf0743d98f5a959ccce0409

Tree: f9f705b5f33d0d54c52cdee9e38e40424ab9fd52

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
Sema: fix resolution of inferred error sets

Introduce `Module.ensureFuncBodyAnalyzed` and corresponding `Sema`
function. This mirrors `ensureDeclAnalyzed` except also waits until the
function body has been semantically analyzed, meaning that inferred
error sets will have been populated.

Resolving error sets can now emit a "unable to resolve inferred error
set" error instead of producing an incorrect error set type. Resolving
error sets now calls `ensureFuncBodyAnalyzed`. Closes #11046.

`coerceInMemoryAllowedErrorSets` now does a lot more work to avoid
resolving an inferred error set if possible. Same with
`wrapErrorUnionSet`.

Inferred error set types no longer check the `func` field to determine if
they are equal. That was incorrect because an inline or comptime function
call produces a unique error set which has the same `*Module.Fn` value for
this field. Instead we use the `*Module.Fn.InferredErrorSet` pointers to
test equality of inferred error sets.

```

## Parents

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

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