mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 17:31:05 +01:00
Convert remaining type-value InstId fields to TypeInstId (#5294)
After #5280 there are a few more typed instructions that have an `InstId type_inst_id` that always holds a type value. These are converted to `TypeInstId` to encode this fact in the type system. The `ConvertAggregateElement()` function in convert.cpp is now able to receive `TypeInstId` for a couple arguments as well. Additionally, the `type_inst_id` field of `StructTypeField` is made into a `TypeInstId`. The `TupleType::elements_id` is renamed to `TupleType::type_elements_id` to try record the fact that it's an InstBlock of type value instructions. We don't introduce a TypeInstBlockId at this time, but it might be nice to make blocks of TypeInstIds in the future. To assist in working with a block of InstId that are type values, two additional helpers are added to the TypeStore: - GetBlockAsTypeInstIds which turns an `ArrayRef<InstId>` into a range of `TypeInstId` - GetBlockAsTypeIds which turns an `ArrayRef<InstId>` into a range of `TypeId` We use these helpers in places that iterate over the `TupleType::type_elements_id`.
This commit is contained in:
@@ -587,7 +587,7 @@ class Stringifier {
|
||||
}
|
||||
|
||||
auto StringifyInst(SemIR::InstId /*inst_id*/, TupleType inst) -> void {
|
||||
auto refs = sem_ir_->inst_blocks().Get(inst.elements_id);
|
||||
auto refs = sem_ir_->inst_blocks().Get(inst.type_elements_id);
|
||||
if (refs.empty()) {
|
||||
*out_ << "()";
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user