# Sema: clean up peer resolution of errors · gitcafe/zig

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

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

Visibility: public

Requested revision: 4763fd1a41bc5f6bb59b5c3c079069b84f19305a

Requested commit: 4763fd1a41bc5f6bb59b5c3c079069b84f19305a

Commit: 4763fd1a41bc5f6bb59b5c3c079069b84f19305a

Tree: a4f38b1e2150b5d2a88c66d2d96c23b9dd39775c

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
Sema: clean up peer resolution of errors

 * Fix compile error for `zirErrorUnionType`.
 * Convert zirMergeErrorSets logic to call `Type.errorSetMerge`.
   It does not need to create a Decl as the TODO comment hinted.
 * Extract out a function called `resolveInferredErrorSetTy`.
 * Rework `resolvePeerTypes` with respect to error unions and
   error sets. This is a less complex implementation that passes all the
   same tests and uses many fewer lines of code by taking advantage of
   the function `coerceInMemoryAllowedErrorSets`.
   - Always merge error sets in the order that makes sense, even when
     that means `@typeInfo` incompatibility with stage1.
 * `Type.errorSetMerge` no longer overallocates.
 * Don't skip passing tests.

```

## Parents

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

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