# InternPool: preserve indices of builtin types when resolved · gitcafe/zig

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

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

Visibility: public

Requested revision: 083ee8e0e28ed0d1c4e1df6b5aa12f2709731b50

Requested commit: 083ee8e0e28ed0d1c4e1df6b5aa12f2709731b50

Commit: 083ee8e0e28ed0d1c4e1df6b5aa12f2709731b50

Tree: be33c2a904c85361b9f732d6e57284754859f8e0

Author: mlugg

Committer: mlugg

## Message

```
InternPool: preserve indices of builtin types when resolved

Some builtin types have a special InternPool index (e.g.
`.type_info_type`) so that AstGen can refer to them before semantic
analysis. Unfortunately, this previously led to a second index existing
to refer to the type once it was resolved, complicating Sema by having
the concept of an "unresolved" type index.

This change makes Sema modify these InternPool indices in-place to
contain the expanded representation when resolved. The analysis of the
corresponding decls is caught in `Module.semaDecl`, and a field is set
on Sema telling it which index to place struct/union/enum types at. This
system could break if `std.builtin` contained complex decls which
evaluate multiple struct types, but this will be caught by the
assertions in `InternPool.resolveBuiltinType`.

The AstGen result types which were disabled in 6917a8c have been
re-enabled.

Resolves: #16603

```

## Parents

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

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