diff --git a/toolchain/check/context.h b/toolchain/check/context.h index a7f82766d22a..9c121d169824 100644 --- a/toolchain/check/context.h +++ b/toolchain/check/context.h @@ -260,9 +260,9 @@ class Context { // TODO: Consider creating an AnyForm inst category to refer to those insts. SemIR::InstId form_inst_id; // The inst ID of the form expression's type component. - SemIR::TypeInstId type_component_id; + SemIR::TypeInstId type_component_inst_id; // The type ID corresponding to type_component_id. - SemIR::TypeId type_id; + SemIR::TypeId type_component_id; }; // Pushes form_expr onto the stack of return form declarations for in-progress diff --git a/toolchain/check/convert.cpp b/toolchain/check/convert.cpp index 1e83792f56ab..4aff68de354f 100644 --- a/toolchain/check/convert.cpp +++ b/toolchain/check/convert.cpp @@ -2032,8 +2032,8 @@ auto ExprAsReturnForm(Context& context, SemIR::LocId loc_id, SemIR::InstId value_id) -> Context::FormExpr { constexpr Context::FormExpr ErrorFormExpr = { .form_inst_id = SemIR::ErrorInst::InstId, - .type_component_id = SemIR::ErrorInst::TypeInstId, - .type_id = SemIR::ErrorInst::TypeId}; + .type_component_inst_id = SemIR::ErrorInst::TypeInstId, + .type_component_id = SemIR::ErrorInst::TypeId}; auto form_inst_id = SemIR::InstId::None; auto type_inst_id = SemIR::InstId::None; if (auto ref_tag = context.insts().TryGetAs(value_id)) { @@ -2078,9 +2078,11 @@ auto ExprAsReturnForm(Context& context, SemIR::LocId loc_id, auto type_const_id = context.constant_values().Get(type_inst_id); CARBON_CHECK(type_const_id.is_constant()); - return {.form_inst_id = form_inst_id, - .type_component_id = context.types().GetAsTypeInstId(type_inst_id), - .type_id = context.types().GetTypeIdForTypeConstantId(type_const_id)}; + return { + .form_inst_id = form_inst_id, + .type_component_inst_id = context.types().GetAsTypeInstId(type_inst_id), + .type_component_id = + context.types().GetTypeIdForTypeConstantId(type_const_id)}; } auto DiscardExpr(Context& context, SemIR::InstId expr_id) -> void { diff --git a/toolchain/check/cpp/import.cpp b/toolchain/check/cpp/import.cpp index 2c8590bfca68..0ade0a840073 100644 --- a/toolchain/check/cpp/import.cpp +++ b/toolchain/check/cpp/import.cpp @@ -1249,14 +1249,14 @@ static auto GetReturnTypeExpr(Context& context, SemIR::LocId loc_id, context.TODO(loc_id, llvm::formatv("Unsupported: return type: {0}", orig_ret_type.getAsString())); return {.form_inst_id = SemIR::ErrorInst::InstId, - .type_component_id = SemIR::ErrorInst::TypeInstId, - .type_id = SemIR::ErrorInst::TypeId}; + .type_component_inst_id = SemIR::ErrorInst::TypeInstId, + .type_component_id = SemIR::ErrorInst::TypeId}; } Context::FormExpr result = { .form_inst_id = is_reference ? make_ref_form(orig_type_inst_id) : make_init_form(orig_type_inst_id), - .type_component_id = orig_type_inst_id, - .type_id = type_id}; + .type_component_inst_id = orig_type_inst_id, + .type_component_id = type_id}; return result; } @@ -1265,17 +1265,17 @@ static auto GetReturnTypeExpr(Context& context, SemIR::LocId loc_id, if (!ctor) { // void. return {.form_inst_id = SemIR::InstId::None, - .type_component_id = SemIR::TypeInstId::None, - .type_id = SemIR::TypeId::None}; + .type_component_inst_id = SemIR::TypeInstId::None, + .type_component_id = SemIR::TypeId::None}; } // TODO: Make this a `PartialType`. SemIR::TypeInstId record_type_inst_id = context.types().GetAsTypeInstId( LookupClangDeclInstId(context, SemIR::ClangDeclKey(ctor->getParent()))); - return { - .form_inst_id = make_init_form(record_type_inst_id), - .type_component_id = record_type_inst_id, - .type_id = context.types().GetTypeIdForTypeInstId(record_type_inst_id)}; + return {.form_inst_id = make_init_form(record_type_inst_id), + .type_component_inst_id = record_type_inst_id, + .type_component_id = + context.types().GetTypeIdForTypeInstId(record_type_inst_id)}; } // Information about a function's declared return type, corresponding to the diff --git a/toolchain/check/function.cpp b/toolchain/check/function.cpp index 1cfcbe94548e..3cb7e95b58f3 100644 --- a/toolchain/check/function.cpp +++ b/toolchain/check/function.cpp @@ -41,11 +41,12 @@ auto AddReturnPatterns(Context& context, SemIR::LocId loc_id, break; } case CARBON_KIND(SemIR::InitForm init_form): { - auto pattern_type_id = GetPatternType(context, form_expr.type_id); + auto pattern_type_id = + GetPatternType(context, form_expr.type_component_id); auto return_slot_pattern_id = AddPatternInst( context, loc_id, {.type_id = pattern_type_id, - .type_inst_id = form_expr.type_component_id}); + .type_inst_id = form_expr.type_component_inst_id}); return_patterns.push_back(AddPatternInst( context, SemIR::LocId(form_expr.form_inst_id), {.type_id = pattern_type_id, @@ -136,9 +137,10 @@ auto MakeBuiltinFunction(Context& context, SemIR::LocId loc_id, // Build and add the return type. We always use an initializing form for now. auto return_patterns_id = SemIR::InstBlockId::None; - Context::FormExpr return_form = {.form_inst_id = SemIR::InstId::None, - .type_component_id = SemIR::TypeInstId::None, - .type_id = SemIR::TypeId::None}; + Context::FormExpr return_form = { + .form_inst_id = SemIR::InstId::None, + .type_component_inst_id = SemIR::TypeInstId::None, + .type_component_id = SemIR::TypeId::None}; if (signature.return_type_id.has_value()) { return_form = ExprAsReturnForm( context, loc_id, @@ -177,7 +179,7 @@ auto MakeBuiltinFunction(Context& context, SemIR::LocId loc_id, { .call_param_patterns_id = call_param_patterns_id, .call_params_id = call_params_id, - .return_type_inst_id = return_form.type_component_id, + .return_type_inst_id = return_form.type_component_inst_id, .return_form_inst_id = return_form.form_inst_id, .return_patterns_id = return_patterns_id, .self_param_id = self_param_id, diff --git a/toolchain/check/handle_function.cpp b/toolchain/check/handle_function.cpp index c95d58d95dea..bef73c740e4d 100644 --- a/toolchain/check/handle_function.cpp +++ b/toolchain/check/handle_function.cpp @@ -411,7 +411,7 @@ static auto BuildFunctionDecl(Context& context, maybe_return_patterns_id) { return_patterns_id = *maybe_return_patterns_id; auto return_form = context.PopReturnForm(); - return_type_inst_id = return_form.type_component_id; + return_type_inst_id = return_form.type_component_inst_id; return_form_inst_id = return_form.form_inst_id; }