mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 09:14:42 +01:00
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. :)
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user