Preserve type sugar in ArrayType, ConstType, and PointerType. (#5235)

Each of these types takes another type as an operand. Instead of storing
that other type as a `TypeId`, store it as an `InstId` so that we can
track how it was written, not only its canonical form.

The canonical constant values of these types continue to store the
canonical constant values of their operands, as normal.

---------

Co-authored-by: Dana Jansens <danakj@orodu.net>
This commit is contained in:
Richard Smith
2025-04-03 21:14:03 +00:00
committed by GitHub
co-authored by Dana Jansens
parent 164310c6b8
commit bba32900c3
141 changed files with 535 additions and 475 deletions
+2 -1
View File
@@ -29,7 +29,8 @@ auto PerformPointerDereference(
auto result_type_id = SemIR::ErrorInst::SingletonTypeId;
if (auto pointer_type =
context.types().TryGetAs<SemIR::PointerType>(type_id)) {
result_type_id = pointer_type->pointee_id;
result_type_id =
context.types().GetTypeIdForTypeInstId(pointer_type->pointee_id);
} else if (type_id != SemIR::ErrorInst::SingletonTypeId) {
diagnose_not_pointer(type_id);
}