# Compilation: fix reference trace behavior without \`\-freference-trace\` · gitcafe/zig

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

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

Visibility: public

Requested revision: 70040778fbde5d7fcbbfc26dbabc700024c538d5

Requested commit: 70040778fbde5d7fcbbfc26dbabc700024c538d5

Commit: 70040778fbde5d7fcbbfc26dbabc700024c538d5

Tree: 171a2b244a979e0943305f1460e466c6a1d2123b

Author: mlugg

Committer: mlugg

## Message

```
Compilation: fix reference trace behavior without `-freference-trace`

When `-freference-trace` is not passed, we want to show exactly one
reference trace. Previously, we set the reference trace root in `Sema`
iff there were no other failed analyses. However, this results in an
arbitrary error being the one with the reference trace after error
sorting. It is also incompatible with incremental compilation, where
some errors might be unreferenced. Instead, set the field on all
analysis errors, and decide in `Compilation.getAllErrorsAlloc` which
reference trace[s] to actually show.

```

## Parents

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

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