Track the type as written in BaseDecl and AdaptDecl. (#4564)

Represent the type as an `InstId` rather than as a `TypeId` to preserve
how it was written and better support tracking its value in a generic.
Add accessors to `Class` to get the base and adapted type to reduce code
duplication, and add `TypeStore::GetObjectRepr` to make it easier to map
from a type to its possibly-adapted object representation type. In
passing, also move `GetIntTypeInfo` and `GetUnqualifiedType` into
`TypeStore`.

This fixes specifics of generic adapters to properly look at the
specific adapted type, and also fixes importing of adapters.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
Richard Smith
2024-11-27 22:26:30 +00:00
committed by GitHub
co-authored by Jon Ross-Perkins
parent e0db74a2a1
commit d6ec885eb3
51 changed files with 1530 additions and 415 deletions
+3 -3
View File
@@ -565,7 +565,7 @@ fn P(o: O) {
// CHECK:STDOUT:
// CHECK:STDOUT: class @E {
// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B]
// CHECK:STDOUT: %.loc13: %.6 = base_decl %B, element0 [template]
// CHECK:STDOUT: %.loc13: %.6 = base_decl %B.ref, element0 [template]
// CHECK:STDOUT: impl_decl @impl [template] {} {
// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%E [template = constants.%E]
// CHECK:STDOUT: %HasI.ref: type = name_ref HasI, file.%HasI.decl [template = constants.%HasI.type]
@@ -703,7 +703,7 @@ fn P(o: O) {
// CHECK:STDOUT:
// CHECK:STDOUT: class @L {
// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base]
// CHECK:STDOUT: %.loc13: %.6 = base_decl %Base, element0 [template]
// CHECK:STDOUT: %.loc13: %.6 = base_decl %Base.ref, element0 [template]
// CHECK:STDOUT: impl_decl @impl [template] {} {
// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%L [template = constants.%L]
// CHECK:STDOUT: %HasK.ref: type = name_ref HasK, file.%HasK.decl [template = constants.%HasK.type]
@@ -866,7 +866,7 @@ fn P(o: O) {
// CHECK:STDOUT:
// CHECK:STDOUT: class @O {
// CHECK:STDOUT: %NBase.ref: type = name_ref NBase, file.%NBase.decl [template = constants.%NBase]
// CHECK:STDOUT: %.loc17: %.8 = base_decl %NBase, element0 [template]
// CHECK:STDOUT: %.loc17: %.8 = base_decl %NBase.ref, element0 [template]
// CHECK:STDOUT: impl_decl @impl.1 [template] {} {
// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%O [template = constants.%O]
// CHECK:STDOUT: %HasN1.ref: type = name_ref HasN1, file.%HasN1.decl [template = constants.%HasN1.type]