From 1ffd56ac3ef5706ff4ec0df16405399162947523 Mon Sep 17 00:00:00 2001 From: Jon Ross-Perkins Date: Mon, 7 Apr 2025 15:41:27 -0700 Subject: [PATCH] Use Get*Type in a couple spots (#5257) These seemed like spots that didn't need to call `TryEvalInst` directly. I'm relying on tests for coverage. :) --- toolchain/check/handle_choice.cpp | 7 ++----- toolchain/check/handle_class.cpp | 6 +----- toolchain/check/handle_interface.cpp | 6 ++---- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/toolchain/check/handle_choice.cpp b/toolchain/check/handle_choice.cpp index abde191eec56..ba6694a8b41d 100644 --- a/toolchain/check/handle_choice.cpp +++ b/toolchain/check/handle_choice.cpp @@ -104,11 +104,8 @@ auto HandleParseNode(Context& context, Parse::ChoiceDefinitionStartId node_id) // `Class` in the ValueStore. SemIR::Class& mut_class = context.classes().Get(class_decl.class_id); // Build the `Self` type using the resulting type constant. - auto self_type_id = context.types().GetTypeIdForTypeConstantId( - TryEvalInst(context, SemIR::InstId::None, - SemIR::ClassType{.type_id = SemIR::TypeType::SingletonTypeId, - .class_id = class_decl.class_id, - .specific_id = self_specific_id})); + auto self_type_id = + GetClassType(context, class_decl.class_id, self_specific_id); mut_class.self_type_id = self_type_id; // Enter the choice scope. diff --git a/toolchain/check/handle_class.cpp b/toolchain/check/handle_class.cpp index ac80c715f581..aa5050ed1315 100644 --- a/toolchain/check/handle_class.cpp +++ b/toolchain/check/handle_class.cpp @@ -267,11 +267,7 @@ static auto BuildClassDecl(Context& context, Parse::AnyClassDeclId node_id, auto specific_id = context.generics().GetSelfSpecific(class_info.generic_id); class_info.self_type_id = - context.types().GetTypeIdForTypeConstantId(TryEvalInst( - context, SemIR::InstId::None, - SemIR::ClassType{.type_id = SemIR::TypeType::SingletonTypeId, - .class_id = class_decl.class_id, - .specific_id = specific_id})); + GetClassType(context, class_decl.class_id, specific_id); } if (!is_definition && context.sem_ir().is_impl() && !is_extern) { diff --git a/toolchain/check/handle_interface.cpp b/toolchain/check/handle_interface.cpp index c132bc6c9287..e281dfb60fb4 100644 --- a/toolchain/check/handle_interface.cpp +++ b/toolchain/check/handle_interface.cpp @@ -171,10 +171,8 @@ auto HandleParseNode(Context& context, context.args_type_info_stack().Push(); // Declare and introduce `Self`. - SemIR::FacetType facet_type = - FacetTypeFromInterface(context, interface_id, self_specific_id); - SemIR::TypeId self_type_id = context.types().GetTypeIdForTypeConstantId( - TryEvalInst(context, SemIR::InstId::None, facet_type)); + SemIR::TypeId self_type_id = + GetInterfaceType(context, interface_id, self_specific_id); // We model `Self` as a symbolic binding whose type is the interface. // Because there is no equivalent non-symbolic value, we use `None` as