From 2c6d9c7f666c2be26c4b63f4c30cde728ae53e62 Mon Sep 17 00:00:00 2001 From: Jon Ross-Perkins Date: Mon, 9 Feb 2026 14:00:21 -0800 Subject: [PATCH] Rename type's GetInstId to GetTypeInstId, reflecting returned type (#6708) Discussed briefly [on Discord](https://discord.com/channels/655572317891461132/655578254970716160/1470442830118912265), done to reduce confusion. Assisted-by: Google Antigravity with Gemini 3 Flash --- toolchain/check/action.cpp | 2 +- toolchain/check/class.cpp | 12 +++++++----- toolchain/check/convert.cpp | 11 ++++++----- toolchain/check/cpp/import.cpp | 4 ++-- toolchain/check/cpp/thunk.cpp | 4 ++-- toolchain/check/custom_witness.cpp | 2 +- toolchain/check/deduce.cpp | 8 +++++--- toolchain/check/diagnostic_emitter.cpp | 6 +++--- toolchain/check/eval_inst.cpp | 2 +- toolchain/check/function.cpp | 7 ++++--- toolchain/check/generic.cpp | 2 +- toolchain/check/handle_binding_pattern.cpp | 2 +- toolchain/check/handle_choice.cpp | 8 ++++---- toolchain/check/handle_class.cpp | 2 +- toolchain/check/handle_if_expr.cpp | 3 ++- toolchain/check/handle_impl.cpp | 7 ++++--- toolchain/check/handle_index.cpp | 4 ++-- toolchain/check/handle_loop_statement.cpp | 2 +- toolchain/check/handle_operator.cpp | 4 ++-- toolchain/check/handle_pattern_list.cpp | 2 +- toolchain/check/handle_struct.cpp | 4 ++-- toolchain/check/handle_tuple_literal.cpp | 2 +- toolchain/check/handle_where.cpp | 2 +- toolchain/check/import_ref.cpp | 22 +++++++++++----------- toolchain/check/interface.cpp | 4 ++-- toolchain/check/member_access.cpp | 4 ++-- toolchain/check/name_lookup.cpp | 2 +- toolchain/check/operator.cpp | 2 +- toolchain/check/pattern_match.cpp | 2 +- toolchain/check/subst.cpp | 2 +- toolchain/check/type.cpp | 8 ++++---- toolchain/check/type_completion.cpp | 12 ++++++------ toolchain/lower/file_context.cpp | 2 +- toolchain/lower/handle.cpp | 4 ++-- toolchain/sem_ir/builtin_function_kind.cpp | 6 +++--- toolchain/sem_ir/dump.cpp | 2 +- toolchain/sem_ir/inst_fingerprinter.cpp | 2 +- toolchain/sem_ir/stringify.cpp | 2 +- toolchain/sem_ir/type.cpp | 6 +++--- toolchain/sem_ir/type.h | 4 ++-- toolchain/sem_ir/type_iterator.cpp | 2 +- 41 files changed, 99 insertions(+), 91 deletions(-) diff --git a/toolchain/check/action.cpp b/toolchain/check/action.cpp index eec2e8032495..7ea74e2b88d1 100644 --- a/toolchain/check/action.cpp +++ b/toolchain/check/action.cpp @@ -130,7 +130,7 @@ static auto RefineOperand(Context& context, SemIR::LocId loc_id, // If the type of the action argument is dependent, refine to an instruction // with a concrete type. if (OperandIsDependent(context, inst.type_id())) { - auto type_inst_id = context.types().GetInstId(inst.type_id()); + auto type_inst_id = context.types().GetTypeInstId(inst.type_id()); inst_id = AddDependentActionSpliceImpl( context, SemIR::LocIdAndInst( diff --git a/toolchain/check/class.cpp b/toolchain/check/class.cpp index 58d2fb4ca109..220f4213983c 100644 --- a/toolchain/check/class.cpp +++ b/toolchain/check/class.cpp @@ -42,7 +42,7 @@ auto StartClassDefinition(Context& context, SemIR::Class& class_info, // Introduce `Self`. context.name_scopes().AddRequiredName( class_info.scope_id, SemIR::NameId::SelfType, - context.types().GetInstId(class_info.self_type_id)); + context.types().GetTypeInstId(class_info.self_type_id)); } // Checks that the specified finished adapter definition is valid and builds and @@ -102,7 +102,8 @@ static auto CheckCompleteAdapterClassType( context, node_id, {.type_id = GetSingletonType(context, SemIR::WitnessType::TypeInstId), // TODO: Use InstId from the adapt declaration. - .object_repr_type_inst_id = context.types().GetInstId(object_repr_id)}); + .object_repr_type_inst_id = + context.types().GetTypeInstId(object_repr_id)}); } static auto AddStructTypeFields( @@ -271,7 +272,7 @@ static auto CheckCompleteClassType( auto base_type_id = class_info.GetBaseType(context.sem_ir(), SemIR::SpecificId::None); // TODO: Use InstId from base declaration. - auto base_type_inst_id = context.types().GetInstId(base_type_id); + auto base_type_inst_id = context.types().GetTypeInstId(base_type_id); std::optional base_class_type; if (base_type_id.has_value()) { // TODO: If the base class is template dependent, we will need to decide @@ -289,7 +290,7 @@ static auto CheckCompleteClassType( if (defining_vptr) { struct_type_fields.push_back( {.name_id = SemIR::NameId::Vptr, - .type_inst_id = context.types().GetInstId( + .type_inst_id = context.types().GetTypeInstId( GetPointerType(context, SemIR::VtableType::TypeInstId))}); } if (base_type_id.has_value()) { @@ -315,7 +316,8 @@ static auto CheckCompleteClassType( return AddInst( context, node_id, {.type_id = GetSingletonType(context, SemIR::WitnessType::TypeInstId), - .object_repr_type_inst_id = context.types().GetInstId(struct_type_id)}); + .object_repr_type_inst_id = + context.types().GetTypeInstId(struct_type_id)}); } auto ComputeClassObjectRepr(Context& context, Parse::ClassDefinitionId node_id, diff --git a/toolchain/check/convert.cpp b/toolchain/check/convert.cpp index 435f9422f1d8..44fcccb4056e 100644 --- a/toolchain/check/convert.cpp +++ b/toolchain/check/convert.cpp @@ -469,7 +469,7 @@ static auto ConvertTupleToType(Context& context, SemIR::LocId loc_id, // TODO: Should we add this as an instruction? It will contain // references to local InstIds. auto tuple_type_id = GetTupleType(context, type_inst_ids); - return context.types().GetInstId(tuple_type_id); + return context.types().GetTypeInstId(tuple_type_id); } // Common implementation for ConvertStructToStruct and ConvertStructToClass. @@ -1258,7 +1258,7 @@ static auto PerformBuiltinConversion( if (auto struct_type = sem_ir.types().TryGetAs(value_type_id)) { if (struct_type->fields_id == SemIR::StructTypeFieldsId::Empty) { - type_value_id = sem_ir.types().GetInstId(value_type_id); + type_value_id = sem_ir.types().GetTypeInstId(value_type_id); } } @@ -1808,7 +1808,7 @@ auto Convert(Context& context, SemIR::LocId loc_id, SemIR::InstId expr_id, target.kind == ConversionTarget::Value && (OperandIsDependent(context, expr_id) || OperandIsDependent(context, target.type_id))) { - auto target_type_inst_id = context.types().GetInstId(target.type_id); + auto target_type_inst_id = context.types().GetTypeInstId(target.type_id); return AddDependentActionSplice( context, loc_id, SemIR::ConvertToValueAction{ @@ -1821,7 +1821,7 @@ auto Convert(Context& context, SemIR::LocId loc_id, SemIR::InstId expr_id, // If this is not a builtin conversion, try an `ImplicitAs` conversion. if (sem_ir.insts().Get(expr_id).type_id() != target.type_id) { SemIR::InstId interface_args[] = { - context.types().GetInstId(target.type_id)}; + context.types().GetTypeInstId(target.type_id)}; Operator op = { .interface_name = GetConversionInterfaceName(target.kind), .interface_args_ref = interface_args, @@ -1993,7 +1993,8 @@ auto ConvertCallArgs(Context& context, SemIR::LocId call_loc_id, auto TypeExpr::ForUnsugared(Context& context, SemIR::TypeId type_id) -> TypeExpr { - return {.inst_id = context.types().GetInstId(type_id), .type_id = type_id}; + return {.inst_id = context.types().GetTypeInstId(type_id), + .type_id = type_id}; } static auto DiagnoseTypeExprEvaluationFailure(Context& context, diff --git a/toolchain/check/cpp/import.cpp b/toolchain/check/cpp/import.cpp index a170331bdc4b..1165d92f6778 100644 --- a/toolchain/check/cpp/import.cpp +++ b/toolchain/check/cpp/import.cpp @@ -819,7 +819,7 @@ static auto MapBuiltinType(Context& context, SemIR::LocId loc_id, if (type.isBooleanType()) { CARBON_CHECK(ast_context.hasSameType(qual_type, ast_context.BoolTy)); return ExprAsType(context, Parse::NodeId::None, - context.types().GetInstId(GetSingletonType( + context.types().GetTypeInstId(GetSingletonType( context, SemIR::BoolType::TypeInstId))); } if (type.isInteger()) { @@ -989,7 +989,7 @@ static auto MapReferenceType(Context& context, clang::QualType type, SemIR::TypeId pointer_type_id = GetPointerType(context, referenced_type_expr.inst_id); pointer_type_id = - GetConstType(context, context.types().GetInstId(pointer_type_id)); + GetConstType(context, context.types().GetTypeInstId(pointer_type_id)); return TypeExpr::ForUnsugared(context, pointer_type_id); } diff --git a/toolchain/check/cpp/thunk.cpp b/toolchain/check/cpp/thunk.cpp index 06fde46ea7f5..3d35b40748bb 100644 --- a/toolchain/check/cpp/thunk.cpp +++ b/toolchain/check/cpp/thunk.cpp @@ -685,7 +685,7 @@ auto PerformCppThunkCall(Context& context, SemIR::LocId loc_id, arg_id = AddInst( context, loc_id, {.type_id = GetPointerType( - context, context.types().GetInstId(callee_param_type_id)), + context, context.types().GetTypeInstId(callee_param_type_id)), .lvalue_id = arg_id}); arg_id = ConvertToValueOfType(context, loc_id, arg_id, thunk_param_type_id); @@ -705,7 +705,7 @@ auto PerformCppThunkCall(Context& context, SemIR::LocId loc_id, auto arg_id = AddInst( context, loc_id, {.type_id = GetPointerType( - context, context.types().GetInstId( + context, context.types().GetTypeInstId( context.insts().Get(return_slot_id).type_id())), .lvalue_id = return_slot_id}); thunk_arg_ids.push_back(arg_id); diff --git a/toolchain/check/custom_witness.cpp b/toolchain/check/custom_witness.cpp index ba2dc0351617..219cf07ea251 100644 --- a/toolchain/check/custom_witness.cpp +++ b/toolchain/check/custom_witness.cpp @@ -27,7 +27,7 @@ static auto GetFacetAsType(Context& context, if (context.types().Is(type_type_id)) { // It's a facet; access its type. - facet_or_type_id = context.types().GetInstId( + facet_or_type_id = context.types().GetTypeInstId( GetFacetAccessType(context, facet_or_type_id)); } return context.types().GetTypeIdForTypeInstId(facet_or_type_id); diff --git a/toolchain/check/deduce.cpp b/toolchain/check/deduce.cpp index 82de27d626d3..2c010667f2fa 100644 --- a/toolchain/check/deduce.cpp +++ b/toolchain/check/deduce.cpp @@ -43,7 +43,8 @@ class DeductionWorklist { // Adds a single (param, arg) type deduction. auto Add(SemIR::TypeId param, SemIR::TypeId arg) -> void { - Add(context_->types().GetInstId(param), context_->types().GetInstId(arg)); + Add(context_->types().GetTypeInstId(param), + context_->types().GetTypeInstId(arg)); } // Adds a single (param, arg) deduction of a specific. @@ -300,8 +301,9 @@ auto DeductionContext::Deduce() -> bool { // If the parameter has a symbolic type, deduce against that. if (param_type_id.is_symbolic()) { - Add(context().types().GetInstId(param_type_id), - context().types().GetInstId(context().insts().Get(arg_id).type_id())); + Add(context().types().GetTypeInstId(param_type_id), + context().types().GetTypeInstId( + context().insts().Get(arg_id).type_id())); } else { // The argument (e.g. a TupleLiteral of types) may be convertible to a // compile-time value (e.g. TupleType) that we can decompose further. diff --git a/toolchain/check/diagnostic_emitter.cpp b/toolchain/check/diagnostic_emitter.cpp index f332aa572df2..44c6684b6329 100644 --- a/toolchain/check/diagnostic_emitter.cpp +++ b/toolchain/check/diagnostic_emitter.cpp @@ -95,7 +95,7 @@ auto DiagnosticEmitter::ConvertArg(llvm::Any arg) const -> llvm::Any { return "`" + StringifyConstantInst( *sem_ir_, - sem_ir_->types().GetInstId( + sem_ir_->types().GetTypeInstId( sem_ir_->insts().Get(type_of_expr->inst_id).type_id())) + "`"; } @@ -107,12 +107,12 @@ auto DiagnosticEmitter::ConvertArg(llvm::Any arg) const -> llvm::Any { } if (auto* type = llvm::any_cast(&arg)) { return StringifyConstantInst(*sem_ir_, - sem_ir_->types().GetInstId(type->type_id)); + sem_ir_->types().GetTypeInstId(type->type_id)); } if (auto* type_id = llvm::any_cast(&arg)) { return "`" + StringifyConstantInst(*sem_ir_, - sem_ir_->types().GetInstId(*type_id)) + + sem_ir_->types().GetTypeInstId(*type_id)) + "`"; } if (auto* facet_type_id = llvm::any_cast(&arg)) { diff --git a/toolchain/check/eval_inst.cpp b/toolchain/check/eval_inst.cpp index 205d5607777b..cf234b81cda4 100644 --- a/toolchain/check/eval_inst.cpp +++ b/toolchain/check/eval_inst.cpp @@ -527,7 +527,7 @@ auto EvalConstantInst(Context& context, SemIR::InstId inst_id, } return ConstantEvalResult::NewSamePhase(SemIR::CompleteTypeWitness{ .type_id = witness_type_id, - .object_repr_type_inst_id = context.types().GetInstId( + .object_repr_type_inst_id = context.types().GetTypeInstId( context.types().GetObjectRepr(complete_type_id))}); } diff --git a/toolchain/check/function.cpp b/toolchain/check/function.cpp index 0bb82ce18467..70184f172a26 100644 --- a/toolchain/check/function.cpp +++ b/toolchain/check/function.cpp @@ -103,7 +103,7 @@ auto MakeBuiltinFunction(Context& context, SemIR::LocId loc_id, BeginSubpattern(context); auto self_type_region_id = EndSubpatternAsExpr( - context, context.types().GetInstId(signature.self_type_id)); + context, context.types().GetTypeInstId(signature.self_type_id)); self_param_id = AddParamPattern(context, loc_id, SemIR::NameId::SelfValue, self_type_region_id, signature.self_type_id, @@ -124,7 +124,7 @@ auto MakeBuiltinFunction(Context& context, SemIR::LocId loc_id, for (auto param_type_id : signature.param_type_ids) { BeginSubpattern(context); auto param_type_region_id = EndSubpatternAsExpr( - context, context.types().GetInstId(param_type_id)); + context, context.types().GetTypeInstId(param_type_id)); context.inst_block_stack().AddInstId(AddParamPattern( context, loc_id, SemIR::NameId::Underscore, param_type_region_id, @@ -140,7 +140,8 @@ auto MakeBuiltinFunction(Context& context, SemIR::LocId loc_id, .type_id = SemIR::TypeId::None}; if (signature.return_type_id.has_value()) { return_form = ExprAsReturnForm( - context, loc_id, context.types().GetInstId(signature.return_type_id)); + context, loc_id, + context.types().GetTypeInstId(signature.return_type_id)); return_patterns_id = AddReturnPatterns(context, loc_id, return_form); } diff --git a/toolchain/check/generic.cpp b/toolchain/check/generic.cpp index 3f5988959ea6..fe1edcc88b12 100644 --- a/toolchain/check/generic.cpp +++ b/toolchain/check/generic.cpp @@ -209,7 +209,7 @@ static auto AddGenericTypeToEvalBlock(Context& context, SemIR::LocId loc_id, // block. auto rebuild_generic_constant_callbacks = RebuildGenericConstantInEvalBlockCallbacks(&context, loc_id); - auto type_inst_id = SubstInst(context, context.types().GetInstId(type_id), + auto type_inst_id = SubstInst(context, context.types().GetTypeInstId(type_id), rebuild_generic_constant_callbacks); return context.types().GetTypeIdForTypeConstantId( context.constant_values().GetAttached(type_inst_id)); diff --git a/toolchain/check/handle_binding_pattern.cpp b/toolchain/check/handle_binding_pattern.cpp index f8201a595e92..b78dfe7742be 100644 --- a/toolchain/check/handle_binding_pattern.cpp +++ b/toolchain/check/handle_binding_pattern.cpp @@ -419,7 +419,7 @@ auto HandleParseNode(Context& context, Parse::FieldNameAndTypeId node_id) } auto& class_info = context.classes().Get(parent_class_decl->class_id); auto field_type_id = GetUnboundElementType( - context, context.types().GetInstId(class_info.self_type_id), + context, context.types().GetTypeInstId(class_info.self_type_id), cast_type_inst_id); auto field_id = AddInst(context, node_id, diff --git a/toolchain/check/handle_choice.cpp b/toolchain/check/handle_choice.cpp index d44e624df4ab..231a4b1e92e6 100644 --- a/toolchain/check/handle_choice.cpp +++ b/toolchain/check/handle_choice.cpp @@ -122,7 +122,7 @@ auto HandleParseNode(Context& context, Parse::ChoiceDefinitionStartId node_id) context.name_scopes().AddRequiredName( class_info.scope_id, SemIR::NameId::SelfType, - context.types().GetInstId(self_type_id)); + context.types().GetTypeInstId(self_type_id)); // Mark the beginning of the choice body. context.node_stack().Push(node_id, class_decl.class_id); @@ -273,7 +273,7 @@ auto HandleParseNode(Context& context, Parse::ChoiceDefinitionId node_id) llvm::SmallVector struct_type_fields; struct_type_fields.push_back({ .name_id = SemIR::NameId::ChoiceDiscriminant, - .type_inst_id = context.types().GetInstId(discriminant_type_id), + .type_inst_id = context.types().GetTypeInstId(discriminant_type_id), }); auto fields_id = context.struct_type_fields().AddCanonical(struct_type_fields); @@ -281,8 +281,8 @@ auto HandleParseNode(Context& context, Parse::ChoiceDefinitionId node_id) context, node_id, SemIR::CompleteTypeWitness{ .type_id = GetSingletonType(context, SemIR::WitnessType::TypeInstId), - .object_repr_type_inst_id = - context.types().GetInstId(GetStructType(context, fields_id))}); + .object_repr_type_inst_id = context.types().GetTypeInstId( + GetStructType(context, fields_id))}); auto& class_info = context.classes().Get(class_id); class_info.complete_type_witness_id = choice_witness_id; diff --git a/toolchain/check/handle_class.cpp b/toolchain/check/handle_class.cpp index 5ee7022f25c1..06cd8b7241fc 100644 --- a/toolchain/check/handle_class.cpp +++ b/toolchain/check/handle_class.cpp @@ -529,7 +529,7 @@ auto HandleParseNode(Context& context, Parse::BaseDeclId node_id) -> bool { // The `base` value in the class scope has an unbound element type. Instance // binding will be performed when it's found by name lookup into an instance. auto field_type_id = GetUnboundElementType( - context, context.types().GetInstId(class_info.self_type_id), + context, context.types().GetTypeInstId(class_info.self_type_id), base_info.inst_id); class_info.base_id = AddInst(context, node_id, diff --git a/toolchain/check/handle_if_expr.cpp b/toolchain/check/handle_if_expr.cpp index ff9b06b8af4c..6024e01bf4bf 100644 --- a/toolchain/check/handle_if_expr.cpp +++ b/toolchain/check/handle_if_expr.cpp @@ -37,7 +37,8 @@ auto HandleParseNode(Context& context, Parse::IfExprIfId node_id) -> bool { static auto DecayIntLiteralToSizedInt(Context& context, Parse::NodeId node_id, SemIR::InstId operand_id) -> SemIR::InstId { - if (context.types().GetInstId(context.insts().Get(operand_id).type_id()) == + if (context.types().GetTypeInstId( + context.insts().Get(operand_id).type_id()) == SemIR::IntLiteralType::TypeInstId) { operand_id = ConvertToValueOfType( context, node_id, operand_id, diff --git a/toolchain/check/handle_impl.cpp b/toolchain/check/handle_impl.cpp index 21f314dd2fbe..03d45c8e7feb 100644 --- a/toolchain/check/handle_impl.cpp +++ b/toolchain/check/handle_impl.cpp @@ -126,9 +126,10 @@ auto HandleParseNode(Context& context, Parse::ImplDefaultSelfAsId node_id) // duplicating the handling of the `Self` expression. self_inst_id = AddTypeInst( context, node_id, - SemIR::NameRef{.type_id = SemIR::TypeType::TypeId, - .name_id = SemIR::NameId::SelfType, - .value_id = context.types().GetInstId(self_type_id)}); + SemIR::NameRef{ + .type_id = SemIR::TypeType::TypeId, + .name_id = SemIR::NameId::SelfType, + .value_id = context.types().GetTypeInstId(self_type_id)}); } else { CARBON_DIAGNOSTIC(ImplAsOutsideClass, Error, "`impl as` can only be used in a class"); diff --git a/toolchain/check/handle_index.cpp b/toolchain/check/handle_index.cpp index 501764769210..e397456e995a 100644 --- a/toolchain/check/handle_index.cpp +++ b/toolchain/check/handle_index.cpp @@ -33,8 +33,8 @@ auto HandleParseNode(Context& /*context*/, Parse::IndexExprStartId /*node_id*/) static auto PerformIndexWith(Context& context, Parse::NodeId node_id, SemIR::InstId operand_inst_id, SemIR::InstId index_inst_id) -> SemIR::InstId { - SemIR::InstId args[] = { - context.types().GetInstId(context.insts().Get(index_inst_id).type_id())}; + SemIR::InstId args[] = {context.types().GetTypeInstId( + context.insts().Get(index_inst_id).type_id())}; Operator op{.interface_name = CoreIdentifier::IndexWith, .interface_args_ref = args, .op_name = CoreIdentifier::At}; diff --git a/toolchain/check/handle_loop_statement.cpp b/toolchain/check/handle_loop_statement.cpp index 5a16714d0b52..89d6353b99d4 100644 --- a/toolchain/check/handle_loop_statement.cpp +++ b/toolchain/check/handle_loop_statement.cpp @@ -177,7 +177,7 @@ auto HandleParseNode(Context& context, Parse::ForHeaderId node_id) -> bool { auto loop_header_id = StartLoopHeader(context, start_node_id); // Call `.(Iterate.Next)(&cursor)`. - auto cursor_type_inst_id = context.types().GetInstId(cursor_type_id); + auto cursor_type_inst_id = context.types().GetTypeInstId(cursor_type_id); auto cursor_addr_id = AddInst( context, node_id, {.type_id = GetPointerType(context, cursor_type_inst_id), diff --git a/toolchain/check/handle_operator.cpp b/toolchain/check/handle_operator.cpp index 22ba1a1bcbaa..a47b16a484b7 100644 --- a/toolchain/check/handle_operator.cpp +++ b/toolchain/check/handle_operator.cpp @@ -39,7 +39,7 @@ static auto HandleBinaryOperator(Context& context, // the type of the RHS operand. `as` has different rules and we don't call // this function for it. SemIR::InstId args[] = { - context.types().GetInstId(context.insts().Get(rhs_id).type_id())}; + context.types().GetTypeInstId(context.insts().Get(rhs_id).type_id())}; auto result_id = BuildBinaryOperator(context, expr_node_id, {.interface_name = interface_name, .interface_args_ref = args, @@ -277,7 +277,7 @@ auto HandleParseNode(Context& context, Parse::PrefixOperatorAmpId node_id) break; } // TODO: Preserve spelling of type of operand where possible. - auto type_inst_id = context.types().GetInstId(type_id); + auto type_inst_id = context.types().GetTypeInstId(type_id); AddInstAndPush( context, node_id, SemIR::AddrOf{.type_id = GetPointerType(context, type_inst_id), diff --git a/toolchain/check/handle_pattern_list.cpp b/toolchain/check/handle_pattern_list.cpp index e507e004e23d..075ea630f39a 100644 --- a/toolchain/check/handle_pattern_list.cpp +++ b/toolchain/check/handle_pattern_list.cpp @@ -80,7 +80,7 @@ auto HandleParseNode(Context& context, Parse::TuplePatternId node_id) -> bool { for (auto inst : inst_block) { auto type_id = ExtractScrutineeType(context.sem_ir(), context.insts().Get(inst).type_id()); - type_inst_ids.push_back(context.types().GetInstId(type_id)); + type_inst_ids.push_back(context.types().GetTypeInstId(type_id)); } auto type_id = GetPatternType(context, GetTupleType(context, type_inst_ids)); context.node_stack().Push( diff --git a/toolchain/check/handle_struct.cpp b/toolchain/check/handle_struct.cpp index b2d5978a0e3c..92a36119ffdf 100644 --- a/toolchain/check/handle_struct.cpp +++ b/toolchain/check/handle_struct.cpp @@ -54,8 +54,8 @@ auto HandleParseNode(Context& context, Parse::StructLiteralFieldId node_id) auto name_id = context.node_stack().Peek(); // Store the name for the type. - auto value_type_inst_id = - context.types().GetInstId(context.insts().Get(value_inst_id).type_id()); + auto value_type_inst_id = context.types().GetTypeInstId( + context.insts().Get(value_inst_id).type_id()); context.struct_type_fields_stack().AppendToTop( {.name_id = name_id, .type_inst_id = value_type_inst_id}); diff --git a/toolchain/check/handle_tuple_literal.cpp b/toolchain/check/handle_tuple_literal.cpp index a6cde726b0a7..7612e73f746b 100644 --- a/toolchain/check/handle_tuple_literal.cpp +++ b/toolchain/check/handle_tuple_literal.cpp @@ -33,7 +33,7 @@ auto HandleParseNode(Context& context, Parse::TupleLiteralId node_id) -> bool { type_inst_ids.reserve(inst_block.size()); for (auto inst : inst_block) { type_inst_ids.push_back( - context.types().GetInstId(context.insts().Get(inst).type_id())); + context.types().GetTypeInstId(context.insts().Get(inst).type_id())); } auto type_id = GetTupleType(context, type_inst_ids); diff --git a/toolchain/check/handle_where.cpp b/toolchain/check/handle_where.cpp index 071df8c90266..b87227b52c4e 100644 --- a/toolchain/check/handle_where.cpp +++ b/toolchain/check/handle_where.cpp @@ -71,7 +71,7 @@ auto HandleParseNode(Context& context, Parse::WhereOperandId node_id) -> bool { AddInstInNoBlock( context, SemIR::LocId(node_id), {.base_type_inst_id = - context.types().GetInstId(self_with_constraints_type_id)})); + context.types().GetTypeInstId(self_with_constraints_type_id)})); // Add a context stack for tracking rewrite constraints, that will be used to // allow later constraints to read from them eagerly. diff --git a/toolchain/check/import_ref.cpp b/toolchain/check/import_ref.cpp index 549b41e55dc4..126c532b3a4f 100644 --- a/toolchain/check/import_ref.cpp +++ b/toolchain/check/import_ref.cpp @@ -1739,7 +1739,7 @@ static auto TryResolveTypedInst(ImportRefResolver& resolver, static auto TryResolveTypedInst(ImportRefResolver& resolver, SemIR::BoolLiteral inst) -> ResolveResult { - CARBON_CHECK(resolver.import_types().GetInstId(inst.type_id) == + CARBON_CHECK(resolver.import_types().GetTypeInstId(inst.type_id) == SemIR::BoolType::TypeInstId); CARBON_CHECK(!resolver.HasNewWork()); @@ -1752,7 +1752,7 @@ static auto TryResolveTypedInst(ImportRefResolver& resolver, static auto TryResolveTypedInst(ImportRefResolver& resolver, SemIR::BoundMethod inst) -> ResolveResult { - CARBON_CHECK(resolver.import_types().GetInstId(inst.type_id) == + CARBON_CHECK(resolver.import_types().GetTypeInstId(inst.type_id) == SemIR::BoundMethodType::TypeInstId); auto object_id = GetLocalConstantInstId(resolver, inst.object_id); auto function_decl_id = @@ -1789,7 +1789,7 @@ static auto TryResolveTypedInst(ImportRefResolver& resolver, SemIR::Call inst) static auto TryResolveTypedInst(ImportRefResolver& resolver, SemIR::CharLiteralValue inst) -> ResolveResult { - CARBON_CHECK(resolver.import_types().GetInstId(inst.type_id) == + CARBON_CHECK(resolver.import_types().GetTypeInstId(inst.type_id) == SemIR::CharLiteralType::TypeInstId); CARBON_CHECK(!resolver.HasNewWork()); @@ -2020,7 +2020,7 @@ static auto TryResolveTypedInst(ImportRefResolver& resolver, static auto TryResolveTypedInst(ImportRefResolver& resolver, SemIR::CompleteTypeWitness inst) -> ResolveResult { - CARBON_CHECK(resolver.import_types().GetInstId(inst.type_id) == + CARBON_CHECK(resolver.import_types().GetTypeInstId(inst.type_id) == SemIR::WitnessType::TypeInstId); auto object_repr_type_inst_id = GetLocalTypeInstId(resolver, inst.object_repr_type_inst_id); @@ -2075,7 +2075,7 @@ static auto TryResolveTypedInst(ImportRefResolver& resolver, static auto TryResolveTypedInst(ImportRefResolver& resolver, SemIR::CustomWitness inst) -> ResolveResult { - CARBON_CHECK(resolver.import_types().GetInstId(inst.type_id) == + CARBON_CHECK(resolver.import_types().GetTypeInstId(inst.type_id) == SemIR::WitnessType::TypeInstId); auto elements = GetLocalInstBlockContents(resolver, inst.elements_id); @@ -2126,7 +2126,7 @@ static auto TryResolveTypedInst(ImportRefResolver& resolver, static auto TryResolveTypedInst(ImportRefResolver& resolver, SemIR::FloatLiteralValue inst) -> ResolveResult { - CARBON_CHECK(resolver.import_types().GetInstId(inst.type_id) == + CARBON_CHECK(resolver.import_types().GetTypeInstId(inst.type_id) == SemIR::FloatLiteralType::TypeInstId); CARBON_CHECK(!resolver.HasNewWork()); @@ -3167,7 +3167,7 @@ static auto TryResolveTypedInst(ImportRefResolver& resolver, static auto TryResolveTypedInst(ImportRefResolver& resolver, SemIR::LookupImplWitness inst) -> ResolveResult { - CARBON_CHECK(resolver.import_types().GetInstId(inst.type_id) == + CARBON_CHECK(resolver.import_types().GetTypeInstId(inst.type_id) == SemIR::WitnessType::TypeInstId); auto query_self_inst_id = @@ -3196,7 +3196,7 @@ static auto TryResolveTypedInst(ImportRefResolver& resolver, static auto TryResolveTypedInst(ImportRefResolver& resolver, SemIR::ImplWitness inst) -> ResolveResult { - CARBON_CHECK(resolver.import_types().GetInstId(inst.type_id) == + CARBON_CHECK(resolver.import_types().GetTypeInstId(inst.type_id) == SemIR::WitnessType::TypeInstId); auto specific_data = GetLocalSpecificData(resolver, inst.specific_id); @@ -3266,7 +3266,7 @@ static auto TryResolveTypedInst(ImportRefResolver& resolver, SemIR::InitForm{ .type_id = resolver.local_types().GetTypeIdForTypeConstantId(type_const_id), - .type_component_inst_id = resolver.local_types().GetInstId( + .type_component_inst_id = resolver.local_types().GetTypeInstId( resolver.local_types().GetTypeIdForTypeConstantId( type_component_const_id)), .index = inst.index}); @@ -3373,7 +3373,7 @@ static auto TryResolveTypedInst(ImportRefResolver& resolver, static auto TryResolveTypedInst(ImportRefResolver& resolver, SemIR::RequireCompleteType inst) -> ResolveResult { - CARBON_CHECK(resolver.import_types().GetInstId(inst.type_id) == + CARBON_CHECK(resolver.import_types().GetTypeInstId(inst.type_id) == SemIR::WitnessType::TypeInstId); auto complete_type_inst_id = @@ -3391,7 +3391,7 @@ static auto TryResolveTypedInst(ImportRefResolver& resolver, static auto TryResolveTypedInst(ImportRefResolver& resolver, SemIR::RequireSpecificDefinition inst) -> ResolveResult { - CARBON_CHECK(resolver.import_types().GetInstId(inst.type_id) == + CARBON_CHECK(resolver.import_types().GetTypeInstId(inst.type_id) == SemIR::RequireSpecificDefinitionType::TypeInstId); auto specific_data = GetLocalSpecificData(resolver, inst.specific_id); diff --git a/toolchain/check/interface.cpp b/toolchain/check/interface.cpp index 8f5f82472e69..101b36d12161 100644 --- a/toolchain/check/interface.cpp +++ b/toolchain/check/interface.cpp @@ -104,7 +104,7 @@ static auto GetSelfFacetValueForInterfaceMemberSpecific( // Create a facet value to be the value of `Self` in the interface. // TODO: Pass this in instead of creating it here. The caller sometimes // already has a facet value. - auto type_inst_id = context.types().GetInstId(self_type_id); + auto type_inst_id = context.types().GetTypeInstId(self_type_id); auto witnesses_block_id = context.inst_blocks().AddCanonical({self_witness_id}); auto self_value_const_id = TryEvalInst( @@ -226,7 +226,7 @@ auto GetTypeForSpecificAssociatedEntity(Context& context, SemIR::LocId loc_id, context.functions().Get(fn->function_id).generic_id, self_type_id, self_witness_id); return GetFunctionTypeWithSelfType( - context, context.types().GetInstId(interface_fn_type_id), + context, context.types().GetTypeInstId(interface_fn_type_id), self_facet_id); } diff --git a/toolchain/check/member_access.cpp b/toolchain/check/member_access.cpp index 056927931216..e72d556ab5b6 100644 --- a/toolchain/check/member_access.cpp +++ b/toolchain/check/member_access.cpp @@ -566,7 +566,7 @@ static auto PerformActionHelper(Context& context, SemIR::LocId loc_id, // this, as the facet should have member names that directly name members of // the `impl`. auto base_type_as_facet = GetCanonicalFacetOrTypeValue( - context, context.types().GetInstId(base_type_id)); + context, context.types().GetTypeInstId(base_type_id)); auto base_type_facet_type_id = context.insts().Get(base_type_as_facet).type_id(); if (context.types().Is(base_type_facet_type_id)) { @@ -595,7 +595,7 @@ static auto PerformActionHelper(Context& context, SemIR::LocId loc_id, // The base type is not a name scope. Try some fallback options. if (auto struct_type = context.insts().TryGetAs( - context.types().GetInstId(base_type_id))) { + context.types().GetTypeInstId(base_type_id))) { // TODO: Do we need to optimize this with a lookup table for O(1)? for (auto [i, field] : llvm::enumerate( context.struct_type_fields().Get(struct_type->fields_id))) { diff --git a/toolchain/check/name_lookup.cpp b/toolchain/check/name_lookup.cpp index f3f6f3e7c43b..0b189aa01e4e 100644 --- a/toolchain/check/name_lookup.cpp +++ b/toolchain/check/name_lookup.cpp @@ -492,7 +492,7 @@ auto LookupQualifiedName(Context& context, SemIR::LocId loc_id, // The self for member lookup is a type, we need a facet value to // replace `Self`. facet_value = GetConstantFacetValueForType( - context, context.types().GetInstId(self_type_id)); + context, context.types().GetTypeInstId(self_type_id)); } else { // The self for member lookup is a facet value, use it as is to // replace `Self`. diff --git a/toolchain/check/operator.cpp b/toolchain/check/operator.cpp index d2f4a72f1860..a9e695980452 100644 --- a/toolchain/check/operator.cpp +++ b/toolchain/check/operator.cpp @@ -57,7 +57,7 @@ static auto IsCppClassType(Context& context, SemIR::InstId inst_id) -> bool { // Returns whether the instruction is a value of C++ class type. static auto HasCppClassType(Context& context, SemIR::InstId inst_id) -> bool { - return IsCppClassType(context, context.types().GetInstId( + return IsCppClassType(context, context.types().GetTypeInstId( context.insts().Get(inst_id).type_id())); } diff --git a/toolchain/check/pattern_match.cpp b/toolchain/check/pattern_match.cpp index ad46b853cdca..513dcc24fe74 100644 --- a/toolchain/check/pattern_match.cpp +++ b/toolchain/check/pattern_match.cpp @@ -445,7 +445,7 @@ auto MatchContext::DoEmitPatternMatch( auto return_slot_id = AddInst( context, SemIR::LocId(entry.pattern_id), {.type_id = type_id, - .type_inst_id = context.types().GetInstId(type_id), + .type_inst_id = context.types().GetTypeInstId(type_id), .storage_id = entry.scrutinee_id}); bool already_in_lookup = context.scope_stack() diff --git a/toolchain/check/subst.cpp b/toolchain/check/subst.cpp index 00053d9266aa..e3ea7dff01af 100644 --- a/toolchain/check/subst.cpp +++ b/toolchain/check/subst.cpp @@ -163,7 +163,7 @@ static auto ExpandOperands(Context& context, Worklist& worklist, SemIR::InstId inst_id) -> void { auto inst = context.insts().Get(inst_id); if (inst.type_id().has_value()) { - worklist.Push(context.types().GetInstId(inst.type_id())); + worklist.Push(context.types().GetTypeInstId(inst.type_id())); } PushOperand(context, worklist, inst.arg0_and_kind()); PushOperand(context, worklist, inst.arg1_and_kind()); diff --git a/toolchain/check/type.cpp b/toolchain/check/type.cpp index ea505562c6e9..90df07fd8354 100644 --- a/toolchain/check/type.cpp +++ b/toolchain/check/type.cpp @@ -140,17 +140,17 @@ auto GetConstType(Context& context, SemIR::TypeInstId inner_type_id) auto GetQualifiedType(Context& context, SemIR::TypeId type_id, SemIR::TypeQualifiers quals) -> SemIR::TypeId { if (quals.HasAnyOf(SemIR::TypeQualifiers::Const)) { - type_id = GetConstType(context, context.types().GetInstId(type_id)); + type_id = GetConstType(context, context.types().GetTypeInstId(type_id)); quals.Remove(SemIR::TypeQualifiers::Const); } if (quals.HasAnyOf(SemIR::TypeQualifiers::MaybeUnformed)) { type_id = GetTypeImpl( - context, context.types().GetInstId(type_id)); + context, context.types().GetTypeInstId(type_id)); quals.Remove(SemIR::TypeQualifiers::MaybeUnformed); } if (quals.HasAnyOf(SemIR::TypeQualifiers::Partial)) { type_id = GetTypeImpl( - context, context.types().GetInstId(type_id)); + context, context.types().GetTypeInstId(type_id)); quals.Remove(SemIR::TypeQualifiers::Partial); } CARBON_CHECK(quals == SemIR::TypeQualifiers::None); @@ -258,7 +258,7 @@ auto GetPatternType(Context& context, SemIR::TypeId scrutinee_type_id) return SemIR::ErrorInst::TypeId; } return GetTypeImpl( - context, context.types().GetInstId(scrutinee_type_id)); + context, context.types().GetTypeInstId(scrutinee_type_id)); } auto GetUnboundElementType(Context& context, SemIR::TypeInstId class_type_id, diff --git a/toolchain/check/type_completion.cpp b/toolchain/check/type_completion.cpp index 2693034b6798..0e772dcbb368 100644 --- a/toolchain/check/type_completion.cpp +++ b/toolchain/check/type_completion.cpp @@ -328,7 +328,7 @@ auto TypeCompleter::ProcessStep() -> bool { return true; } - auto inst_id = context_->types().GetInstId(type_id); + auto inst_id = context_->types().GetTypeInstId(type_id); auto inst = context_->insts().Get(inst_id); auto old_work_list_size = work_list_.size(); @@ -484,8 +484,8 @@ auto TypeCompleter::MakePointerValueRepr( // TODO: Should we add `const` qualification to `pointee_id`? return {.kind = SemIR::ValueRepr::Pointer, .aggregate_kind = aggregate_kind, - .type_id = GetPointerType(*context_, - context_->types().GetInstId(pointee_id))}; + .type_id = GetPointerType( + *context_, context_->types().GetTypeInstId(pointee_id))}; } auto TypeCompleter::GetNestedInfo(SemIR::TypeId nested_type_id) const @@ -541,7 +541,7 @@ auto TypeCompleter::BuildInfoForInst(SemIR::TypeId type_id, field_type_id)) { same_as_object_rep = false; field.type_inst_id = - context_->types().GetInstId(field_info.value_repr.type_id); + context_->types().GetTypeInstId(field_info.value_repr.type_id); } value_rep_fields.push_back(field); // Take the first non-None abstract_class_id, if any. @@ -584,7 +584,7 @@ auto TypeCompleter::BuildInfoForInst(SemIR::TypeId type_id, same_as_object_rep = false; } value_rep_elements.push_back( - context_->types().GetInstId(element_info.value_repr.type_id)); + context_->types().GetTypeInstId(element_info.value_repr.type_id)); // Take the first non-None abstract_class_id, if any. if (element_info.abstract_class_id.has_value() && !abstract_class_id.has_value()) { @@ -739,7 +739,7 @@ auto RequireCompleteType(Context& context, SemIR::TypeId type_id, SemIR::RequireCompleteType{ .type_id = GetSingletonType(context, SemIR::WitnessType::TypeInstId), - .complete_type_inst_id = context.types().GetInstId(type_id)}); + .complete_type_inst_id = context.types().GetTypeInstId(type_id)}); } return true; diff --git a/toolchain/lower/file_context.cpp b/toolchain/lower/file_context.cpp index f6ace4be4f45..44631f7bfc57 100644 --- a/toolchain/lower/file_context.cpp +++ b/toolchain/lower/file_context.cpp @@ -75,7 +75,7 @@ auto FileContext::PrepareToLower() -> void { // Lower all types that were required to be complete. for (auto type_id : sem_ir_->types().complete_types()) { if (type_id.index >= 0) { - types_.Set(type_id, BuildType(sem_ir_->types().GetInstId(type_id))); + types_.Set(type_id, BuildType(sem_ir_->types().GetTypeInstId(type_id))); } } diff --git a/toolchain/lower/handle.cpp b/toolchain/lower/handle.cpp index fbced2f83a22..6b15ecd6db66 100644 --- a/toolchain/lower/handle.cpp +++ b/toolchain/lower/handle.cpp @@ -26,7 +26,7 @@ static auto IsNamespace(FunctionContext& context, SemIR::InstId inst_id) // Note, we don't use context.GetTypeOfInst here. An instruction can't change // from being a non-namespace in a generic to being a namespace in a specific, // because namespace names are not first-class. - auto type_inst_id = context.sem_ir().types().GetInstId( + auto type_inst_id = context.sem_ir().types().GetTypeInstId( context.sem_ir().insts().Get(inst_id).type_id()); return type_inst_id == SemIR::NamespaceType::TypeInstId; } @@ -46,7 +46,7 @@ auto HandleInst(FunctionContext& context, SemIR::InstId inst_id, // create a ConstantInt from its SemIR value directly. llvm::Value* index; auto index_type = context.GetTypeIdOfInst(inst.index_id); - if (index_type.file->types().GetInstId(index_type.type_id) == + if (index_type.file->types().GetTypeInstId(index_type.type_id) == SemIR::IntLiteralType::TypeInstId) { auto value = context.sem_ir().insts().GetAs( context.sem_ir().constant_values().GetConstantInstId(inst.index_id)); diff --git a/toolchain/sem_ir/builtin_function_kind.cpp b/toolchain/sem_ir/builtin_function_kind.cpp index e3ca80ccc143..9235811ce22d 100644 --- a/toolchain/sem_ir/builtin_function_kind.cpp +++ b/toolchain/sem_ir/builtin_function_kind.cpp @@ -76,7 +76,7 @@ template struct BuiltinType { static auto CheckType(const File& sem_ir, ValidateState& /*state*/, TypeId type_id) -> bool { - return sem_ir.types().GetInstId(type_id) == BuiltinId; + return sem_ir.types().GetTypeInstId(type_id) == BuiltinId; } }; @@ -199,7 +199,7 @@ struct AnyType { struct CoreStringType { static auto CheckType(const File& sem_ir, ValidateState& /*state*/, TypeId type_id) -> bool { - auto type_inst_id = sem_ir.types().GetInstId(type_id); + auto type_inst_id = sem_ir.types().GetTypeInstId(type_id); auto class_type = sem_ir.insts().TryGetAs(type_inst_id); if (!class_type) { return false; @@ -214,7 +214,7 @@ struct CoreStringType { struct CoreCharType { static auto CheckType(const File& sem_ir, ValidateState& /*state*/, TypeId type_id) -> bool { - auto type_inst_id = sem_ir.types().GetInstId(type_id); + auto type_inst_id = sem_ir.types().GetTypeInstId(type_id); auto class_type = sem_ir.insts().TryGetAs(type_inst_id); if (!class_type) { return false; diff --git a/toolchain/sem_ir/dump.cpp b/toolchain/sem_ir/dump.cpp index 63e422dd498a..ff8e3f13a6eb 100644 --- a/toolchain/sem_ir/dump.cpp +++ b/toolchain/sem_ir/dump.cpp @@ -462,7 +462,7 @@ LLVM_DUMP_METHOD auto Dump(const File& file, TypeId type_id) -> std::string { return out.TakeStr(); } - InstId inst_id = file.types().GetInstId(type_id); + InstId inst_id = file.types().GetTypeInstId(type_id); out << ": " << StringifyConstantInst(file, inst_id) << "; " << file.insts().Get(inst_id); auto const_id = file.types().GetConstantId(type_id); diff --git a/toolchain/sem_ir/inst_fingerprinter.cpp b/toolchain/sem_ir/inst_fingerprinter.cpp index b8b9631310a7..f81d769a12ac 100644 --- a/toolchain/sem_ir/inst_fingerprinter.cpp +++ b/toolchain/sem_ir/inst_fingerprinter.cpp @@ -152,7 +152,7 @@ struct Worklist { AddInvalid(); return; } - Add(sem_ir->types().GetInstId(type_id)); + Add(sem_ir->types().GetTypeInstId(type_id)); } template diff --git a/toolchain/sem_ir/stringify.cpp b/toolchain/sem_ir/stringify.cpp index 70a9d8b95c47..6f950462add4 100644 --- a/toolchain/sem_ir/stringify.cpp +++ b/toolchain/sem_ir/stringify.cpp @@ -110,7 +110,7 @@ class StepStack { // Pushes an instruction by its TypeId. auto PushTypeId(TypeId type_id) -> void { - PushInstId(sem_ir_->types().GetInstId(type_id)); + PushInstId(sem_ir_->types().GetTypeInstId(type_id)); } // Pushes a specific interface by the interface's entity name. diff --git a/toolchain/sem_ir/type.cpp b/toolchain/sem_ir/type.cpp index 781a23d32977..604f85d7e21e 100644 --- a/toolchain/sem_ir/type.cpp +++ b/toolchain/sem_ir/type.cpp @@ -63,14 +63,14 @@ auto TypeStore::GetAsTypeInstId(InstId inst_id) const -> TypeInstId { return TypeInstId::UnsafeMake(inst_id); } -auto TypeStore::GetInstId(TypeId type_id) const -> TypeInstId { +auto TypeStore::GetTypeInstId(TypeId type_id) const -> TypeInstId { // The instruction for a TypeId has a value of that TypeId. return TypeInstId::UnsafeMake( file_->constant_values().GetInstId(GetConstantId(type_id))); } auto TypeStore::GetAsInst(TypeId type_id) const -> Inst { - return file_->insts().Get(GetInstId(type_id)); + return file_->insts().Get(GetTypeInstId(type_id)); } auto TypeStore::GetUnattachedType(TypeId type_id) const -> TypeId { @@ -157,7 +157,7 @@ auto TypeStore::TryGetIntTypeInfo(TypeId int_type_id) const if (!object_repr_id.has_value()) { return std::nullopt; } - auto inst_id = file_->types().GetInstId(object_repr_id); + auto inst_id = file_->types().GetTypeInstId(object_repr_id); if (inst_id == IntLiteralType::TypeInstId) { // `Core.IntLiteral` has an unknown bit-width. return TypeStore::IntTypeInfo{.is_signed = true, .bit_width = IntId::None}; diff --git a/toolchain/sem_ir/type.h b/toolchain/sem_ir/type.h index ff96cda238a3..be241143a540 100644 --- a/toolchain/sem_ir/type.h +++ b/toolchain/sem_ir/type.h @@ -83,7 +83,7 @@ class TypeStore : public Yaml::Printable { auto GetAsTypeInstId(InstId inst_id) const -> TypeInstId; // Returns the ID of the instruction used to define the specified type. - auto GetInstId(TypeId type_id) const -> TypeInstId; + auto GetTypeInstId(TypeId type_id) const -> TypeInstId; // Returns the instruction used to define the specified type. auto GetAsInst(TypeId type_id) const -> Inst; @@ -141,7 +141,7 @@ class TypeStore : public Yaml::Printable { // case where they might be in different generics and thus might have // different ConstantIds, but are still symbolically equal. auto AreEqualAcrossDeclarations(TypeId a, TypeId b) const -> bool { - return GetInstId(a) == GetInstId(b); + return GetTypeInstId(a) == GetTypeInstId(b); } // Gets the value representation to use for a type. This returns an diff --git a/toolchain/sem_ir/type_iterator.cpp b/toolchain/sem_ir/type_iterator.cpp index a108b20d710e..388b761852cb 100644 --- a/toolchain/sem_ir/type_iterator.cpp +++ b/toolchain/sem_ir/type_iterator.cpp @@ -58,7 +58,7 @@ auto TypeIterator::Next() -> Step { } auto TypeIterator::ProcessTypeId(TypeId type_id) -> std::optional { - auto inst_id = sem_ir_->types().GetInstId(type_id); + auto inst_id = sem_ir_->types().GetTypeInstId(type_id); auto inst = sem_ir_->insts().Get(inst_id); CARBON_KIND_SWITCH(inst) { // ==== Symbolic types ====