# incremental: correctly return \`error.AnalysisFail\` when type structure changes · gitcafe/zig

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

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

Visibility: public

Requested revision: f818098971fdafdaaa6af4b927f2cf47332ed5f7

Requested commit: f818098971fdafdaaa6af4b927f2cf47332ed5f7

Commit: f818098971fdafdaaa6af4b927f2cf47332ed5f7

Tree: 68692d31a8c939887864ec302d8e8378c7c87cfd

Author: mlugg

Committer: mlugg

## Message

```
incremental: correctly return `error.AnalysisFail` when type structure changes

`Zcu.PerThead.ensureTypeUpToDate` is set up in such a way that it only
returns the updated type the first time it is called. In general, that's
okay; however, the exception is that we want the function to continue
returning `error.AnalysisFail` when the type has been lost, or its
number of captures changed.

Therefore, the check for this case now happens before the up-to-date
success return.

For simplicity, the number of captures is now handled by intentionally
losing the instruction in `Zcu.mapOldZirToNew`, since there is nothing
to gain from tracking a type when old instances of it can never be
reused.

```

## Parents

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

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