Store an InstId instead of a TypeId in UnboundElementType. (#5260)

This gives a slightly simpler representation for `UnboundElementType`s
in eval blocks, and in principle allows us to preserve the spelling of a
field's type into the `UnboundElementType` and thereby into a field
reference, although as of right now this doesn't affect our diagnostic
output in any way.

During error recovery for a field with a non-concrete type, preserve the
type in the `UnboundElementType` regardless. It's not really problematic
to have a non-concrete type there, and this makes it easier to track the
instruction used to specify the type.

This is a step towards switching symbolic types to always be abstract
during type checking.
This commit is contained in:
Richard Smith
2025-04-08 22:21:44 +00:00
committed by GitHub
parent bfef32b482
commit 1a4d6ca255
25 changed files with 81 additions and 74 deletions
+2 -2
View File
@@ -157,8 +157,8 @@ auto GetPointerType(Context& context, SemIR::InstId pointee_type_id)
return GetTypeImpl<SemIR::PointerType>(context, pointee_type_id);
}
auto GetUnboundElementType(Context& context, SemIR::TypeId class_type_id,
SemIR::TypeId element_type_id) -> SemIR::TypeId {
auto GetUnboundElementType(Context& context, SemIR::InstId class_type_id,
SemIR::InstId element_type_id) -> SemIR::TypeId {
return GetTypeImpl<SemIR::UnboundElementType>(context, class_type_id,
element_type_id);
}