From d431e1fbf42b182a502c1bd71e2d56546e5d24e6 Mon Sep 17 00:00:00 2001 From: josh11b <15258583+josh11b@users.noreply.github.com> Date: Wed, 19 Mar 2025 21:25:35 -0700 Subject: [PATCH] Never perform instance binding with implicit `Self` in an interface (#5121) Resolves TODO by creating new function `GetAssociatedValue` with the logic from `PerformCompoundMemberAccess` restricted to the non-instance-binding case. --------- Co-authored-by: Josh L --- toolchain/check/member_access.cpp | 110 ++-- toolchain/check/member_access.h | 8 + toolchain/check/name_lookup.cpp | 13 +- .../testdata/facet/no_prelude/access.carbon | 520 ++++++++++++++++++ .../no_prelude/fail_assoc_const_alias.carbon | 158 ++++-- 5 files changed, 728 insertions(+), 81 deletions(-) diff --git a/toolchain/check/member_access.cpp b/toolchain/check/member_access.cpp index b17da2a4bdc0..a2cd7e5c5ab3 100644 --- a/toolchain/check/member_access.cpp +++ b/toolchain/check/member_access.cpp @@ -564,6 +564,73 @@ auto PerformAction(Context& context, SemIR::LocId loc_id, return member_id; } +// Logic shared by GetAssociatedValue() and PerformCompoundMemberAccess(). +static auto GetAssociatedValueImpl(Context& context, SemIR::LocId loc_id, + SemIR::InstId base_id, + const SemIR::AssociatedEntity& assoc_entity, + SemIR::TypeId interface_type_id, + SemIR::SpecificId interface_specific_id) + -> SemIR::InstId { + // Convert to the interface type of the associated member, to get a facet + // value. + auto facet_inst_id = + ConvertToValueOfType(context, loc_id, base_id, interface_type_id); + if (facet_inst_id == SemIR::ErrorInst::SingletonInstId) { + return SemIR::ErrorInst::SingletonInstId; + } + // That facet value has both the self type we need below and the witness + // we are going to use to look up the value of the associated member. + auto self_type_const_id = TryEvalInst( + context, SemIR::InstId::None, + SemIR::FacetAccessType{.type_id = SemIR::TypeType::SingletonTypeId, + .facet_value_inst_id = facet_inst_id}); + auto self_type_id = + context.types().GetTypeIdForTypeConstantId(self_type_const_id); + auto witness_id = + GetOrAddInst(context, loc_id, + SemIR::FacetAccessWitness{ + .type_id = GetSingletonType( + context, SemIR::WitnessType::SingletonInstId), + .facet_value_inst_id = facet_inst_id, + // There's only one interface in this facet type. + .index = SemIR::ElementIndex(0)}); + // Before we can access the element of the witness, we need to figure out + // the type of that element. It depends on the self type and the specific + // interface. + auto assoc_type_id = GetTypeForSpecificAssociatedEntity( + context, loc_id, interface_specific_id, assoc_entity.decl_id, + self_type_id, witness_id); + // Now that we have the witness, an index into it, and the type of the + // result, return the element of the witness. + return GetOrAddInst(context, loc_id, + {.type_id = assoc_type_id, + .witness_id = witness_id, + .index = assoc_entity.index}); +} + +auto GetAssociatedValue(Context& context, SemIR::LocId loc_id, + SemIR::InstId base_id, + SemIR::InstId assoc_entity_inst_id, + SemIR::TypeId interface_type_id) -> SemIR::InstId { + // TODO: This function shares a code with PerformCompoundMemberAccess(), + // it would be nice to reduce the duplication. + + auto interface_type = GetInterfaceFromFacetType(context, interface_type_id); + // An associated entity is always associated with a single interface. + CARBON_CHECK(interface_type); + + auto value_inst_id = + context.constant_values().GetConstantInstId(assoc_entity_inst_id); + CARBON_CHECK(value_inst_id.has_value()); + auto assoc_entity = + context.insts().GetAs(value_inst_id); + auto decl_id = assoc_entity.decl_id; + LoadImportRef(context, decl_id); + + return GetAssociatedValueImpl(context, loc_id, base_id, assoc_entity, + interface_type_id, interface_type->specific_id); +} + auto PerformCompoundMemberAccess(Context& context, SemIR::LocId loc_id, SemIR::InstId base_id, SemIR::InstId member_expr_id, @@ -610,43 +677,12 @@ auto PerformCompoundMemberAccess(Context& context, SemIR::LocId loc_id, member_id, missing_impl_diagnoser); // Next we will perform instance binding. } else { - // Step 2b: For non-instance methods and associated constants, we convert - // to the interface type of the associated member, to get a facet value. - auto facet_inst_id = - ConvertToValueOfType(context, loc_id, base_id, interface_type_id); - if (facet_inst_id == SemIR::ErrorInst::SingletonInstId) { - return SemIR::ErrorInst::SingletonInstId; - } - // That facet value has both the self type we need below and the witness - // we are going to use to look up the value of the associated member. - auto self_type_const_id = TryEvalInst( - context, SemIR::InstId::None, - SemIR::FacetAccessType{.type_id = SemIR::TypeType::SingletonTypeId, - .facet_value_inst_id = facet_inst_id}); - auto self_type_id = - context.types().GetTypeIdForTypeConstantId(self_type_const_id); - auto witness_id = - GetOrAddInst(context, loc_id, - SemIR::FacetAccessWitness{ - .type_id = GetSingletonType( - context, SemIR::WitnessType::SingletonInstId), - .facet_value_inst_id = facet_inst_id, - // There's only one interface in this facet type. - .index = SemIR::ElementIndex(0)}); - // Before we can access the element of the witness, we need to figure out - // the type of that element. It depends on the self type and the specific - // interface. - auto assoc_type_id = GetTypeForSpecificAssociatedEntity( - context, loc_id, interface_type->specific_id, decl_id, self_type_id, - witness_id); - // Now that we have the witness, an index into it, and the type of the - // result, return the element of the witness. No instance binding to do, - // so return instead of continuing. - return GetOrAddInst( - context, loc_id, - {.type_id = assoc_type_id, - .witness_id = witness_id, - .index = assoc_entity.index}); + // Step 2b: For non-instance methods and associated constants, we access + // the value of the associated constant, and don't do any instance + // binding. + return GetAssociatedValueImpl(context, loc_id, base_id, assoc_entity, + interface_type_id, + interface_type->specific_id); } } else if (context.insts().Is( context.constant_values().GetInstId(base_type_const_id))) { diff --git a/toolchain/check/member_access.h b/toolchain/check/member_access.h index 7ab9a73d1346..8fda71d8ea28 100644 --- a/toolchain/check/member_access.h +++ b/toolchain/check/member_access.h @@ -25,6 +25,14 @@ auto PerformCompoundMemberAccess( SemIR::InstId member_expr_id, MakeDiagnosticBuilderFn missing_impl_diagnoser = nullptr) -> SemIR::InstId; +// Finds the value of an associated entity (given by assoc_entity_inst_id, a +// member of the interface given by interface_type_id) associated with a type or +// facet (given by base_id). Never does instance binding. +auto GetAssociatedValue(Context& context, SemIR::LocId loc_id, + SemIR::InstId base_id, + SemIR::InstId assoc_entity_inst_id, + SemIR::TypeId interface_type_id) -> SemIR::InstId; + // Creates SemIR to perform a tuple index with base expression `tuple_inst_id` // and index expression `index_inst_id`. Returns the result of the access. auto PerformTupleAccess(Context& context, SemIR::LocId loc_id, diff --git a/toolchain/check/name_lookup.cpp b/toolchain/check/name_lookup.cpp index 0122add48857..839c51d035b9 100644 --- a/toolchain/check/name_lookup.cpp +++ b/toolchain/check/name_lookup.cpp @@ -108,17 +108,16 @@ auto LookupUnqualifiedName(Context& context, Parse::NodeId node_id, if (scope.is_interface_definition()) { SemIR::InstId target_inst_id = non_lexical_result.scope_result.target_inst_id(); - if (context.types().Is( - context.insts().Get(target_inst_id).type_id())) { + if (auto assoc_type = + context.types().TryGetAs( + context.insts().Get(target_inst_id).type_id())) { auto interface_decl = context.insts().GetAs(scope.inst_id()); const auto& interface = context.interfaces().Get(interface_decl.interface_id); - // TODO: Refactor the code so that we can call the "no instance - // binding" case from `PerformCompoundMemberAccess` as a separate - // function (`GetAssociatedValue`). - SemIR::InstId result_inst_id = PerformCompoundMemberAccess( - context, node_id, interface.self_param_id, target_inst_id); + SemIR::InstId result_inst_id = + GetAssociatedValue(context, node_id, interface.self_param_id, + target_inst_id, assoc_type->interface_type_id); non_lexical_result.scope_result = SemIR::ScopeLookupResult::MakeFound( result_inst_id, non_lexical_result.scope_result.access_kind()); } diff --git a/toolchain/check/testdata/facet/no_prelude/access.carbon b/toolchain/check/testdata/facet/no_prelude/access.carbon index 0c00883fe0f6..f99ec4648949 100644 --- a/toolchain/check/testdata/facet/no_prelude/access.carbon +++ b/toolchain/check/testdata/facet/no_prelude/access.carbon @@ -8,6 +8,14 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/facet/no_prelude/access.carbon +// --- core.carbon +package Core; +// TODO: switch to min_prelude + +interface ImplicitAs(Dest:! type) { + fn Convert[self: Self]() -> Dest; +} + // --- access_assoc_fn.carbon library "[[@TEST_NAME]]"; @@ -82,6 +90,164 @@ impl () as I where .T = () {} // CHECK:STDERR: var v: ().(Id(I.T)); +// --- fail_non_const_associated_in_interface.carbon +library "[[@TEST_NAME]]"; + +fn Id[U:! type](x: U) -> U { return x; } + +interface J { + let T:! type; + // CHECK:STDERR: fail_non_const_associated_in_interface.carbon:[[@LINE+4]]:13: error: cannot evaluate type expression [TypeExprEvaluationFailure] + // CHECK:STDERR: fn F() -> Id(T); + // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: + fn F() -> Id(T); +} + +// --- fail_alias_to_non_const_assoc_entity.carbon +library "[[@TEST_NAME]]"; + +import Core; + +interface I { + let T:! type; +} + +// CHECK:STDERR: fail_alias_to_non_const_assoc_entity.carbon:[[@LINE+4]]:8: error: semantics TODO: `HandleAutoTypeLiteral` [SemanticsTodo] +// CHECK:STDERR: let x: auto = I.T; +// CHECK:STDERR: ^~~~ +// CHECK:STDERR: +let x: auto = I.T; + +interface J { + // Is this valid? + alias U = x; + // type of U is an assoc entity type, but value is not constant. + fn F() -> U; +} + +// --- to_import.carbon +library "[[@TEST_NAME]]"; + +interface I { + let T:! type; +} + +alias U = I.T; + +// --- fail_access_alias_in_imported_library.carbon +library "[[@TEST_NAME]]"; + +import Core; +import library "to_import"; + +interface J { + // extend I; + alias V = U; + // CHECK:STDERR: fail_access_alias_in_imported_library.carbon:[[@LINE+7]]:13: error: cannot implicitly convert type `Self` that implements `J` into type implementing `I` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fn F() -> V; + // CHECK:STDERR: ^ + // CHECK:STDERR: fail_access_alias_in_imported_library.carbon:[[@LINE+4]]:13: note: type `J` does not implement interface `Core.ImplicitAs(I)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fn F() -> V; + // CHECK:STDERR: ^ + // CHECK:STDERR: + fn F() -> V; +} + +// CHECK:STDOUT: --- core.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.96f: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.96f = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.07f: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic] +// CHECK:STDOUT: %Self: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic] +// CHECK:STDOUT: %Convert: %Convert.type = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type %ImplicitAs.type.07f [symbolic] +// CHECK:STDOUT: %assoc0: %ImplicitAs.assoc_type = assoc_entity element0, @ImplicitAs.%Convert.decl [symbolic] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { +// CHECK:STDOUT: %Dest.patt.loc4_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc4_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc4_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc4_22.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc4_22.1: type) { +// CHECK:STDOUT: %Dest.loc4_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc4_22.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc4_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc4_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc4_22.2)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.07f)] +// CHECK:STDOUT: %Self.2: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest.loc4_22.2) [symbolic = %Convert.type (constants.%Convert.type)] +// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type) = struct_value () [symbolic = %Convert (constants.%Convert)] +// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type)] +// CHECK:STDOUT: %assoc0.loc5_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc5_35.2 (constants.%assoc0)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] +// CHECK:STDOUT: %Convert.decl: @ImplicitAs.%Convert.type (%Convert.type) = fn_decl @Convert [symbolic = @ImplicitAs.%Convert (constants.%Convert)] { +// CHECK:STDOUT: %self.patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = value_param_pattern %self.patt, call_param0 +// CHECK:STDOUT: %return.patt: @Convert.%Dest (%Dest) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Convert.%Dest (%Dest) = out_param_pattern %return.patt, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc4_22.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = value_param call_param0 +// CHECK:STDOUT: %.loc5_20.1: type = splice_block %.loc5_20.3 [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %.loc5_20.2: @Convert.%ImplicitAs.type (%ImplicitAs.type.07f) = specific_constant @ImplicitAs.%Self.1, @ImplicitAs(constants.%Dest) [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.ref: @Convert.%ImplicitAs.type (%ImplicitAs.type.07f) = name_ref Self, %.loc5_20.2 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc5_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc5_20.3: type = converted %Self.ref, %Self.as_type.loc5_20.2 [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc5_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc5_35.2 (constants.%assoc0)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc5_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert(@ImplicitAs.%Dest.loc4_22.1: type, @ImplicitAs.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f)) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.07f)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc5_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type)]() -> @Convert.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc4_22.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc4_22.2 => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.07f +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type.loc5_20.1 => constants.%Self.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(%Dest.loc4_22.2) {} +// CHECK:STDOUT: // CHECK:STDOUT: --- access_assoc_fn.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -797,3 +963,357 @@ var v: ().(Id(I.T)); // CHECK:STDOUT: %require_complete => constants.%complete_type // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: --- fail_non_const_associated_in_interface.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %U: type = bind_symbolic_name U, 0 [symbolic] +// CHECK:STDOUT: %U.patt: type = symbolic_binding_pattern U, 0 [symbolic] +// CHECK:STDOUT: %Id.type: type = fn_type @Id [concrete] +// CHECK:STDOUT: %Id: %Id.type = struct_value () [concrete] +// CHECK:STDOUT: %require_complete: = require_complete_type %U [symbolic] +// CHECK:STDOUT: %J.type: type = facet_type <@J> [concrete] +// CHECK:STDOUT: %Self: %J.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %J.assoc_type: type = assoc_entity_type %J.type [concrete] +// CHECK:STDOUT: %assoc0: %J.assoc_type = assoc_entity element0, @J.%T [concrete] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] +// CHECK:STDOUT: %Self.as_wit.iface0: = facet_access_witness %Self, element0 [symbolic] +// CHECK:STDOUT: %J.facet: %J.type = facet_value %Self.as_type, (%Self.as_wit.iface0) [symbolic] +// CHECK:STDOUT: %impl.elem0: type = impl_witness_access %Self.as_wit.iface0, element0 [symbolic] +// CHECK:STDOUT: %Id.specific_fn: = specific_function %Id, @Id(type) [concrete] +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %assoc1: %J.assoc_type = assoc_entity element1, @J.%F.decl [concrete] +// CHECK:STDOUT: %complete_type: = complete_type_witness type [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Id = %Id.decl +// CHECK:STDOUT: .J = %J.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Id.decl: %Id.type = fn_decl @Id [concrete = constants.%Id] { +// CHECK:STDOUT: %U.patt.loc3_7.1: type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc3_7.2 (constants.%U.patt)] +// CHECK:STDOUT: %x.patt: @Id.%U.loc3_7.2 (%U) = binding_pattern x +// CHECK:STDOUT: %x.param_patt: @Id.%U.loc3_7.2 (%U) = value_param_pattern %x.patt, call_param0 +// CHECK:STDOUT: %return.patt: @Id.%U.loc3_7.2 (%U) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Id.%U.loc3_7.2 (%U) = out_param_pattern %return.patt, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %U.ref.loc3_26: type = name_ref U, %U.loc3_7.1 [symbolic = %U.loc3_7.2 (constants.%U)] +// CHECK:STDOUT: %U.loc3_7.1: type = bind_symbolic_name U, 0 [symbolic = %U.loc3_7.2 (constants.%U)] +// CHECK:STDOUT: %x.param: @Id.%U.loc3_7.2 (%U) = value_param call_param0 +// CHECK:STDOUT: %U.ref.loc3_20: type = name_ref U, %U.loc3_7.1 [symbolic = %U.loc3_7.2 (constants.%U)] +// CHECK:STDOUT: %x: @Id.%U.loc3_7.2 (%U) = bind_name x, %x.param +// CHECK:STDOUT: %return.param: ref @Id.%U.loc3_7.2 (%U) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Id.%U.loc3_7.2 (%U) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %J.decl: type = interface_decl @J [concrete = constants.%J.type] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @J { +// CHECK:STDOUT: %Self: %J.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] +// CHECK:STDOUT: %T: type = assoc_const_decl @T [concrete] { +// CHECK:STDOUT: %assoc0: %J.assoc_type = assoc_entity element0, @J.%T [concrete = constants.%assoc0] +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { +// CHECK:STDOUT: %return.patt: = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: = out_param_pattern %return.patt, call_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Id.ref: %Id.type = name_ref Id, file.%Id.decl [concrete = constants.%Id] +// CHECK:STDOUT: %Self.as_wit.iface0.loc11_16.2: = facet_access_witness @J.%Self, element0 [symbolic = %Self.as_wit.iface0.loc11_16.1 (constants.%Self.as_wit.iface0)] +// CHECK:STDOUT: %impl.elem0.loc11_16.2: type = impl_witness_access %Self.as_wit.iface0.loc11_16.2, element0 [symbolic = %impl.elem0.loc11_16.1 (constants.%impl.elem0)] +// CHECK:STDOUT: %T.ref: type = name_ref T, %impl.elem0.loc11_16.2 [symbolic = %impl.elem0.loc11_16.1 (constants.%impl.elem0)] +// CHECK:STDOUT: %Id.specific_fn: = specific_function %Id.ref, @Id(type) [concrete = constants.%Id.specific_fn] +// CHECK:STDOUT: %Id.call: init type = call %Id.specific_fn(%T.ref) +// CHECK:STDOUT: %.loc11_17.1: type = value_of_initializer %Id.call +// CHECK:STDOUT: %.loc11_17.2: type = converted %Id.call, %.loc11_17.1 +// CHECK:STDOUT: %return.param: ref = out_param call_param0 +// CHECK:STDOUT: %return: ref = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc1: %J.assoc_type = assoc_entity element1, %F.decl [concrete = constants.%assoc1] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: .T = @T.%assoc0 +// CHECK:STDOUT: .Id = +// CHECK:STDOUT: .F = %assoc1 +// CHECK:STDOUT: witness = (%T, %F.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic assoc_const @T(@J.%Self: %J.type) { +// CHECK:STDOUT: assoc_const T:! type; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Id(%U.loc3_7.1: type) { +// CHECK:STDOUT: %U.loc3_7.2: type = bind_symbolic_name U, 0 [symbolic = %U.loc3_7.2 (constants.%U)] +// CHECK:STDOUT: %U.patt.loc3_7.2: type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc3_7.2 (constants.%U.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Id.%U.loc3_7.2 (%U) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%U.patt.loc3_7.1: type](%x.param_patt: @Id.%U.loc3_7.2 (%U)) -> @Id.%U.loc3_7.2 (%U) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %x.ref: @Id.%U.loc3_7.2 (%U) = name_ref x, %x +// CHECK:STDOUT: return %x.ref +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @F(@J.%Self: %J.type) { +// CHECK:STDOUT: %Self: %J.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_wit.iface0.loc11_16.1: = facet_access_witness %Self, element0 [symbolic = %Self.as_wit.iface0.loc11_16.1 (constants.%Self.as_wit.iface0)] +// CHECK:STDOUT: %impl.elem0.loc11_16.1: type = impl_witness_access %Self.as_wit.iface0.loc11_16.1, element0 [symbolic = %impl.elem0.loc11_16.1 (constants.%impl.elem0)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn() -> ; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Id(constants.%U) { +// CHECK:STDOUT: %U.loc3_7.2 => constants.%U +// CHECK:STDOUT: %U.patt.loc3_7.2 => constants.%U +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @T(constants.%Self) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @T(constants.%J.facet) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Id(type) { +// CHECK:STDOUT: %U.loc3_7.2 => type +// CHECK:STDOUT: %U.patt.loc3_7.2 => type +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @F(constants.%Self) { +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_wit.iface0.loc11_16.1 => constants.%Self.as_wit.iface0 +// CHECK:STDOUT: %impl.elem0.loc11_16.1 => constants.%impl.elem0 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_alias_to_non_const_assoc_entity.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete] +// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type %I.type [concrete] +// CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%T [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file {} +// CHECK:STDOUT: +// CHECK:STDOUT: interface @I { +// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] +// CHECK:STDOUT: %T: type = assoc_const_decl @T [concrete] { +// CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%T [concrete = constants.%assoc0] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: .T = @T.%assoc0 +// CHECK:STDOUT: witness = (%T) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic assoc_const @T(@I.%Self: %I.type) { +// CHECK:STDOUT: assoc_const T:! type; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @T(constants.%Self) {} +// CHECK:STDOUT: +// CHECK:STDOUT: --- to_import.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete] +// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type %I.type [concrete] +// CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%T [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .I = %I.decl +// CHECK:STDOUT: .U = %U +// CHECK:STDOUT: } +// CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {} +// CHECK:STDOUT: %I.ref: type = name_ref I, %I.decl [concrete = constants.%I.type] +// CHECK:STDOUT: %T.ref: %I.assoc_type = name_ref T, @T.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %U: %I.assoc_type = bind_alias U, @T.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @I { +// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] +// CHECK:STDOUT: %T: type = assoc_const_decl @T [concrete] { +// CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%T [concrete = constants.%assoc0] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: .T = @T.%assoc0 +// CHECK:STDOUT: witness = (%T) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic assoc_const @T(@I.%Self: %I.type) { +// CHECK:STDOUT: assoc_const T:! type; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @T(constants.%Self) {} +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_access_alias_in_imported_library.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %J.type: type = facet_type <@J> [concrete] +// CHECK:STDOUT: %Self.ccd: %J.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete] +// CHECK:STDOUT: %Self.826: %I.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type %I.type [concrete] +// CHECK:STDOUT: %assoc0.0c0: %I.assoc_type = assoc_entity element0, imports.%Main.import_ref.652 [concrete] +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.d62: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.519: %ImplicitAs.type.d62 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.275: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.42e: %Convert.type.275 = struct_value () [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.519 [symbolic] +// CHECK:STDOUT: %ImplicitAs.assoc_type.837: type = assoc_entity_type %ImplicitAs.type.d62 [symbolic] +// CHECK:STDOUT: %assoc0.02f: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.1c7 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.c42: type = facet_type <@ImplicitAs, @ImplicitAs(%I.type)> [concrete] +// CHECK:STDOUT: %Convert.type.7ef: type = fn_type @Convert, @ImplicitAs(%I.type) [concrete] +// CHECK:STDOUT: %Convert.c77: %Convert.type.7ef = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.assoc_type.167: type = assoc_entity_type %ImplicitAs.type.c42 [concrete] +// CHECK:STDOUT: %assoc0.0e0: %ImplicitAs.assoc_type.167 = assoc_entity element0, imports.%Core.import_ref.1c7 [concrete] +// CHECK:STDOUT: %assoc0.43d: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207 [symbolic] +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %J.assoc_type: type = assoc_entity_type %J.type [concrete] +// CHECK:STDOUT: %assoc0.ebc: %J.assoc_type = assoc_entity element0, @J.%F.decl [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Main.I = import_ref Main//to_import, I, unloaded +// CHECK:STDOUT: %Main.U: %I.assoc_type = import_ref Main//to_import, U, loaded [concrete = constants.%assoc0.0c0] +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: import Core//default +// CHECK:STDOUT: } +// CHECK:STDOUT: %Main.import_ref.e5d = import_ref Main//to_import, inst16 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.c12 = import_ref Main//to_import, loc4_8, unloaded +// CHECK:STDOUT: %Main.T = import_ref Main//to_import, T, unloaded +// CHECK:STDOUT: %Main.import_ref.5dd: %I.type = import_ref Main//to_import, inst16 [no loc], loaded [symbolic = constants.%Self.826] +// CHECK:STDOUT: %Core.import_ref.5ab3ec.1: type = import_ref Core//default, loc4_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst25 [no loc], unloaded +// CHECK:STDOUT: %Core.import_ref.630: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = import_ref Core//default, loc5_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.43d)] +// CHECK:STDOUT: %Core.Convert = import_ref Core//default, Convert, unloaded +// CHECK:STDOUT: %Core.import_ref.5ab3ec.2: type = import_ref Core//default, loc4_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) = import_ref Core//default, inst25 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] +// CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, loc5_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .I = imports.%Main.I +// CHECK:STDOUT: .U = imports.%Main.U +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .J = %J.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %default.import = import +// CHECK:STDOUT: %J.decl: type = interface_decl @J [concrete = constants.%J.type] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @J { +// CHECK:STDOUT: %Self: %J.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.ccd] +// CHECK:STDOUT: %U.ref: %I.assoc_type = name_ref U, imports.%Main.U [concrete = constants.%assoc0.0c0] +// CHECK:STDOUT: %V: %I.assoc_type = bind_alias V, imports.%Main.U [concrete = constants.%assoc0.0c0] +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { +// CHECK:STDOUT: %return.patt: = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: = out_param_pattern %return.patt, call_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %.loc16: %I.type = converted @J.%Self, [concrete = ] +// CHECK:STDOUT: %V.ref: = name_ref V, [concrete = ] +// CHECK:STDOUT: %return.param: ref = out_param call_param0 +// CHECK:STDOUT: %return: ref = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0: %J.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0.ebc] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: .U = +// CHECK:STDOUT: .V = %V +// CHECK:STDOUT: .F = %assoc0 +// CHECK:STDOUT: witness = (%F.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @I [from "to_import.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%Main.import_ref.e5d +// CHECK:STDOUT: .T = imports.%Main.import_ref.c12 +// CHECK:STDOUT: witness = (imports.%Main.T) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.5ab3ec.1: type) [from "core.carbon"] { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.d62)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.d62 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.519)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.275)] +// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = struct_value () [symbolic = %Convert (constants.%Convert.42e)] +// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type.837)] +// CHECK:STDOUT: %assoc0: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = assoc_entity element0, imports.%Core.import_ref.1c7 [symbolic = %assoc0 (constants.%assoc0.02f)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%Core.import_ref.ff5 +// CHECK:STDOUT: .Convert = imports.%Core.import_ref.630 +// CHECK:STDOUT: witness = (imports.%Core.Convert) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic assoc_const @T(imports.%Main.import_ref.5dd: %I.type) [from "to_import.carbon"] { +// CHECK:STDOUT: assoc_const T:! type; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.5ab3ec.2: type, imports.%Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62)) [from "core.carbon"] { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.d62)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.d62 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.519)] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type (%Self.as_type)]() -> @Convert.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @F(@J.%Self: %J.type) { +// CHECK:STDOUT: fn() -> ; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @T(constants.%Self.826) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(%Dest) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self.519) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.d62 +// CHECK:STDOUT: %Self => constants.%Self.519 +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%I.type) { +// CHECK:STDOUT: %Dest => constants.%I.type +// CHECK:STDOUT: %Dest.patt => constants.%I.type +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.c42 +// CHECK:STDOUT: %Self => constants.%Self.519 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.7ef +// CHECK:STDOUT: %Convert => constants.%Convert.c77 +// CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.167 +// CHECK:STDOUT: %assoc0 => constants.%assoc0.0e0 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @F(constants.%Self.ccd) {} +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/no_prelude/fail_assoc_const_alias.carbon b/toolchain/check/testdata/interface/no_prelude/fail_assoc_const_alias.carbon index 2565269806e3..121f63520316 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_assoc_const_alias.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_assoc_const_alias.carbon @@ -71,16 +71,17 @@ interface A { } interface B { alias F = A.F; - // TODO: This should be getting a different error here, since it should not - // be binding `A.F` to `Self`. - // CHECK:STDERR: fail_call_method_alias.carbon:[[@LINE+4]]:13: error: cannot access member of interface `A` in type `B` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: fail_call_method_alias.carbon:[[@LINE+7]]:13: error: cannot implicitly convert type `Self` that implements `B` into type implementing `A` [ConversionFailureFacetToFacet] + // CHECK:STDERR: fn G() -> F(); + // CHECK:STDERR: ^ + // CHECK:STDERR: fail_call_method_alias.carbon:[[@LINE+4]]:13: note: type `B` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessNote] // CHECK:STDERR: fn G() -> F(); // CHECK:STDERR: ^ // CHECK:STDERR: fn G() -> F(); } -// --- fail_todo_call_with_compound_member_access.carbon +// --- call_with_compound_member_access.carbon library "[[@TEST_NAME]]"; import Core; @@ -89,12 +90,7 @@ interface C { fn F[self: Self](); // TODO: Add `default` once supported. fn G[self: Self]() { - // These should both work. self.F(); - // CHECK:STDERR: fail_todo_call_with_compound_member_access.carbon:[[@LINE+4]]:11: error: cannot access member of interface `C` in type `C` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: self.(F)(); - // CHECK:STDERR: ^ - // CHECK:STDERR: self.(F)(); } } @@ -598,13 +594,28 @@ interface C { // CHECK:STDOUT: constants { // CHECK:STDOUT: %A.type: type = facet_type <@A> [concrete] // CHECK:STDOUT: %Self.31d: %A.type = bind_symbolic_name Self, 0 [symbolic] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.31d [symbolic] +// CHECK:STDOUT: %Self.as_type.01e: type = facet_access_type %Self.31d [symbolic] // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %A.assoc_type: type = assoc_entity_type %A.type [concrete] // CHECK:STDOUT: %assoc0.70d: %A.assoc_type = assoc_entity element0, @A.%F.decl [concrete] // CHECK:STDOUT: %B.type: type = facet_type <@B> [concrete] // CHECK:STDOUT: %Self.783: %B.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.d62: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.519: %ImplicitAs.type.d62 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.275: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.42e: %Convert.type.275 = struct_value () [symbolic] +// CHECK:STDOUT: %Self.as_type.40a: type = facet_access_type %Self.519 [symbolic] +// CHECK:STDOUT: %ImplicitAs.assoc_type.837: type = assoc_entity_type %ImplicitAs.type.d62 [symbolic] +// CHECK:STDOUT: %assoc0.02f: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.1c7 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.2d2: type = facet_type <@ImplicitAs, @ImplicitAs(%A.type)> [concrete] +// CHECK:STDOUT: %Convert.type.597: type = fn_type @Convert, @ImplicitAs(%A.type) [concrete] +// CHECK:STDOUT: %Convert.d1e: %Convert.type.597 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.assoc_type.568: type = assoc_entity_type %ImplicitAs.type.2d2 [concrete] +// CHECK:STDOUT: %assoc0.e1d: %ImplicitAs.assoc_type.568 = assoc_entity element0, imports.%Core.import_ref.1c7 [concrete] +// CHECK:STDOUT: %assoc0.43d: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207 [symbolic] // CHECK:STDOUT: %G.type: type = fn_type @G [concrete] // CHECK:STDOUT: %G: %G.type = struct_value () [concrete] // CHECK:STDOUT: %B.assoc_type: type = assoc_entity_type %B.type [concrete] @@ -613,8 +624,16 @@ interface C { // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs // CHECK:STDOUT: import Core//default // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import_ref.5ab3ec.1: type = import_ref Core//default, loc3_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst25 [no loc], unloaded +// CHECK:STDOUT: %Core.import_ref.630: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = import_ref Core//default, loc4_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.43d)] +// CHECK:STDOUT: %Core.Convert = import_ref Core//default, Convert, unloaded +// CHECK:STDOUT: %Core.import_ref.5ab3ec.2: type = import_ref Core//default, loc3_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) = import_ref Core//default, inst25 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] +// CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, loc4_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -631,18 +650,18 @@ interface C { // CHECK:STDOUT: interface @A { // CHECK:STDOUT: %Self: %A.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.31d] // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { -// CHECK:STDOUT: %self.patt: @F.%Self.as_type.loc6_14.1 (%Self.as_type) = binding_pattern self -// CHECK:STDOUT: %self.param_patt: @F.%Self.as_type.loc6_14.1 (%Self.as_type) = value_param_pattern %self.patt, call_param0 +// CHECK:STDOUT: %self.patt: @F.%Self.as_type.loc6_14.1 (%Self.as_type.01e) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @F.%Self.as_type.loc6_14.1 (%Self.as_type.01e) = value_param_pattern %self.patt, call_param0 // CHECK:STDOUT: %return.patt: type = return_slot_pattern // CHECK:STDOUT: %return.param_patt: type = out_param_pattern %return.patt, call_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: @F.%Self.as_type.loc6_14.1 (%Self.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc6_14.1: type = splice_block %.loc6_14.2 [symbolic = %Self.as_type.loc6_14.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %self.param: @F.%Self.as_type.loc6_14.1 (%Self.as_type.01e) = value_param call_param0 +// CHECK:STDOUT: %.loc6_14.1: type = splice_block %.loc6_14.2 [symbolic = %Self.as_type.loc6_14.1 (constants.%Self.as_type.01e)] { // CHECK:STDOUT: %Self.ref: %A.type = name_ref Self, @A.%Self [symbolic = %Self (constants.%Self.31d)] -// CHECK:STDOUT: %Self.as_type.loc6_14.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc6_14.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc6_14.2: type = converted %Self.ref, %Self.as_type.loc6_14.2 [symbolic = %Self.as_type.loc6_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self.as_type.loc6_14.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc6_14.1 (constants.%Self.as_type.01e)] +// CHECK:STDOUT: %.loc6_14.2: type = converted %Self.ref, %Self.as_type.loc6_14.2 [symbolic = %Self.as_type.loc6_14.1 (constants.%Self.as_type.01e)] // CHECK:STDOUT: } -// CHECK:STDOUT: %self: @F.%Self.as_type.loc6_14.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: %self: @F.%Self.as_type.loc6_14.1 (%Self.as_type.01e) = bind_name self, %self.param // CHECK:STDOUT: %return.param: ref type = out_param call_param1 // CHECK:STDOUT: %return: ref type = return_slot %return.param // CHECK:STDOUT: } @@ -663,6 +682,7 @@ interface C { // CHECK:STDOUT: %return.patt: = return_slot_pattern // CHECK:STDOUT: %return.param_patt: = out_param_pattern %return.patt, call_param0 // CHECK:STDOUT: } { +// CHECK:STDOUT: %.loc17: %A.type = converted @B.%Self, [concrete = ] // CHECK:STDOUT: %F.ref: = name_ref F, [concrete = ] // CHECK:STDOUT: %return.param: ref = out_param call_param0 // CHECK:STDOUT: %return: ref = return_slot %return.param @@ -677,11 +697,40 @@ interface C { // CHECK:STDOUT: witness = (%G.decl) // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.5ab3ec.1: type) [from "core.carbon"] { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.d62)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.d62 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.519)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.275)] +// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = struct_value () [symbolic = %Convert (constants.%Convert.42e)] +// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type.837)] +// CHECK:STDOUT: %assoc0: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = assoc_entity element0, imports.%Core.import_ref.1c7 [symbolic = %assoc0 (constants.%assoc0.02f)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%Core.import_ref.ff5 +// CHECK:STDOUT: .Convert = imports.%Core.import_ref.630 +// CHECK:STDOUT: witness = (imports.%Core.Convert) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: generic fn @F(@A.%Self: %A.type) { // CHECK:STDOUT: %Self: %A.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.31d)] -// CHECK:STDOUT: %Self.as_type.loc6_14.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc6_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self.as_type.loc6_14.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc6_14.1 (constants.%Self.as_type.01e)] // CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @F.%Self.as_type.loc6_14.1 (%Self.as_type)]() -> type; +// CHECK:STDOUT: fn[%self.param_patt: @F.%Self.as_type.loc6_14.1 (%Self.as_type.01e)]() -> type; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.5ab3ec.2: type, imports.%Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62)) [from "core.carbon"] { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.d62)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.d62 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.519)] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type.40a)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type (%Self.as_type.40a)]() -> @Convert.%Dest (%Dest); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @G(@B.%Self: %B.type) { @@ -690,12 +739,41 @@ interface C { // CHECK:STDOUT: // CHECK:STDOUT: specific @F(constants.%Self.31d) { // CHECK:STDOUT: %Self => constants.%Self.31d -// CHECK:STDOUT: %Self.as_type.loc6_14.1 => constants.%Self.as_type +// CHECK:STDOUT: %Self.as_type.loc6_14.1 => constants.%Self.as_type.01e +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(%Dest) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self.519) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.d62 +// CHECK:STDOUT: %Self => constants.%Self.519 +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type.40a +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%A.type) { +// CHECK:STDOUT: %Dest => constants.%A.type +// CHECK:STDOUT: %Dest.patt => constants.%A.type +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2d2 +// CHECK:STDOUT: %Self => constants.%Self.519 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.597 +// CHECK:STDOUT: %Convert => constants.%Convert.d1e +// CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.568 +// CHECK:STDOUT: %assoc0 => constants.%assoc0.e1d // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @G(constants.%Self.783) {} // CHECK:STDOUT: -// CHECK:STDOUT: --- fail_todo_call_with_compound_member_access.carbon +// CHECK:STDOUT: --- call_with_compound_member_access.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %C.type: type = facet_type <@C> [concrete] @@ -781,26 +859,32 @@ interface C { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete: = require_complete_type @G.%Self.as_type.loc8_14.1 (%Self.as_type) [symbolic = %require_complete (constants.%require_complete)] -// CHECK:STDOUT: %Self.as_wit.iface0.loc10_9.2: = facet_access_witness %Self, element0 [symbolic = %Self.as_wit.iface0.loc10_9.2 (constants.%Self.as_wit.iface0)] -// CHECK:STDOUT: %C.facet: %C.type = facet_value %Self.as_type.loc8_14.1, (%Self.as_wit.iface0.loc10_9.2) [symbolic = %C.facet (constants.%C.facet)] -// CHECK:STDOUT: %.loc10_9.2: type = fn_type_with_self_type constants.%F.type, %C.facet [symbolic = %.loc10_9.2 (constants.%.70a)] -// CHECK:STDOUT: %impl.elem0.loc10_9.2: @G.%.loc10_9.2 (%.70a) = impl_witness_access %Self.as_wit.iface0.loc10_9.2, element0 [symbolic = %impl.elem0.loc10_9.2 (constants.%impl.elem0)] -// CHECK:STDOUT: %specific_impl_fn.loc10_9.2: = specific_impl_function %impl.elem0.loc10_9.2, @F(%C.facet) [symbolic = %specific_impl_fn.loc10_9.2 (constants.%specific_impl_fn)] +// CHECK:STDOUT: %Self.as_wit.iface0.loc9_9.2: = facet_access_witness %Self, element0 [symbolic = %Self.as_wit.iface0.loc9_9.2 (constants.%Self.as_wit.iface0)] +// CHECK:STDOUT: %C.facet: %C.type = facet_value %Self.as_type.loc8_14.1, (%Self.as_wit.iface0.loc9_9.2) [symbolic = %C.facet (constants.%C.facet)] +// CHECK:STDOUT: %.loc9_9.2: type = fn_type_with_self_type constants.%F.type, %C.facet [symbolic = %.loc9_9.2 (constants.%.70a)] +// CHECK:STDOUT: %impl.elem0.loc9_9.2: @G.%.loc9_9.2 (%.70a) = impl_witness_access %Self.as_wit.iface0.loc9_9.2, element0 [symbolic = %impl.elem0.loc9_9.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %specific_impl_fn.loc9_9.2: = specific_impl_function %impl.elem0.loc9_9.2, @F(%C.facet) [symbolic = %specific_impl_fn.loc9_9.2 (constants.%specific_impl_fn)] // CHECK:STDOUT: // CHECK:STDOUT: fn[%self.param_patt: @G.%Self.as_type.loc8_14.1 (%Self.as_type)]() { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %self.ref.loc9: @G.%Self.as_type.loc8_14.1 (%Self.as_type) = name_ref self, %self +// CHECK:STDOUT: %F.ref.loc9: %C.assoc_type = name_ref F, @C.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %Self.as_type.loc9: type = facet_access_type constants.%Self [symbolic = %Self.as_type.loc8_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc9_9.1: type = converted constants.%Self, %Self.as_type.loc9 [symbolic = %Self.as_type.loc8_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self.as_wit.iface0.loc9_9.1: = facet_access_witness constants.%Self, element0 [symbolic = %Self.as_wit.iface0.loc9_9.2 (constants.%Self.as_wit.iface0)] +// CHECK:STDOUT: %impl.elem0.loc9_9.1: @G.%.loc9_9.2 (%.70a) = impl_witness_access %Self.as_wit.iface0.loc9_9.1, element0 [symbolic = %impl.elem0.loc9_9.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %bound_method.loc9_9: = bound_method %self.ref.loc9, %impl.elem0.loc9_9.1 +// CHECK:STDOUT: %specific_impl_fn.loc9_9.1: = specific_impl_function %impl.elem0.loc9_9.1, @F(constants.%C.facet) [symbolic = %specific_impl_fn.loc9_9.2 (constants.%specific_impl_fn)] +// CHECK:STDOUT: %bound_method.loc9_12: = bound_method %self.ref.loc9, %specific_impl_fn.loc9_9.1 +// CHECK:STDOUT: %.loc9_12: init %empty_tuple.type = call %bound_method.loc9_12(%self.ref.loc9) // CHECK:STDOUT: %self.ref.loc10: @G.%Self.as_type.loc8_14.1 (%Self.as_type) = name_ref self, %self -// CHECK:STDOUT: %F.ref.loc10: %C.assoc_type = name_ref F, @C.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %Self.as_type.loc10: type = facet_access_type constants.%Self [symbolic = %Self.as_type.loc8_14.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc10_9.1: type = converted constants.%Self, %Self.as_type.loc10 [symbolic = %Self.as_type.loc8_14.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %Self.as_wit.iface0.loc10_9.1: = facet_access_witness constants.%Self, element0 [symbolic = %Self.as_wit.iface0.loc10_9.2 (constants.%Self.as_wit.iface0)] -// CHECK:STDOUT: %impl.elem0.loc10_9.1: @G.%.loc10_9.2 (%.70a) = impl_witness_access %Self.as_wit.iface0.loc10_9.1, element0 [symbolic = %impl.elem0.loc10_9.2 (constants.%impl.elem0)] -// CHECK:STDOUT: %bound_method.loc10_9: = bound_method %self.ref.loc10, %impl.elem0.loc10_9.1 -// CHECK:STDOUT: %specific_impl_fn.loc10_9.1: = specific_impl_function %impl.elem0.loc10_9.1, @F(constants.%C.facet) [symbolic = %specific_impl_fn.loc10_9.2 (constants.%specific_impl_fn)] -// CHECK:STDOUT: %bound_method.loc10_12: = bound_method %self.ref.loc10, %specific_impl_fn.loc10_9.1 -// CHECK:STDOUT: %.loc10_12: init %empty_tuple.type = call %bound_method.loc10_12(%self.ref.loc10) -// CHECK:STDOUT: %self.ref.loc15: @G.%Self.as_type.loc8_14.1 (%Self.as_type) = name_ref self, %self -// CHECK:STDOUT: %F.ref.loc15: = name_ref F, [concrete = ] +// CHECK:STDOUT: %Self.as_wit.iface0.loc10: = facet_access_witness @C.%Self, element0 [symbolic = %Self.as_wit.iface0.loc9_9.2 (constants.%Self.as_wit.iface0)] +// CHECK:STDOUT: %impl.elem0.loc10: @G.%.loc9_9.2 (%.70a) = impl_witness_access %Self.as_wit.iface0.loc10, element0 [symbolic = %impl.elem0.loc9_9.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %F.ref.loc10: @G.%.loc9_9.2 (%.70a) = name_ref F, %impl.elem0.loc10 [symbolic = %impl.elem0.loc9_9.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %bound_method.loc10_9: = bound_method %self.ref.loc10, %F.ref.loc10 +// CHECK:STDOUT: %specific_impl_fn.loc10: = specific_impl_function %F.ref.loc10, @F(constants.%C.facet) [symbolic = %specific_impl_fn.loc9_9.2 (constants.%specific_impl_fn)] +// CHECK:STDOUT: %bound_method.loc10_14: = bound_method %self.ref.loc10, %specific_impl_fn.loc10 +// CHECK:STDOUT: %.loc10: init %empty_tuple.type = call %bound_method.loc10_14(%self.ref.loc10) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: }