# InternPool: don't remove outdated types · gitcafe/zig

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

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

Visibility: public

Requested revision: 46388d338a93a35d139866411f80115a03b30a6a

Requested commit: 46388d338a93a35d139866411f80115a03b30a6a

Commit: 46388d338a93a35d139866411f80115a03b30a6a

Tree: 57cd962b1fec235a99b808d2a2877bc4bcbd5f05

Author: mlugg

Committer: Jacob Young

## Message

```
InternPool: don't remove outdated types

When a type becomes outdated, there will still be lingering references
to the old index -- for instance, any declaration whose value was that
type holds a reference to that index. These references may live for an
arbitrarily long time in some cases. So, we can't just remove the type
from the pool -- the old `Index` must remain valid!

Instead, we want to preserve the old `Index`, but avoid it from ever
appearing in lookups. (It's okay if analysis of something referencing
the old `Index` does weird stuff -- such analysis are guaranteed by the
incremental compilation model to always be unreferenced.) So, we use the
new `InternPool.putKeyReplace` to replace the shard entry for this index
with the newly-created index.

```

## Parents

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

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