From 38897b4ba1b94050b757465abbffac91d197dea5 Mon Sep 17 00:00:00 2001 From: Josh L Date: Mon, 3 Mar 2025 16:40:33 +0000 Subject: [PATCH 1/8] Checkpoint progress. --- .../impl/lookup/no_prelude/impl_forall.carbon | 564 ++++++++++++------ .../impl/lookup/no_prelude/subtyping.carbon | 173 ++++++ 2 files changed, 566 insertions(+), 171 deletions(-) create mode 100644 toolchain/check/testdata/impl/lookup/no_prelude/subtyping.carbon diff --git a/toolchain/check/testdata/impl/lookup/no_prelude/impl_forall.carbon b/toolchain/check/testdata/impl/lookup/no_prelude/impl_forall.carbon index 4d17bd0d9b7db..452163fe49199 100644 --- a/toolchain/check/testdata/impl/lookup/no_prelude/impl_forall.carbon +++ b/toolchain/check/testdata/impl/lookup/no_prelude/impl_forall.carbon @@ -9,6 +9,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/lookup/no_prelude/impl_forall.carbon // --- impl_forall.carbon +library "[[@TEST_NAME]]"; class A(T:! type) { var n: T; @@ -32,6 +33,20 @@ fn TestSpecific(a: A({})) -> {} { return a.(I({}).F)(); } +// --- find_blanket_impl.carbon +library "[[@TEST_NAME]]"; + +interface B {} +interface C {} + +impl forall [T:! B] T as C {} + +fn FC[TC:! C](xc: TC) {} + +fn FB[TB:! B](xb: TB) { + FC(xb); +} + // CHECK:STDOUT: --- impl_forall.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -124,53 +139,53 @@ fn TestSpecific(a: A({})) -> {} { // CHECK:STDOUT: .TestSpecific = %TestSpecific.decl // CHECK:STDOUT: } // CHECK:STDOUT: %A.decl: %A.type = class_decl @A [concrete = constants.%A.generic] { -// CHECK:STDOUT: %T.patt.loc2_9.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc2_9.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc2_9.1, runtime_param [symbolic = %T.patt.loc2_9.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc3_9.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc3_9.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc3_9.1, runtime_param [symbolic = %T.patt.loc3_9.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %T.param: type = value_param runtime_param -// CHECK:STDOUT: %T.loc2_9.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc2_9.2 (constants.%T)] +// CHECK:STDOUT: %T.loc3_9.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc3_9.2 (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: %I.decl: %I.type.dac = interface_decl @I [concrete = constants.%I.generic] { -// CHECK:STDOUT: %U.patt.loc6_13.1: type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc6_13.2 (constants.%U.patt)] -// CHECK:STDOUT: %U.param_patt: type = value_param_pattern %U.patt.loc6_13.1, runtime_param [symbolic = %U.patt.loc6_13.2 (constants.%U.patt)] +// CHECK:STDOUT: %U.patt.loc7_13.1: type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc7_13.2 (constants.%U.patt)] +// CHECK:STDOUT: %U.param_patt: type = value_param_pattern %U.patt.loc7_13.1, runtime_param [symbolic = %U.patt.loc7_13.2 (constants.%U.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %U.param: type = value_param runtime_param -// CHECK:STDOUT: %U.loc6_13.1: type = bind_symbolic_name U, 0, %U.param [symbolic = %U.loc6_13.2 (constants.%U)] +// CHECK:STDOUT: %U.loc7_13.1: type = bind_symbolic_name U, 0, %U.param [symbolic = %U.loc7_13.2 (constants.%U)] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl [concrete] { -// CHECK:STDOUT: %V.patt.loc10_14.1: type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc10_14.2 (constants.%V.patt)] -// CHECK:STDOUT: %V.param_patt: type = value_param_pattern %V.patt.loc10_14.1, runtime_param [symbolic = %V.patt.loc10_14.2 (constants.%V.patt)] +// CHECK:STDOUT: %V.patt.loc11_14.1: type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc11_14.2 (constants.%V.patt)] +// CHECK:STDOUT: %V.param_patt: type = value_param_pattern %V.patt.loc11_14.1, runtime_param [symbolic = %V.patt.loc11_14.2 (constants.%V.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [concrete = constants.%A.generic] -// CHECK:STDOUT: %V.ref.loc10_26: type = name_ref V, %V.loc10_14.1 [symbolic = %V.loc10_14.2 (constants.%V)] -// CHECK:STDOUT: %A.loc10_27.1: type = class_type @A, @A(constants.%V) [symbolic = %A.loc10_27.2 (constants.%A.13025a.2)] +// CHECK:STDOUT: %V.ref.loc11_26: type = name_ref V, %V.loc11_14.1 [symbolic = %V.loc11_14.2 (constants.%V)] +// CHECK:STDOUT: %A.loc11_27.1: type = class_type @A, @A(constants.%V) [symbolic = %A.loc11_27.2 (constants.%A.13025a.2)] // CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, file.%I.decl [concrete = constants.%I.generic] -// CHECK:STDOUT: %V.ref.loc10_34: type = name_ref V, %V.loc10_14.1 [symbolic = %V.loc10_14.2 (constants.%V)] -// CHECK:STDOUT: %I.type.loc10_35.1: type = facet_type <@I, @I(constants.%V)> [symbolic = %I.type.loc10_35.2 (constants.%I.type.325e65.2)] +// CHECK:STDOUT: %V.ref.loc11_34: type = name_ref V, %V.loc11_14.1 [symbolic = %V.loc11_14.2 (constants.%V)] +// CHECK:STDOUT: %I.type.loc11_35.1: type = facet_type <@I, @I(constants.%V)> [symbolic = %I.type.loc11_35.2 (constants.%I.type.325e65.2)] // CHECK:STDOUT: %V.param: type = value_param runtime_param -// CHECK:STDOUT: %V.loc10_14.1: type = bind_symbolic_name V, 0, %V.param [symbolic = %V.loc10_14.2 (constants.%V)] +// CHECK:STDOUT: %V.loc11_14.1: type = bind_symbolic_name V, 0, %V.param [symbolic = %V.loc11_14.2 (constants.%V)] // CHECK:STDOUT: } // CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%F.decl), @impl(constants.%V) [symbolic = @impl.%impl_witness (constants.%impl_witness.ab3b51.1)] // CHECK:STDOUT: %TestGeneric.decl: %TestGeneric.type = fn_decl @TestGeneric [concrete = constants.%TestGeneric] { -// CHECK:STDOUT: %W.patt.loc16_16.1: type = symbolic_binding_pattern W, 0 [symbolic = %W.patt.loc16_16.2 (constants.%W.patt)] -// CHECK:STDOUT: %W.param_patt: type = value_param_pattern %W.patt.loc16_16.1, runtime_param [symbolic = %W.patt.loc16_16.2 (constants.%W.patt)] -// CHECK:STDOUT: %a.patt: @TestGeneric.%A.loc16_32.2 (%A.13025a.3) = binding_pattern a -// CHECK:STDOUT: %a.param_patt: @TestGeneric.%A.loc16_32.2 (%A.13025a.3) = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: @TestGeneric.%W.loc16_16.2 (%W) = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: @TestGeneric.%W.loc16_16.2 (%W) = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: %W.patt.loc17_16.1: type = symbolic_binding_pattern W, 0 [symbolic = %W.patt.loc17_16.2 (constants.%W.patt)] +// CHECK:STDOUT: %W.param_patt: type = value_param_pattern %W.patt.loc17_16.1, runtime_param [symbolic = %W.patt.loc17_16.2 (constants.%W.patt)] +// CHECK:STDOUT: %a.patt: @TestGeneric.%A.loc17_32.2 (%A.13025a.3) = binding_pattern a +// CHECK:STDOUT: %a.param_patt: @TestGeneric.%A.loc17_32.2 (%A.13025a.3) = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: @TestGeneric.%W.loc17_16.2 (%W) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @TestGeneric.%W.loc17_16.2 (%W) = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %W.ref.loc16_38: type = name_ref W, %W.loc16_16.1 [symbolic = %W.loc16_16.2 (constants.%W)] +// CHECK:STDOUT: %W.ref.loc17_38: type = name_ref W, %W.loc17_16.1 [symbolic = %W.loc17_16.2 (constants.%W)] // CHECK:STDOUT: %W.param: type = value_param runtime_param -// CHECK:STDOUT: %W.loc16_16.1: type = bind_symbolic_name W, 0, %W.param [symbolic = %W.loc16_16.2 (constants.%W)] -// CHECK:STDOUT: %a.param: @TestGeneric.%A.loc16_32.2 (%A.13025a.3) = value_param runtime_param0 -// CHECK:STDOUT: %.loc16: type = splice_block %A.loc16_32.1 [symbolic = %A.loc16_32.2 (constants.%A.13025a.3)] { +// CHECK:STDOUT: %W.loc17_16.1: type = bind_symbolic_name W, 0, %W.param [symbolic = %W.loc17_16.2 (constants.%W)] +// CHECK:STDOUT: %a.param: @TestGeneric.%A.loc17_32.2 (%A.13025a.3) = value_param runtime_param0 +// CHECK:STDOUT: %.loc17: type = splice_block %A.loc17_32.1 [symbolic = %A.loc17_32.2 (constants.%A.13025a.3)] { // CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [concrete = constants.%A.generic] -// CHECK:STDOUT: %W.ref.loc16_31: type = name_ref W, %W.loc16_16.1 [symbolic = %W.loc16_16.2 (constants.%W)] -// CHECK:STDOUT: %A.loc16_32.1: type = class_type @A, @A(constants.%W) [symbolic = %A.loc16_32.2 (constants.%A.13025a.3)] +// CHECK:STDOUT: %W.ref.loc17_31: type = name_ref W, %W.loc17_16.1 [symbolic = %W.loc17_16.2 (constants.%W)] +// CHECK:STDOUT: %A.loc17_32.1: type = class_type @A, @A(constants.%W) [symbolic = %A.loc17_32.2 (constants.%A.13025a.3)] // CHECK:STDOUT: } -// CHECK:STDOUT: %a: @TestGeneric.%A.loc16_32.2 (%A.13025a.3) = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref @TestGeneric.%W.loc16_16.2 (%W) = out_param runtime_param1 -// CHECK:STDOUT: %return: ref @TestGeneric.%W.loc16_16.2 (%W) = return_slot %return.param +// CHECK:STDOUT: %a: @TestGeneric.%A.loc17_32.2 (%A.13025a.3) = bind_name a, %a.param +// CHECK:STDOUT: %return.param: ref @TestGeneric.%W.loc17_16.2 (%W) = out_param runtime_param1 +// CHECK:STDOUT: %return: ref @TestGeneric.%W.loc17_16.2 (%W) = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %TestSpecific.decl: %TestSpecific.type = fn_decl @TestSpecific [concrete = constants.%TestSpecific] { // CHECK:STDOUT: %a.patt: %A.235 = binding_pattern a @@ -178,13 +193,13 @@ fn TestSpecific(a: A({})) -> {} { // CHECK:STDOUT: %return.patt: %empty_struct_type = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %empty_struct_type = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc20_31.1: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %.loc20_31.2: type = converted %.loc20_31.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc21_31.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc21_31.2: type = converted %.loc21_31.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %a.param: %A.235 = value_param runtime_param0 -// CHECK:STDOUT: %.loc20_24.1: type = splice_block %A [concrete = constants.%A.235] { +// CHECK:STDOUT: %.loc21_24.1: type = splice_block %A [concrete = constants.%A.235] { // CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [concrete = constants.%A.generic] -// CHECK:STDOUT: %.loc20_23: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %.loc20_24.2: type = converted %.loc20_23, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc21_23: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc21_24.2: type = converted %.loc21_23, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %A: type = class_type @A, @A(constants.%empty_struct_type) [concrete = constants.%A.235] // CHECK:STDOUT: } // CHECK:STDOUT: %a: %A.235 = bind_name a, %a.param @@ -193,70 +208,70 @@ fn TestSpecific(a: A({})) -> {} { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @I(%U.loc6_13.1: type) { -// CHECK:STDOUT: %U.loc6_13.2: type = bind_symbolic_name U, 0 [symbolic = %U.loc6_13.2 (constants.%U)] -// CHECK:STDOUT: %U.patt.loc6_13.2: type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc6_13.2 (constants.%U.patt)] +// CHECK:STDOUT: generic interface @I(%U.loc7_13.1: type) { +// CHECK:STDOUT: %U.loc7_13.2: type = bind_symbolic_name U, 0 [symbolic = %U.loc7_13.2 (constants.%U)] +// CHECK:STDOUT: %U.patt.loc7_13.2: type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc7_13.2 (constants.%U.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%U.loc6_13.2)> [symbolic = %I.type (constants.%I.type.325e65.1)] +// CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%U.loc7_13.2)> [symbolic = %I.type (constants.%I.type.325e65.1)] // CHECK:STDOUT: %Self.2: %I.type.325e65.1 = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %F.type: type = fn_type @F.1, @I(%U.loc6_13.2) [symbolic = %F.type (constants.%F.type.2aef59.1)] +// CHECK:STDOUT: %F.type: type = fn_type @F.1, @I(%U.loc7_13.2) [symbolic = %F.type (constants.%F.type.2aef59.1)] // CHECK:STDOUT: %F: @I.%F.type (%F.type.2aef59.1) = struct_value () [symbolic = %F (constants.%F.bb2dd4.1)] // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I.%I.type (%I.type.325e65.1) [symbolic = %I.assoc_type (constants.%I.assoc_type.955255.1)] -// CHECK:STDOUT: %assoc0.loc7_26.2: @I.%I.assoc_type (%I.assoc_type.955255.1) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc7_26.2 (constants.%assoc0.fef501.1)] +// CHECK:STDOUT: %assoc0.loc8_26.2: @I.%I.assoc_type (%I.assoc_type.955255.1) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc8_26.2 (constants.%assoc0.fef501.1)] // CHECK:STDOUT: // CHECK:STDOUT: interface { // CHECK:STDOUT: %Self.1: @I.%I.type (%I.type.325e65.1) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] // CHECK:STDOUT: %F.decl: @I.%F.type (%F.type.2aef59.1) = fn_decl @F.1 [symbolic = @I.%F (constants.%F.bb2dd4.1)] { -// CHECK:STDOUT: %self.patt: @F.1.%Self.as_type.loc7_14.1 (%Self.as_type) = binding_pattern self -// CHECK:STDOUT: %self.param_patt: @F.1.%Self.as_type.loc7_14.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: %self.patt: @F.1.%Self.as_type.loc8_14.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @F.1.%Self.as_type.loc8_14.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %return.patt: @F.1.%U (%U) = return_slot_pattern // CHECK:STDOUT: %return.param_patt: @F.1.%U (%U) = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %U.ref: type = name_ref U, @I.%U.loc6_13.1 [symbolic = %U (constants.%U)] -// CHECK:STDOUT: %self.param: @F.1.%Self.as_type.loc7_14.1 (%Self.as_type) = value_param runtime_param0 -// CHECK:STDOUT: %.loc7_14.1: type = splice_block %.loc7_14.3 [symbolic = %Self.as_type.loc7_14.1 (constants.%Self.as_type)] { -// CHECK:STDOUT: %.loc7_14.2: @F.1.%I.type (%I.type.325e65.1) = specific_constant @I.%Self.1, @I(constants.%U) [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.ref: @F.1.%I.type (%I.type.325e65.1) = name_ref Self, %.loc7_14.2 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc7_14.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc7_14.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc7_14.3: type = converted %Self.ref, %Self.as_type.loc7_14.2 [symbolic = %Self.as_type.loc7_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %U.ref: type = name_ref U, @I.%U.loc7_13.1 [symbolic = %U (constants.%U)] +// CHECK:STDOUT: %self.param: @F.1.%Self.as_type.loc8_14.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc8_14.1: type = splice_block %.loc8_14.3 [symbolic = %Self.as_type.loc8_14.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %.loc8_14.2: @F.1.%I.type (%I.type.325e65.1) = specific_constant @I.%Self.1, @I(constants.%U) [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.ref: @F.1.%I.type (%I.type.325e65.1) = name_ref Self, %.loc8_14.2 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc8_14.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc8_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc8_14.3: type = converted %Self.ref, %Self.as_type.loc8_14.2 [symbolic = %Self.as_type.loc8_14.1 (constants.%Self.as_type)] // CHECK:STDOUT: } -// CHECK:STDOUT: %self: @F.1.%Self.as_type.loc7_14.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: %self: @F.1.%Self.as_type.loc8_14.1 (%Self.as_type) = bind_name self, %self.param // CHECK:STDOUT: %return.param: ref @F.1.%U (%U) = out_param runtime_param1 // CHECK:STDOUT: %return: ref @F.1.%U (%U) = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %assoc0.loc7_26.1: @I.%I.assoc_type (%I.assoc_type.955255.1) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc7_26.2 (constants.%assoc0.fef501.1)] +// CHECK:STDOUT: %assoc0.loc8_26.1: @I.%I.assoc_type (%I.assoc_type.955255.1) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc8_26.2 (constants.%assoc0.fef501.1)] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self.1 // CHECK:STDOUT: .U = -// CHECK:STDOUT: .F = %assoc0.loc7_26.1 +// CHECK:STDOUT: .F = %assoc0.loc8_26.1 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @impl(%V.loc10_14.1: type) { -// CHECK:STDOUT: %V.loc10_14.2: type = bind_symbolic_name V, 0 [symbolic = %V.loc10_14.2 (constants.%V)] -// CHECK:STDOUT: %V.patt.loc10_14.2: type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc10_14.2 (constants.%V.patt)] -// CHECK:STDOUT: %A.loc10_27.2: type = class_type @A, @A(%V.loc10_14.2) [symbolic = %A.loc10_27.2 (constants.%A.13025a.2)] -// CHECK:STDOUT: %I.type.loc10_35.2: type = facet_type <@I, @I(%V.loc10_14.2)> [symbolic = %I.type.loc10_35.2 (constants.%I.type.325e65.2)] -// CHECK:STDOUT: %require_complete: = require_complete_type @impl.%I.type.loc10_35.2 (%I.type.325e65.2) [symbolic = %require_complete (constants.%require_complete.cfebb2.1)] -// CHECK:STDOUT: %impl_witness: = impl_witness (%F.decl), @impl(%V.loc10_14.2) [symbolic = %impl_witness (constants.%impl_witness.ab3b51.1)] +// CHECK:STDOUT: generic impl @impl(%V.loc11_14.1: type) { +// CHECK:STDOUT: %V.loc11_14.2: type = bind_symbolic_name V, 0 [symbolic = %V.loc11_14.2 (constants.%V)] +// CHECK:STDOUT: %V.patt.loc11_14.2: type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc11_14.2 (constants.%V.patt)] +// CHECK:STDOUT: %A.loc11_27.2: type = class_type @A, @A(%V.loc11_14.2) [symbolic = %A.loc11_27.2 (constants.%A.13025a.2)] +// CHECK:STDOUT: %I.type.loc11_35.2: type = facet_type <@I, @I(%V.loc11_14.2)> [symbolic = %I.type.loc11_35.2 (constants.%I.type.325e65.2)] +// CHECK:STDOUT: %require_complete: = require_complete_type @impl.%I.type.loc11_35.2 (%I.type.325e65.2) [symbolic = %require_complete (constants.%require_complete.cfebb2.1)] +// CHECK:STDOUT: %impl_witness: = impl_witness (%F.decl), @impl(%V.loc11_14.2) [symbolic = %impl_witness (constants.%impl_witness.ab3b51.1)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %F.type: type = fn_type @F.2, @impl(%V.loc10_14.2) [symbolic = %F.type (constants.%F.type.0fea45.1)] +// CHECK:STDOUT: %F.type: type = fn_type @F.2, @impl(%V.loc11_14.2) [symbolic = %F.type (constants.%F.type.0fea45.1)] // CHECK:STDOUT: %F: @impl.%F.type (%F.type.0fea45.1) = struct_value () [symbolic = %F (constants.%F.d6ae34.1)] // CHECK:STDOUT: -// CHECK:STDOUT: impl: %A.loc10_27.1 as %I.type.loc10_35.1 { +// CHECK:STDOUT: impl: %A.loc11_27.1 as %I.type.loc11_35.1 { // CHECK:STDOUT: %F.decl: @impl.%F.type (%F.type.0fea45.1) = fn_decl @F.2 [symbolic = @impl.%F (constants.%F.d6ae34.1)] { // CHECK:STDOUT: %self.patt: @F.2.%A (%A.13025a.2) = binding_pattern self // CHECK:STDOUT: %self.param_patt: @F.2.%A (%A.13025a.2) = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %return.patt: @F.2.%V (%V) = return_slot_pattern // CHECK:STDOUT: %return.param_patt: @F.2.%V (%V) = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %V.ref: type = name_ref V, @impl.%V.loc10_14.1 [symbolic = %V (constants.%V)] +// CHECK:STDOUT: %V.ref: type = name_ref V, @impl.%V.loc11_14.1 [symbolic = %V (constants.%V)] // CHECK:STDOUT: %self.param: @F.2.%A (%A.13025a.2) = value_param runtime_param0 -// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%A.loc10_27.1 [symbolic = %A (constants.%A.13025a.2)] +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%A.loc11_27.1 [symbolic = %A (constants.%A.13025a.2)] // CHECK:STDOUT: %self: @F.2.%A (%A.13025a.2) = bind_name self, %self.param // CHECK:STDOUT: %return.param: ref @F.2.%V (%V) = out_param runtime_param1 // CHECK:STDOUT: %return: ref @F.2.%V (%V) = return_slot %return.param @@ -269,95 +284,95 @@ fn TestSpecific(a: A({})) -> {} { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @A(%T.loc2_9.1: type) { -// CHECK:STDOUT: %T.loc2_9.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc2_9.2 (constants.%T)] -// CHECK:STDOUT: %T.patt.loc2_9.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc2_9.2 (constants.%T.patt)] +// CHECK:STDOUT: generic class @A(%T.loc3_9.1: type) { +// CHECK:STDOUT: %T.loc3_9.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc3_9.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc3_9.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc3_9.2 (constants.%T.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type @A.%T.loc2_9.2 (%T) [symbolic = %require_complete (constants.%require_complete.4aeca8.1)] -// CHECK:STDOUT: %A: type = class_type @A, @A(%T.loc2_9.2) [symbolic = %A (constants.%A.13025a.1)] -// CHECK:STDOUT: %A.elem: type = unbound_element_type @A.%A (%A.13025a.1), @A.%T.loc2_9.2 (%T) [symbolic = %A.elem (constants.%A.elem.1ceb36.1)] -// CHECK:STDOUT: %struct_type.n: type = struct_type {.n: @A.%T.loc2_9.2 (%T)} [symbolic = %struct_type.n (constants.%struct_type.n.848971.1)] -// CHECK:STDOUT: %complete_type.loc4_1.2: = complete_type_witness @A.%struct_type.n (%struct_type.n.848971.1) [symbolic = %complete_type.loc4_1.2 (constants.%complete_type.84bb3d.1)] +// CHECK:STDOUT: %require_complete: = require_complete_type @A.%T.loc3_9.2 (%T) [symbolic = %require_complete (constants.%require_complete.4aeca8.1)] +// CHECK:STDOUT: %A: type = class_type @A, @A(%T.loc3_9.2) [symbolic = %A (constants.%A.13025a.1)] +// CHECK:STDOUT: %A.elem: type = unbound_element_type @A.%A (%A.13025a.1), @A.%T.loc3_9.2 (%T) [symbolic = %A.elem (constants.%A.elem.1ceb36.1)] +// CHECK:STDOUT: %struct_type.n: type = struct_type {.n: @A.%T.loc3_9.2 (%T)} [symbolic = %struct_type.n (constants.%struct_type.n.848971.1)] +// CHECK:STDOUT: %complete_type.loc5_1.2: = complete_type_witness @A.%struct_type.n (%struct_type.n.848971.1) [symbolic = %complete_type.loc5_1.2 (constants.%complete_type.84bb3d.1)] // CHECK:STDOUT: // CHECK:STDOUT: class { -// CHECK:STDOUT: %.loc3_8: @A.%A.elem (%A.elem.1ceb36.1) = field_decl n, element0 [concrete] +// CHECK:STDOUT: %.loc4_8: @A.%A.elem (%A.elem.1ceb36.1) = field_decl n, element0 [concrete] // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %.loc3_3: @A.%A.elem (%A.elem.1ceb36.1) = var_pattern %.loc3_8 +// CHECK:STDOUT: %.loc4_3: @A.%A.elem (%A.elem.1ceb36.1) = var_pattern %.loc4_8 // CHECK:STDOUT: } // CHECK:STDOUT: %.var: ref @A.%A.elem (%A.elem.1ceb36.1) = var -// CHECK:STDOUT: %complete_type.loc4_1.1: = complete_type_witness %struct_type.n.848971.1 [symbolic = %complete_type.loc4_1.2 (constants.%complete_type.84bb3d.1)] -// CHECK:STDOUT: complete_type_witness = %complete_type.loc4_1.1 +// CHECK:STDOUT: %complete_type.loc5_1.1: = complete_type_witness %struct_type.n.848971.1 [symbolic = %complete_type.loc5_1.2 (constants.%complete_type.84bb3d.1)] +// CHECK:STDOUT: complete_type_witness = %complete_type.loc5_1.1 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A.13025a.1 // CHECK:STDOUT: .T = -// CHECK:STDOUT: .n = %.loc3_8 +// CHECK:STDOUT: .n = %.loc4_8 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F.1(@I.%U.loc6_13.1: type, @I.%Self.1: @I.%I.type (%I.type.325e65.1)) { +// CHECK:STDOUT: generic fn @F.1(@I.%U.loc7_13.1: type, @I.%Self.1: @I.%I.type (%I.type.325e65.1)) { // CHECK:STDOUT: %U: type = bind_symbolic_name U, 0 [symbolic = %U (constants.%U)] // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%U)> [symbolic = %I.type (constants.%I.type.325e65.1)] // CHECK:STDOUT: %Self: %I.type.325e65.1 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc7_14.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc7_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self.as_type.loc8_14.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc8_14.1 (constants.%Self.as_type)] // CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @F.1.%Self.as_type.loc7_14.1 (%Self.as_type)]() -> @F.1.%U (%U); +// CHECK:STDOUT: fn[%self.param_patt: @F.1.%Self.as_type.loc8_14.1 (%Self.as_type)]() -> @F.1.%U (%U); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F.2(@impl.%V.loc10_14.1: type) { +// CHECK:STDOUT: generic fn @F.2(@impl.%V.loc11_14.1: type) { // CHECK:STDOUT: %V: type = bind_symbolic_name V, 0 [symbolic = %V (constants.%V)] // CHECK:STDOUT: %A: type = class_type @A, @A(%V) [symbolic = %A (constants.%A.13025a.2)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc11_22: = require_complete_type @F.2.%V (%V) [symbolic = %require_complete.loc11_22 (constants.%require_complete.4aeca8.2)] -// CHECK:STDOUT: %require_complete.loc11_12: = require_complete_type @F.2.%A (%A.13025a.2) [symbolic = %require_complete.loc11_12 (constants.%require_complete.5b8aee.1)] +// CHECK:STDOUT: %require_complete.loc12_22: = require_complete_type @F.2.%V (%V) [symbolic = %require_complete.loc12_22 (constants.%require_complete.4aeca8.2)] +// CHECK:STDOUT: %require_complete.loc12_12: = require_complete_type @F.2.%A (%A.13025a.2) [symbolic = %require_complete.loc12_12 (constants.%require_complete.5b8aee.1)] // CHECK:STDOUT: %A.elem: type = unbound_element_type @F.2.%A (%A.13025a.2), @F.2.%V (%V) [symbolic = %A.elem (constants.%A.elem.1ceb36.2)] // CHECK:STDOUT: // CHECK:STDOUT: fn[%self.param_patt: @F.2.%A (%A.13025a.2)]() -> @F.2.%V (%V) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %self.ref: @F.2.%A (%A.13025a.2) = name_ref self, %self -// CHECK:STDOUT: %n.ref: @F.2.%A.elem (%A.elem.1ceb36.2) = name_ref n, @A.%.loc3_8 [concrete = @A.%.loc3_8] -// CHECK:STDOUT: %.loc12_16.1: ref @F.2.%V (%V) = class_element_access %self.ref, element0 -// CHECK:STDOUT: %.loc12_16.2: @F.2.%V (%V) = bind_value %.loc12_16.1 -// CHECK:STDOUT: return %.loc12_16.2 +// CHECK:STDOUT: %n.ref: @F.2.%A.elem (%A.elem.1ceb36.2) = name_ref n, @A.%.loc4_8 [concrete = @A.%.loc4_8] +// CHECK:STDOUT: %.loc13_16.1: ref @F.2.%V (%V) = class_element_access %self.ref, element0 +// CHECK:STDOUT: %.loc13_16.2: @F.2.%V (%V) = bind_value %.loc13_16.1 +// CHECK:STDOUT: return %.loc13_16.2 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @TestGeneric(%W.loc16_16.1: type) { -// CHECK:STDOUT: %W.loc16_16.2: type = bind_symbolic_name W, 0 [symbolic = %W.loc16_16.2 (constants.%W)] -// CHECK:STDOUT: %W.patt.loc16_16.2: type = symbolic_binding_pattern W, 0 [symbolic = %W.patt.loc16_16.2 (constants.%W.patt)] -// CHECK:STDOUT: %A.loc16_32.2: type = class_type @A, @A(%W.loc16_16.2) [symbolic = %A.loc16_32.2 (constants.%A.13025a.3)] +// CHECK:STDOUT: generic fn @TestGeneric(%W.loc17_16.1: type) { +// CHECK:STDOUT: %W.loc17_16.2: type = bind_symbolic_name W, 0 [symbolic = %W.loc17_16.2 (constants.%W)] +// CHECK:STDOUT: %W.patt.loc17_16.2: type = symbolic_binding_pattern W, 0 [symbolic = %W.patt.loc17_16.2 (constants.%W.patt)] +// CHECK:STDOUT: %A.loc17_32.2: type = class_type @A, @A(%W.loc17_16.2) [symbolic = %A.loc17_32.2 (constants.%A.13025a.3)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc16_35: = require_complete_type @TestGeneric.%W.loc16_16.2 (%W) [symbolic = %require_complete.loc16_35 (constants.%require_complete.4aeca8.3)] -// CHECK:STDOUT: %require_complete.loc16_27: = require_complete_type @TestGeneric.%A.loc16_32.2 (%A.13025a.3) [symbolic = %require_complete.loc16_27 (constants.%require_complete.5b8aee.2)] -// CHECK:STDOUT: %I.type.loc17_16.2: type = facet_type <@I, @I(%W.loc16_16.2)> [symbolic = %I.type.loc17_16.2 (constants.%I.type.325e65.3)] -// CHECK:STDOUT: %require_complete.loc17: = require_complete_type @TestGeneric.%I.type.loc17_16.2 (%I.type.325e65.3) [symbolic = %require_complete.loc17 (constants.%require_complete.cfebb2.2)] -// CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @TestGeneric.%I.type.loc17_16.2 (%I.type.325e65.3) [symbolic = %I.assoc_type (constants.%I.assoc_type.955255.3)] +// CHECK:STDOUT: %require_complete.loc17_35: = require_complete_type @TestGeneric.%W.loc17_16.2 (%W) [symbolic = %require_complete.loc17_35 (constants.%require_complete.4aeca8.3)] +// CHECK:STDOUT: %require_complete.loc17_27: = require_complete_type @TestGeneric.%A.loc17_32.2 (%A.13025a.3) [symbolic = %require_complete.loc17_27 (constants.%require_complete.5b8aee.2)] +// CHECK:STDOUT: %I.type.loc18_16.2: type = facet_type <@I, @I(%W.loc17_16.2)> [symbolic = %I.type.loc18_16.2 (constants.%I.type.325e65.3)] +// CHECK:STDOUT: %require_complete.loc18: = require_complete_type @TestGeneric.%I.type.loc18_16.2 (%I.type.325e65.3) [symbolic = %require_complete.loc18 (constants.%require_complete.cfebb2.2)] +// CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @TestGeneric.%I.type.loc18_16.2 (%I.type.325e65.3) [symbolic = %I.assoc_type (constants.%I.assoc_type.955255.3)] // CHECK:STDOUT: %assoc0: @TestGeneric.%I.assoc_type (%I.assoc_type.955255.3) = assoc_entity element0, @I.%F.decl [symbolic = %assoc0 (constants.%assoc0.fef501.3)] -// CHECK:STDOUT: %F.type.loc17_11.1: type = fn_type @F.1, @I(%W.loc16_16.2) [symbolic = %F.type.loc17_11.1 (constants.%F.type.2aef59.3)] -// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%F.decl), @impl(%W.loc16_16.2) [symbolic = %impl_witness (constants.%impl_witness.ab3b51.2)] -// CHECK:STDOUT: %I.facet: @TestGeneric.%I.type.loc17_16.2 (%I.type.325e65.3) = facet_value %A.loc16_32.2, %impl_witness [symbolic = %I.facet (constants.%I.facet.5b0ece.2)] -// CHECK:STDOUT: %.loc17_11: type = fn_type_with_self_type %F.type.loc17_11.1, %I.facet [symbolic = %.loc17_11 (constants.%.051)] -// CHECK:STDOUT: %F.type.loc17_11.2: type = fn_type @F.2, @impl(%W.loc16_16.2) [symbolic = %F.type.loc17_11.2 (constants.%F.type.0fea45.2)] -// CHECK:STDOUT: %F: @TestGeneric.%F.type.loc17_11.2 (%F.type.0fea45.2) = struct_value () [symbolic = %F (constants.%F.d6ae34.2)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%W.param_patt: type](%a.param_patt: @TestGeneric.%A.loc16_32.2 (%A.13025a.3)) -> @TestGeneric.%W.loc16_16.2 (%W) { +// CHECK:STDOUT: %F.type.loc18_11.1: type = fn_type @F.1, @I(%W.loc17_16.2) [symbolic = %F.type.loc18_11.1 (constants.%F.type.2aef59.3)] +// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%F.decl), @impl(%W.loc17_16.2) [symbolic = %impl_witness (constants.%impl_witness.ab3b51.2)] +// CHECK:STDOUT: %I.facet: @TestGeneric.%I.type.loc18_16.2 (%I.type.325e65.3) = facet_value %A.loc17_32.2, %impl_witness [symbolic = %I.facet (constants.%I.facet.5b0ece.2)] +// CHECK:STDOUT: %.loc18_11: type = fn_type_with_self_type %F.type.loc18_11.1, %I.facet [symbolic = %.loc18_11 (constants.%.051)] +// CHECK:STDOUT: %F.type.loc18_11.2: type = fn_type @F.2, @impl(%W.loc17_16.2) [symbolic = %F.type.loc18_11.2 (constants.%F.type.0fea45.2)] +// CHECK:STDOUT: %F: @TestGeneric.%F.type.loc18_11.2 (%F.type.0fea45.2) = struct_value () [symbolic = %F (constants.%F.d6ae34.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%W.param_patt: type](%a.param_patt: @TestGeneric.%A.loc17_32.2 (%A.13025a.3)) -> @TestGeneric.%W.loc17_16.2 (%W) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %a.ref: @TestGeneric.%A.loc16_32.2 (%A.13025a.3) = name_ref a, %a +// CHECK:STDOUT: %a.ref: @TestGeneric.%A.loc17_32.2 (%A.13025a.3) = name_ref a, %a // CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, file.%I.decl [concrete = constants.%I.generic] -// CHECK:STDOUT: %W.ref.loc17: type = name_ref W, %W.loc16_16.1 [symbolic = %W.loc16_16.2 (constants.%W)] -// CHECK:STDOUT: %I.type.loc17_16.1: type = facet_type <@I, @I(constants.%W)> [symbolic = %I.type.loc17_16.2 (constants.%I.type.325e65.3)] -// CHECK:STDOUT: %.loc17_17: @TestGeneric.%I.assoc_type (%I.assoc_type.955255.3) = specific_constant @I.%assoc0.loc7_26.1, @I(constants.%W) [symbolic = %assoc0 (constants.%assoc0.fef501.3)] -// CHECK:STDOUT: %F.ref: @TestGeneric.%I.assoc_type (%I.assoc_type.955255.3) = name_ref F, %.loc17_17 [symbolic = %assoc0 (constants.%assoc0.fef501.3)] -// CHECK:STDOUT: %impl.elem0: @TestGeneric.%.loc17_11 (%.051) = impl_witness_access constants.%impl_witness.ab3b51.2, element0 [symbolic = %F (constants.%F.d6ae34.2)] +// CHECK:STDOUT: %W.ref.loc18: type = name_ref W, %W.loc17_16.1 [symbolic = %W.loc17_16.2 (constants.%W)] +// CHECK:STDOUT: %I.type.loc18_16.1: type = facet_type <@I, @I(constants.%W)> [symbolic = %I.type.loc18_16.2 (constants.%I.type.325e65.3)] +// CHECK:STDOUT: %.loc18_17: @TestGeneric.%I.assoc_type (%I.assoc_type.955255.3) = specific_constant @I.%assoc0.loc8_26.1, @I(constants.%W) [symbolic = %assoc0 (constants.%assoc0.fef501.3)] +// CHECK:STDOUT: %F.ref: @TestGeneric.%I.assoc_type (%I.assoc_type.955255.3) = name_ref F, %.loc18_17 [symbolic = %assoc0 (constants.%assoc0.fef501.3)] +// CHECK:STDOUT: %impl.elem0: @TestGeneric.%.loc18_11 (%.051) = impl_witness_access constants.%impl_witness.ab3b51.2, element0 [symbolic = %F (constants.%F.d6ae34.2)] // CHECK:STDOUT: %bound_method: = bound_method %a.ref, %impl.elem0 // CHECK:STDOUT: %specific_fn: = specific_function %bound_method, @F.2(constants.%W) -// CHECK:STDOUT: %F.call: init @TestGeneric.%W.loc16_16.2 (%W) = call %specific_fn(%a.ref) -// CHECK:STDOUT: %.loc17_22.1: @TestGeneric.%W.loc16_16.2 (%W) = value_of_initializer %F.call -// CHECK:STDOUT: %.loc17_22.2: @TestGeneric.%W.loc16_16.2 (%W) = converted %F.call, %.loc17_22.1 -// CHECK:STDOUT: return %.loc17_22.2 +// CHECK:STDOUT: %F.call: init @TestGeneric.%W.loc17_16.2 (%W) = call %specific_fn(%a.ref) +// CHECK:STDOUT: %.loc18_22.1: @TestGeneric.%W.loc17_16.2 (%W) = value_of_initializer %F.call +// CHECK:STDOUT: %.loc18_22.2: @TestGeneric.%W.loc17_16.2 (%W) = converted %F.call, %.loc18_22.1 +// CHECK:STDOUT: return %.loc18_22.2 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -365,60 +380,60 @@ fn TestSpecific(a: A({})) -> {} { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: %A.235 = name_ref a, %a // CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, file.%I.decl [concrete = constants.%I.generic] -// CHECK:STDOUT: %.loc21_16: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %.loc21_17: type = converted %.loc21_16, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc22_16: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc22_17: type = converted %.loc22_16, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(constants.%empty_struct_type)> [concrete = constants.%I.type.885] -// CHECK:STDOUT: %.loc21_18: %I.assoc_type.67f = specific_constant @I.%assoc0.loc7_26.1, @I(constants.%empty_struct_type) [concrete = constants.%assoc0.639] -// CHECK:STDOUT: %F.ref: %I.assoc_type.67f = name_ref F, %.loc21_18 [concrete = constants.%assoc0.639] +// CHECK:STDOUT: %.loc22_18: %I.assoc_type.67f = specific_constant @I.%assoc0.loc8_26.1, @I(constants.%empty_struct_type) [concrete = constants.%assoc0.639] +// CHECK:STDOUT: %F.ref: %I.assoc_type.67f = name_ref F, %.loc22_18 [concrete = constants.%assoc0.639] // CHECK:STDOUT: %impl.elem0: %.f01 = impl_witness_access constants.%impl_witness.f35, element0 [concrete = constants.%F.158] // CHECK:STDOUT: %bound_method: = bound_method %a.ref, %impl.elem0 // CHECK:STDOUT: %specific_fn: = specific_function %bound_method, @F.2(constants.%empty_struct_type) // CHECK:STDOUT: %F.call: init %empty_struct_type = call %specific_fn(%a.ref) -// CHECK:STDOUT: %.loc21_22.1: ref %empty_struct_type = temporary_storage -// CHECK:STDOUT: %.loc21_22.2: ref %empty_struct_type = temporary %.loc21_22.1, %F.call +// CHECK:STDOUT: %.loc22_22.1: ref %empty_struct_type = temporary_storage +// CHECK:STDOUT: %.loc22_22.2: ref %empty_struct_type = temporary %.loc22_22.1, %F.call // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc21_23: %empty_struct_type = converted %F.call, %empty_struct [concrete = constants.%empty_struct] -// CHECK:STDOUT: return %.loc21_23 +// CHECK:STDOUT: %.loc22_23: %empty_struct_type = converted %F.call, %empty_struct [concrete = constants.%empty_struct] +// CHECK:STDOUT: return %.loc22_23 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @A(constants.%T) { -// CHECK:STDOUT: %T.loc2_9.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc2_9.2 => constants.%T +// CHECK:STDOUT: %T.loc3_9.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc3_9.2 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @A(%T.loc2_9.2) {} +// CHECK:STDOUT: specific @A(%T.loc3_9.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @I(constants.%U) { -// CHECK:STDOUT: %U.loc6_13.2 => constants.%U -// CHECK:STDOUT: %U.patt.loc6_13.2 => constants.%U +// CHECK:STDOUT: %U.loc7_13.2 => constants.%U +// CHECK:STDOUT: %U.patt.loc7_13.2 => constants.%U // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F.1(constants.%U, constants.%Self) { // CHECK:STDOUT: %U => constants.%U // CHECK:STDOUT: %I.type => constants.%I.type.325e65.1 // CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.as_type.loc7_14.1 => constants.%Self.as_type +// CHECK:STDOUT: %Self.as_type.loc8_14.1 => constants.%Self.as_type // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @I(@F.1.%U) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @I(%U.loc6_13.2) {} +// CHECK:STDOUT: specific @I(%U.loc7_13.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @A(constants.%V) { -// CHECK:STDOUT: %T.loc2_9.2 => constants.%V -// CHECK:STDOUT: %T.patt.loc2_9.2 => constants.%V +// CHECK:STDOUT: %T.loc3_9.2 => constants.%V +// CHECK:STDOUT: %T.patt.loc3_9.2 => constants.%V // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete => constants.%require_complete.4aeca8.2 // CHECK:STDOUT: %A => constants.%A.13025a.2 // CHECK:STDOUT: %A.elem => constants.%A.elem.1ceb36.2 // CHECK:STDOUT: %struct_type.n => constants.%struct_type.n.848971.2 -// CHECK:STDOUT: %complete_type.loc4_1.2 => constants.%complete_type.84bb3d.2 +// CHECK:STDOUT: %complete_type.loc5_1.2 => constants.%complete_type.84bb3d.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @I(constants.%V) { -// CHECK:STDOUT: %U.loc6_13.2 => constants.%V -// CHECK:STDOUT: %U.patt.loc6_13.2 => constants.%V +// CHECK:STDOUT: %U.loc7_13.2 => constants.%V +// CHECK:STDOUT: %U.patt.loc7_13.2 => constants.%V // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %I.type => constants.%I.type.325e65.2 @@ -426,14 +441,14 @@ fn TestSpecific(a: A({})) -> {} { // CHECK:STDOUT: %F.type => constants.%F.type.2aef59.2 // CHECK:STDOUT: %F => constants.%F.bb2dd4.2 // CHECK:STDOUT: %I.assoc_type => constants.%I.assoc_type.955255.2 -// CHECK:STDOUT: %assoc0.loc7_26.2 => constants.%assoc0.fef501.2 +// CHECK:STDOUT: %assoc0.loc8_26.2 => constants.%assoc0.fef501.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @impl(constants.%V) { -// CHECK:STDOUT: %V.loc10_14.2 => constants.%V -// CHECK:STDOUT: %V.patt.loc10_14.2 => constants.%V -// CHECK:STDOUT: %A.loc10_27.2 => constants.%A.13025a.2 -// CHECK:STDOUT: %I.type.loc10_35.2 => constants.%I.type.325e65.2 +// CHECK:STDOUT: %V.loc11_14.2 => constants.%V +// CHECK:STDOUT: %V.patt.loc11_14.2 => constants.%V +// CHECK:STDOUT: %A.loc11_27.2 => constants.%A.13025a.2 +// CHECK:STDOUT: %I.type.loc11_35.2 => constants.%I.type.325e65.2 // CHECK:STDOUT: %require_complete => constants.%require_complete.cfebb2.1 // CHECK:STDOUT: %impl_witness => constants.%impl_witness.ab3b51.1 // CHECK:STDOUT: @@ -442,11 +457,11 @@ fn TestSpecific(a: A({})) -> {} { // CHECK:STDOUT: %F => constants.%F.d6ae34.1 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @A(@impl.%V.loc10_14.2) {} +// CHECK:STDOUT: specific @A(@impl.%V.loc11_14.2) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @I(@impl.%V.loc10_14.2) {} +// CHECK:STDOUT: specific @I(@impl.%V.loc11_14.2) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @impl(%V.loc10_14.2) {} +// CHECK:STDOUT: specific @impl(%V.loc11_14.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @F.2(constants.%V) { // CHECK:STDOUT: %V => constants.%V @@ -459,32 +474,32 @@ fn TestSpecific(a: A({})) -> {} { // CHECK:STDOUT: %U => constants.%V // CHECK:STDOUT: %I.type => constants.%I.type.325e65.2 // CHECK:STDOUT: %Self => constants.%I.facet.5b0ece.1 -// CHECK:STDOUT: %Self.as_type.loc7_14.1 => constants.%A.13025a.2 +// CHECK:STDOUT: %Self.as_type.loc8_14.1 => constants.%A.13025a.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @A(constants.%W) { -// CHECK:STDOUT: %T.loc2_9.2 => constants.%W -// CHECK:STDOUT: %T.patt.loc2_9.2 => constants.%W +// CHECK:STDOUT: %T.loc3_9.2 => constants.%W +// CHECK:STDOUT: %T.patt.loc3_9.2 => constants.%W // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete => constants.%require_complete.4aeca8.3 // CHECK:STDOUT: %A => constants.%A.13025a.3 // CHECK:STDOUT: %A.elem => constants.%A.elem.1ceb36.3 // CHECK:STDOUT: %struct_type.n => constants.%struct_type.n.848971.3 -// CHECK:STDOUT: %complete_type.loc4_1.2 => constants.%complete_type.84bb3d.3 +// CHECK:STDOUT: %complete_type.loc5_1.2 => constants.%complete_type.84bb3d.3 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @TestGeneric(constants.%W) { -// CHECK:STDOUT: %W.loc16_16.2 => constants.%W -// CHECK:STDOUT: %W.patt.loc16_16.2 => constants.%W -// CHECK:STDOUT: %A.loc16_32.2 => constants.%A.13025a.3 +// CHECK:STDOUT: %W.loc17_16.2 => constants.%W +// CHECK:STDOUT: %W.patt.loc17_16.2 => constants.%W +// CHECK:STDOUT: %A.loc17_32.2 => constants.%A.13025a.3 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @A(@TestGeneric.%W.loc16_16.2) {} +// CHECK:STDOUT: specific @A(@TestGeneric.%W.loc17_16.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @I(constants.%W) { -// CHECK:STDOUT: %U.loc6_13.2 => constants.%W -// CHECK:STDOUT: %U.patt.loc6_13.2 => constants.%W +// CHECK:STDOUT: %U.loc7_13.2 => constants.%W +// CHECK:STDOUT: %U.patt.loc7_13.2 => constants.%W // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %I.type => constants.%I.type.325e65.3 @@ -492,14 +507,14 @@ fn TestSpecific(a: A({})) -> {} { // CHECK:STDOUT: %F.type => constants.%F.type.2aef59.3 // CHECK:STDOUT: %F => constants.%F.bb2dd4.3 // CHECK:STDOUT: %I.assoc_type => constants.%I.assoc_type.955255.3 -// CHECK:STDOUT: %assoc0.loc7_26.2 => constants.%assoc0.fef501.3 +// CHECK:STDOUT: %assoc0.loc8_26.2 => constants.%assoc0.fef501.3 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @impl(constants.%W) { -// CHECK:STDOUT: %V.loc10_14.2 => constants.%W -// CHECK:STDOUT: %V.patt.loc10_14.2 => constants.%W -// CHECK:STDOUT: %A.loc10_27.2 => constants.%A.13025a.3 -// CHECK:STDOUT: %I.type.loc10_35.2 => constants.%I.type.325e65.3 +// CHECK:STDOUT: %V.loc11_14.2 => constants.%W +// CHECK:STDOUT: %V.patt.loc11_14.2 => constants.%W +// CHECK:STDOUT: %A.loc11_27.2 => constants.%A.13025a.3 +// CHECK:STDOUT: %I.type.loc11_35.2 => constants.%I.type.325e65.3 // CHECK:STDOUT: %require_complete => constants.%require_complete.cfebb2.2 // CHECK:STDOUT: %impl_witness => constants.%impl_witness.ab3b51.2 // CHECK:STDOUT: @@ -513,30 +528,30 @@ fn TestSpecific(a: A({})) -> {} { // CHECK:STDOUT: %A => constants.%A.13025a.3 // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc11_22 => constants.%require_complete.4aeca8.3 -// CHECK:STDOUT: %require_complete.loc11_12 => constants.%require_complete.5b8aee.2 +// CHECK:STDOUT: %require_complete.loc12_22 => constants.%require_complete.4aeca8.3 +// CHECK:STDOUT: %require_complete.loc12_12 => constants.%require_complete.5b8aee.2 // CHECK:STDOUT: %A.elem => constants.%A.elem.1ceb36.3 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @I(@TestGeneric.%W.loc16_16.2) {} +// CHECK:STDOUT: specific @I(@TestGeneric.%W.loc17_16.2) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @impl(@TestGeneric.%W.loc16_16.2) {} +// CHECK:STDOUT: specific @impl(@TestGeneric.%W.loc17_16.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @A(constants.%empty_struct_type) { -// CHECK:STDOUT: %T.loc2_9.2 => constants.%empty_struct_type -// CHECK:STDOUT: %T.patt.loc2_9.2 => constants.%empty_struct_type +// CHECK:STDOUT: %T.loc3_9.2 => constants.%empty_struct_type +// CHECK:STDOUT: %T.patt.loc3_9.2 => constants.%empty_struct_type // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete => constants.%complete_type.357 // CHECK:STDOUT: %A => constants.%A.235 // CHECK:STDOUT: %A.elem => constants.%A.elem.2af // CHECK:STDOUT: %struct_type.n => constants.%struct_type.n.91c -// CHECK:STDOUT: %complete_type.loc4_1.2 => constants.%complete_type.0a6 +// CHECK:STDOUT: %complete_type.loc5_1.2 => constants.%complete_type.0a6 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @I(constants.%empty_struct_type) { -// CHECK:STDOUT: %U.loc6_13.2 => constants.%empty_struct_type -// CHECK:STDOUT: %U.patt.loc6_13.2 => constants.%empty_struct_type +// CHECK:STDOUT: %U.loc7_13.2 => constants.%empty_struct_type +// CHECK:STDOUT: %U.patt.loc7_13.2 => constants.%empty_struct_type // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %I.type => constants.%I.type.885 @@ -544,14 +559,14 @@ fn TestSpecific(a: A({})) -> {} { // CHECK:STDOUT: %F.type => constants.%F.type.684 // CHECK:STDOUT: %F => constants.%F.a8d // CHECK:STDOUT: %I.assoc_type => constants.%I.assoc_type.67f -// CHECK:STDOUT: %assoc0.loc7_26.2 => constants.%assoc0.639 +// CHECK:STDOUT: %assoc0.loc8_26.2 => constants.%assoc0.639 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @impl(constants.%empty_struct_type) { -// CHECK:STDOUT: %V.loc10_14.2 => constants.%empty_struct_type -// CHECK:STDOUT: %V.patt.loc10_14.2 => constants.%empty_struct_type -// CHECK:STDOUT: %A.loc10_27.2 => constants.%A.235 -// CHECK:STDOUT: %I.type.loc10_35.2 => constants.%I.type.885 +// CHECK:STDOUT: %V.loc11_14.2 => constants.%empty_struct_type +// CHECK:STDOUT: %V.patt.loc11_14.2 => constants.%empty_struct_type +// CHECK:STDOUT: %A.loc11_27.2 => constants.%A.235 +// CHECK:STDOUT: %I.type.loc11_35.2 => constants.%I.type.885 // CHECK:STDOUT: %require_complete => constants.%complete_type.788 // CHECK:STDOUT: %impl_witness => constants.%impl_witness.f35 // CHECK:STDOUT: @@ -565,8 +580,215 @@ fn TestSpecific(a: A({})) -> {} { // CHECK:STDOUT: %A => constants.%A.235 // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc11_22 => constants.%complete_type.357 -// CHECK:STDOUT: %require_complete.loc11_12 => constants.%complete_type.0a6 +// CHECK:STDOUT: %require_complete.loc12_22 => constants.%complete_type.357 +// CHECK:STDOUT: %require_complete.loc12_12 => constants.%complete_type.0a6 // CHECK:STDOUT: %A.elem => constants.%A.elem.2af // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: --- find_blanket_impl.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %B.type: type = facet_type <@B> [concrete] +// CHECK:STDOUT: %Self.783: %B.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %C.type: type = facet_type <@C> [concrete] +// CHECK:STDOUT: %Self.02e: %C.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %T: %B.type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.patt: %B.type = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %impl_witness.1431bd.1: = impl_witness (), @impl(%T) [symbolic] +// CHECK:STDOUT: %TC: %C.type = bind_symbolic_name TC, 0 [symbolic] +// CHECK:STDOUT: %TC.patt: %C.type = symbolic_binding_pattern TC, 0 [symbolic] +// CHECK:STDOUT: %TC.as_type: type = facet_access_type %TC [symbolic] +// CHECK:STDOUT: %FC.type: type = fn_type @FC [concrete] +// CHECK:STDOUT: %FC: %FC.type = struct_value () [concrete] +// CHECK:STDOUT: %require_complete.8ca: = require_complete_type %TC.as_type [symbolic] +// CHECK:STDOUT: %TB: %B.type = bind_symbolic_name TB, 0 [symbolic] +// CHECK:STDOUT: %TB.patt: %B.type = symbolic_binding_pattern TB, 0 [symbolic] +// CHECK:STDOUT: %TB.as_type: type = facet_access_type %TB [symbolic] +// CHECK:STDOUT: %FB.type: type = fn_type @FB [concrete] +// CHECK:STDOUT: %FB: %FB.type = struct_value () [concrete] +// CHECK:STDOUT: %require_complete.e08: = require_complete_type %TB.as_type [symbolic] +// CHECK:STDOUT: %impl_witness.1431bd.2: = impl_witness (), @impl(%TB) [symbolic] +// CHECK:STDOUT: %C.facet: %C.type = facet_value %TB.as_type, %impl_witness.1431bd.2 [symbolic] +// CHECK:STDOUT: %FC.specific_fn: = specific_function %FC, @FC(%C.facet) [symbolic] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .B = %B.decl +// CHECK:STDOUT: .C = %C.decl +// CHECK:STDOUT: .FC = %FC.decl +// CHECK:STDOUT: .FB = %FB.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %B.decl: type = interface_decl @B [concrete = constants.%B.type] {} {} +// CHECK:STDOUT: %C.decl: type = interface_decl @C [concrete = constants.%C.type] {} {} +// CHECK:STDOUT: impl_decl @impl [concrete] { +// CHECK:STDOUT: %T.patt.loc6_14.1: %B.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.param_patt: %B.type = value_param_pattern %T.patt.loc6_14.1, runtime_param [symbolic = %T.patt.loc6_14.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %T.ref: %B.type = name_ref T, %T.loc6_14.1 [symbolic = %T.loc6_14.2 (constants.%T)] +// CHECK:STDOUT: %T.as_type.loc6_21.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc6_21.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc6: type = converted %T.ref, %T.as_type.loc6_21.1 [symbolic = %T.as_type.loc6_21.2 (constants.%T.as_type)] +// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C.type] +// CHECK:STDOUT: %T.param: %B.type = value_param runtime_param +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B.type] +// CHECK:STDOUT: %T.loc6_14.1: %B.type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc6_14.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness: = impl_witness (), @impl(constants.%T) [symbolic = @impl.%impl_witness (constants.%impl_witness.1431bd.1)] +// CHECK:STDOUT: %FC.decl: %FC.type = fn_decl @FC [concrete = constants.%FC] { +// CHECK:STDOUT: %TC.patt.loc8_7.1: %C.type = symbolic_binding_pattern TC, 0 [symbolic = %TC.patt.loc8_7.2 (constants.%TC.patt)] +// CHECK:STDOUT: %TC.param_patt: %C.type = value_param_pattern %TC.patt.loc8_7.1, runtime_param [symbolic = %TC.patt.loc8_7.2 (constants.%TC.patt)] +// CHECK:STDOUT: %xc.patt: @FC.%TC.as_type.loc8_19.2 (%TC.as_type) = binding_pattern xc +// CHECK:STDOUT: %xc.param_patt: @FC.%TC.as_type.loc8_19.2 (%TC.as_type) = value_param_pattern %xc.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %TC.param: %C.type = value_param runtime_param +// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C.type] +// CHECK:STDOUT: %TC.loc8_7.1: %C.type = bind_symbolic_name TC, 0, %TC.param [symbolic = %TC.loc8_7.2 (constants.%TC)] +// CHECK:STDOUT: %xc.param: @FC.%TC.as_type.loc8_19.2 (%TC.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc8_19.1: type = splice_block %.loc8_19.2 [symbolic = %TC.as_type.loc8_19.2 (constants.%TC.as_type)] { +// CHECK:STDOUT: %TC.ref: %C.type = name_ref TC, %TC.loc8_7.1 [symbolic = %TC.loc8_7.2 (constants.%TC)] +// CHECK:STDOUT: %TC.as_type.loc8_19.1: type = facet_access_type %TC.ref [symbolic = %TC.as_type.loc8_19.2 (constants.%TC.as_type)] +// CHECK:STDOUT: %.loc8_19.2: type = converted %TC.ref, %TC.as_type.loc8_19.1 [symbolic = %TC.as_type.loc8_19.2 (constants.%TC.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %xc: @FC.%TC.as_type.loc8_19.2 (%TC.as_type) = bind_name xc, %xc.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %FB.decl: %FB.type = fn_decl @FB [concrete = constants.%FB] { +// CHECK:STDOUT: %TB.patt.loc10_7.1: %B.type = symbolic_binding_pattern TB, 0 [symbolic = %TB.patt.loc10_7.2 (constants.%TB.patt)] +// CHECK:STDOUT: %TB.param_patt: %B.type = value_param_pattern %TB.patt.loc10_7.1, runtime_param [symbolic = %TB.patt.loc10_7.2 (constants.%TB.patt)] +// CHECK:STDOUT: %xb.patt: @FB.%TB.as_type.loc10_19.2 (%TB.as_type) = binding_pattern xb +// CHECK:STDOUT: %xb.param_patt: @FB.%TB.as_type.loc10_19.2 (%TB.as_type) = value_param_pattern %xb.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %TB.param: %B.type = value_param runtime_param +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B.type] +// CHECK:STDOUT: %TB.loc10_7.1: %B.type = bind_symbolic_name TB, 0, %TB.param [symbolic = %TB.loc10_7.2 (constants.%TB)] +// CHECK:STDOUT: %xb.param: @FB.%TB.as_type.loc10_19.2 (%TB.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc10_19.1: type = splice_block %.loc10_19.2 [symbolic = %TB.as_type.loc10_19.2 (constants.%TB.as_type)] { +// CHECK:STDOUT: %TB.ref: %B.type = name_ref TB, %TB.loc10_7.1 [symbolic = %TB.loc10_7.2 (constants.%TB)] +// CHECK:STDOUT: %TB.as_type.loc10_19.1: type = facet_access_type %TB.ref [symbolic = %TB.as_type.loc10_19.2 (constants.%TB.as_type)] +// CHECK:STDOUT: %.loc10_19.2: type = converted %TB.ref, %TB.as_type.loc10_19.1 [symbolic = %TB.as_type.loc10_19.2 (constants.%TB.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %xb: @FB.%TB.as_type.loc10_19.2 (%TB.as_type) = bind_name xb, %xb.param +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @B { +// CHECK:STDOUT: %Self: %B.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.783] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: witness = () +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @C { +// CHECK:STDOUT: %Self: %C.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.02e] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: witness = () +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl(%T.loc6_14.1: %B.type) { +// CHECK:STDOUT: %T.loc6_14.2: %B.type = bind_symbolic_name T, 0 [symbolic = %T.loc6_14.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc6_14.2: %B.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.as_type.loc6_21.2: type = facet_access_type %T.loc6_14.2 [symbolic = %T.as_type.loc6_21.2 (constants.%T.as_type)] +// CHECK:STDOUT: %impl_witness: = impl_witness (), @impl(%T.loc6_14.2) [symbolic = %impl_witness (constants.%impl_witness.1431bd.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %.loc6 as %C.ref { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = file.%impl_witness +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @FC(%TC.loc8_7.1: %C.type) { +// CHECK:STDOUT: %TC.loc8_7.2: %C.type = bind_symbolic_name TC, 0 [symbolic = %TC.loc8_7.2 (constants.%TC)] +// CHECK:STDOUT: %TC.patt.loc8_7.2: %C.type = symbolic_binding_pattern TC, 0 [symbolic = %TC.patt.loc8_7.2 (constants.%TC.patt)] +// CHECK:STDOUT: %TC.as_type.loc8_19.2: type = facet_access_type %TC.loc8_7.2 [symbolic = %TC.as_type.loc8_19.2 (constants.%TC.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @FC.%TC.as_type.loc8_19.2 (%TC.as_type) [symbolic = %require_complete (constants.%require_complete.8ca)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%TC.param_patt: %C.type](%xc.param_patt: @FC.%TC.as_type.loc8_19.2 (%TC.as_type)) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @FB(%TB.loc10_7.1: %B.type) { +// CHECK:STDOUT: %TB.loc10_7.2: %B.type = bind_symbolic_name TB, 0 [symbolic = %TB.loc10_7.2 (constants.%TB)] +// CHECK:STDOUT: %TB.patt.loc10_7.2: %B.type = symbolic_binding_pattern TB, 0 [symbolic = %TB.patt.loc10_7.2 (constants.%TB.patt)] +// CHECK:STDOUT: %TB.as_type.loc10_19.2: type = facet_access_type %TB.loc10_7.2 [symbolic = %TB.as_type.loc10_19.2 (constants.%TB.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @FB.%TB.as_type.loc10_19.2 (%TB.as_type) [symbolic = %require_complete (constants.%require_complete.e08)] +// CHECK:STDOUT: %impl_witness: = impl_witness (), @impl(%TB.loc10_7.2) [symbolic = %impl_witness (constants.%impl_witness.1431bd.2)] +// CHECK:STDOUT: %C.facet.loc11_8.3: %C.type = facet_value %TB.as_type.loc10_19.2, %impl_witness [symbolic = %C.facet.loc11_8.3 (constants.%C.facet)] +// CHECK:STDOUT: %FC.specific_fn.loc11_3.2: = specific_function constants.%FC, @FC(%C.facet.loc11_8.3) [symbolic = %FC.specific_fn.loc11_3.2 (constants.%FC.specific_fn)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%TB.param_patt: %B.type](%xb.param_patt: @FB.%TB.as_type.loc10_19.2 (%TB.as_type)) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %FC.ref: %FC.type = name_ref FC, file.%FC.decl [concrete = constants.%FC] +// CHECK:STDOUT: %xb.ref: @FB.%TB.as_type.loc10_19.2 (%TB.as_type) = name_ref xb, %xb +// CHECK:STDOUT: %TB.as_type.loc11_8.1: type = facet_access_type constants.%TB [symbolic = %TB.as_type.loc10_19.2 (constants.%TB.as_type)] +// CHECK:STDOUT: %.loc11_8.1: type = converted constants.%TB, %TB.as_type.loc11_8.1 [symbolic = %TB.as_type.loc10_19.2 (constants.%TB.as_type)] +// CHECK:STDOUT: %.loc11_8.2: %B.type = converted %.loc11_8.1, constants.%TB [symbolic = %TB.loc10_7.2 (constants.%TB)] +// CHECK:STDOUT: %.loc11_8.3: %B.type = converted constants.%TB.as_type, constants.%TB [symbolic = %TB.loc10_7.2 (constants.%TB)] +// CHECK:STDOUT: %C.facet.loc11_8.1: %C.type = facet_value constants.%TB.as_type, constants.%impl_witness.1431bd.2 [symbolic = %C.facet.loc11_8.3 (constants.%C.facet)] +// CHECK:STDOUT: %.loc11_8.4: %C.type = converted constants.%TB.as_type, %C.facet.loc11_8.1 [symbolic = %C.facet.loc11_8.3 (constants.%C.facet)] +// CHECK:STDOUT: %TB.as_type.loc11_8.2: type = facet_access_type constants.%TB [symbolic = %TB.as_type.loc10_19.2 (constants.%TB.as_type)] +// CHECK:STDOUT: %.loc11_8.5: type = converted constants.%TB, %TB.as_type.loc11_8.2 [symbolic = %TB.as_type.loc10_19.2 (constants.%TB.as_type)] +// CHECK:STDOUT: %.loc11_8.6: %B.type = converted %.loc11_8.5, constants.%TB [symbolic = %TB.loc10_7.2 (constants.%TB)] +// CHECK:STDOUT: %.loc11_8.7: %B.type = converted constants.%TB.as_type, constants.%TB [symbolic = %TB.loc10_7.2 (constants.%TB)] +// CHECK:STDOUT: %C.facet.loc11_8.2: %C.type = facet_value constants.%TB.as_type, constants.%impl_witness.1431bd.2 [symbolic = %C.facet.loc11_8.3 (constants.%C.facet)] +// CHECK:STDOUT: %.loc11_8.8: %C.type = converted constants.%TB.as_type, %C.facet.loc11_8.2 [symbolic = %C.facet.loc11_8.3 (constants.%C.facet)] +// CHECK:STDOUT: %FC.specific_fn.loc11_3.1: = specific_function %FC.ref, @FC(constants.%C.facet) [symbolic = %FC.specific_fn.loc11_3.2 (constants.%FC.specific_fn)] +// CHECK:STDOUT: %FC.call: init %empty_tuple.type = call %FC.specific_fn.loc11_3.1(%xb.ref) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl(constants.%T) { +// CHECK:STDOUT: %T.loc6_14.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc6_14.2 => constants.%T +// CHECK:STDOUT: %T.as_type.loc6_21.2 => constants.%T.as_type +// CHECK:STDOUT: %impl_witness => constants.%impl_witness.1431bd.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl(%T.loc6_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @FC(constants.%TC) { +// CHECK:STDOUT: %TC.loc8_7.2 => constants.%TC +// CHECK:STDOUT: %TC.patt.loc8_7.2 => constants.%TC +// CHECK:STDOUT: %TC.as_type.loc8_19.2 => constants.%TC.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @FB(constants.%TB) { +// CHECK:STDOUT: %TB.loc10_7.2 => constants.%TB +// CHECK:STDOUT: %TB.patt.loc10_7.2 => constants.%TB +// CHECK:STDOUT: %TB.as_type.loc10_19.2 => constants.%TB.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl(constants.%TB) { +// CHECK:STDOUT: %T.loc6_14.2 => constants.%TB +// CHECK:STDOUT: %T.patt.loc6_14.2 => constants.%TB +// CHECK:STDOUT: %T.as_type.loc6_21.2 => constants.%TB.as_type +// CHECK:STDOUT: %impl_witness => constants.%impl_witness.1431bd.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @FC(constants.%C.facet) { +// CHECK:STDOUT: %TC.loc8_7.2 => constants.%C.facet +// CHECK:STDOUT: %TC.patt.loc8_7.2 => constants.%C.facet +// CHECK:STDOUT: %TC.as_type.loc8_19.2 => constants.%TB.as_type +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%require_complete.e08 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl(@FB.%TB.loc10_7.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @FC(@FB.%C.facet.loc11_8.3) {} +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/no_prelude/subtyping.carbon b/toolchain/check/testdata/impl/lookup/no_prelude/subtyping.carbon new file mode 100644 index 0000000000000..14dea103bbd48 --- /dev/null +++ b/toolchain/check/testdata/impl/lookup/no_prelude/subtyping.carbon @@ -0,0 +1,173 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/lookup/no_prelude/subtyping.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/lookup/no_prelude/subtyping.carbon + +// This is testing `FindWitnessInFacet` from impl_lookup.cpp + +// --- equivalent.carbon +library "[[@TEST_NAME]]"; + +interface A {} + +fn TakesA[T:! A](x: T) {} + +fn WithExtraWhere[U:! A where .Self impls type](y: U) { + TakesA(y); +} + +// CHECK:STDOUT: --- equivalent.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A.type: type = facet_type <@A> [concrete] +// CHECK:STDOUT: %Self: %A.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %T: %A.type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.patt: %A.type = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic] +// CHECK:STDOUT: %TakesA.type: type = fn_type @TakesA [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %TakesA: %TakesA.type = struct_value () [concrete] +// CHECK:STDOUT: %require_complete.cf4: = require_complete_type %T.as_type [symbolic] +// CHECK:STDOUT: %.Self: %A.type = bind_symbolic_name .Self [symbolic_self] +// CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self] +// CHECK:STDOUT: %A_where.type: type = facet_type <@A where TODO> [concrete] +// CHECK:STDOUT: %U: %A_where.type = bind_symbolic_name U, 0 [symbolic] +// CHECK:STDOUT: %U.patt: %A_where.type = symbolic_binding_pattern U, 0 [symbolic] +// CHECK:STDOUT: %U.as_type: type = facet_access_type %U [symbolic] +// CHECK:STDOUT: %WithExtraWhere.type: type = fn_type @WithExtraWhere [concrete] +// CHECK:STDOUT: %WithExtraWhere: %WithExtraWhere.type = struct_value () [concrete] +// CHECK:STDOUT: %require_complete.732: = require_complete_type %U.as_type [symbolic] +// CHECK:STDOUT: %U.as_wit: = facet_access_witness %U [symbolic] +// CHECK:STDOUT: %A.facet: %A.type = facet_value %U.as_type, %U.as_wit [symbolic] +// CHECK:STDOUT: %TakesA.specific_fn: = specific_function %TakesA, @TakesA(%A.facet) [symbolic] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .A = %A.decl +// CHECK:STDOUT: .TakesA = %TakesA.decl +// CHECK:STDOUT: .WithExtraWhere = %WithExtraWhere.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %A.decl: type = interface_decl @A [concrete = constants.%A.type] {} {} +// CHECK:STDOUT: %TakesA.decl: %TakesA.type = fn_decl @TakesA [concrete = constants.%TakesA] { +// CHECK:STDOUT: %T.patt.loc5_11.1: %A.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc5_11.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.param_patt: %A.type = value_param_pattern %T.patt.loc5_11.1, runtime_param [symbolic = %T.patt.loc5_11.2 (constants.%T.patt)] +// CHECK:STDOUT: %x.patt: @TakesA.%T.as_type.loc5_21.2 (%T.as_type) = binding_pattern x +// CHECK:STDOUT: %x.param_patt: @TakesA.%T.as_type.loc5_21.2 (%T.as_type) = value_param_pattern %x.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %T.param: %A.type = value_param runtime_param +// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %T.loc5_11.1: %A.type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc5_11.2 (constants.%T)] +// CHECK:STDOUT: %x.param: @TakesA.%T.as_type.loc5_21.2 (%T.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc5_21.1: type = splice_block %.loc5_21.2 [symbolic = %T.as_type.loc5_21.2 (constants.%T.as_type)] { +// CHECK:STDOUT: %T.ref: %A.type = name_ref T, %T.loc5_11.1 [symbolic = %T.loc5_11.2 (constants.%T)] +// CHECK:STDOUT: %T.as_type.loc5_21.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc5_21.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc5_21.2: type = converted %T.ref, %T.as_type.loc5_21.1 [symbolic = %T.as_type.loc5_21.2 (constants.%T.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %x: @TakesA.%T.as_type.loc5_21.2 (%T.as_type) = bind_name x, %x.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %WithExtraWhere.decl: %WithExtraWhere.type = fn_decl @WithExtraWhere [concrete = constants.%WithExtraWhere] { +// CHECK:STDOUT: %U.patt.loc7_19.1: %A_where.type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc7_19.2 (constants.%U.patt)] +// CHECK:STDOUT: %U.param_patt: %A_where.type = value_param_pattern %U.patt.loc7_19.1, runtime_param [symbolic = %U.patt.loc7_19.2 (constants.%U.patt)] +// CHECK:STDOUT: %y.patt: @WithExtraWhere.%U.as_type.loc7_52.2 (%U.as_type) = binding_pattern y +// CHECK:STDOUT: %y.param_patt: @WithExtraWhere.%U.as_type.loc7_52.2 (%U.as_type) = value_param_pattern %y.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %U.param: %A_where.type = value_param runtime_param +// CHECK:STDOUT: %.loc7_25.1: type = splice_block %.loc7_25.2 [concrete = constants.%A_where.type] { +// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %.Self: %A.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self] +// CHECK:STDOUT: %.Self.ref: %A.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] +// CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type] +// CHECK:STDOUT: %.loc7_31: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type] +// CHECK:STDOUT: %.loc7_25.2: type = where_expr %.Self [concrete = constants.%A_where.type] { +// CHECK:STDOUT: requirement_impls %.loc7_31, type +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: %U.loc7_19.1: %A_where.type = bind_symbolic_name U, 0, %U.param [symbolic = %U.loc7_19.2 (constants.%U)] +// CHECK:STDOUT: %y.param: @WithExtraWhere.%U.as_type.loc7_52.2 (%U.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc7_52.1: type = splice_block %.loc7_52.2 [symbolic = %U.as_type.loc7_52.2 (constants.%U.as_type)] { +// CHECK:STDOUT: %U.ref: %A_where.type = name_ref U, %U.loc7_19.1 [symbolic = %U.loc7_19.2 (constants.%U)] +// CHECK:STDOUT: %U.as_type.loc7_52.1: type = facet_access_type %U.ref [symbolic = %U.as_type.loc7_52.2 (constants.%U.as_type)] +// CHECK:STDOUT: %.loc7_52.2: type = converted %U.ref, %U.as_type.loc7_52.1 [symbolic = %U.as_type.loc7_52.2 (constants.%U.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %y: @WithExtraWhere.%U.as_type.loc7_52.2 (%U.as_type) = bind_name y, %y.param +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @A { +// CHECK:STDOUT: %Self: %A.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: witness = () +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @TakesA(%T.loc5_11.1: %A.type) { +// CHECK:STDOUT: %T.loc5_11.2: %A.type = bind_symbolic_name T, 0 [symbolic = %T.loc5_11.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc5_11.2: %A.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc5_11.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.as_type.loc5_21.2: type = facet_access_type %T.loc5_11.2 [symbolic = %T.as_type.loc5_21.2 (constants.%T.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @TakesA.%T.as_type.loc5_21.2 (%T.as_type) [symbolic = %require_complete (constants.%require_complete.cf4)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%T.param_patt: %A.type](%x.param_patt: @TakesA.%T.as_type.loc5_21.2 (%T.as_type)) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @WithExtraWhere(%U.loc7_19.1: %A_where.type) { +// CHECK:STDOUT: %U.loc7_19.2: %A_where.type = bind_symbolic_name U, 0 [symbolic = %U.loc7_19.2 (constants.%U)] +// CHECK:STDOUT: %U.patt.loc7_19.2: %A_where.type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc7_19.2 (constants.%U.patt)] +// CHECK:STDOUT: %U.as_type.loc7_52.2: type = facet_access_type %U.loc7_19.2 [symbolic = %U.as_type.loc7_52.2 (constants.%U.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @WithExtraWhere.%U.as_type.loc7_52.2 (%U.as_type) [symbolic = %require_complete (constants.%require_complete.732)] +// CHECK:STDOUT: %U.as_wit.loc8_11.3: = facet_access_witness %U.loc7_19.2 [symbolic = %U.as_wit.loc8_11.3 (constants.%U.as_wit)] +// CHECK:STDOUT: %A.facet.loc8_11.3: %A.type = facet_value %U.as_type.loc7_52.2, %U.as_wit.loc8_11.3 [symbolic = %A.facet.loc8_11.3 (constants.%A.facet)] +// CHECK:STDOUT: %TakesA.specific_fn.loc8_3.2: = specific_function constants.%TakesA, @TakesA(%A.facet.loc8_11.3) [symbolic = %TakesA.specific_fn.loc8_3.2 (constants.%TakesA.specific_fn)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%U.param_patt: %A_where.type](%y.param_patt: @WithExtraWhere.%U.as_type.loc7_52.2 (%U.as_type)) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %TakesA.ref: %TakesA.type = name_ref TakesA, file.%TakesA.decl [concrete = constants.%TakesA] +// CHECK:STDOUT: %y.ref: @WithExtraWhere.%U.as_type.loc7_52.2 (%U.as_type) = name_ref y, %y +// CHECK:STDOUT: %U.as_wit.loc8_11.1: = facet_access_witness constants.%U [symbolic = %U.as_wit.loc8_11.3 (constants.%U.as_wit)] +// CHECK:STDOUT: %A.facet.loc8_11.1: %A.type = facet_value constants.%U.as_type, %U.as_wit.loc8_11.1 [symbolic = %A.facet.loc8_11.3 (constants.%A.facet)] +// CHECK:STDOUT: %.loc8_11.1: %A.type = converted constants.%U.as_type, %A.facet.loc8_11.1 [symbolic = %A.facet.loc8_11.3 (constants.%A.facet)] +// CHECK:STDOUT: %U.as_wit.loc8_11.2: = facet_access_witness constants.%U [symbolic = %U.as_wit.loc8_11.3 (constants.%U.as_wit)] +// CHECK:STDOUT: %A.facet.loc8_11.2: %A.type = facet_value constants.%U.as_type, %U.as_wit.loc8_11.2 [symbolic = %A.facet.loc8_11.3 (constants.%A.facet)] +// CHECK:STDOUT: %.loc8_11.2: %A.type = converted constants.%U.as_type, %A.facet.loc8_11.2 [symbolic = %A.facet.loc8_11.3 (constants.%A.facet)] +// CHECK:STDOUT: %TakesA.specific_fn.loc8_3.1: = specific_function %TakesA.ref, @TakesA(constants.%A.facet) [symbolic = %TakesA.specific_fn.loc8_3.2 (constants.%TakesA.specific_fn)] +// CHECK:STDOUT: %TakesA.call: init %empty_tuple.type = call %TakesA.specific_fn.loc8_3.1(%y.ref) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @TakesA(constants.%T) { +// CHECK:STDOUT: %T.loc5_11.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc5_11.2 => constants.%T +// CHECK:STDOUT: %T.as_type.loc5_21.2 => constants.%T.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @WithExtraWhere(constants.%U) { +// CHECK:STDOUT: %U.loc7_19.2 => constants.%U +// CHECK:STDOUT: %U.patt.loc7_19.2 => constants.%U +// CHECK:STDOUT: %U.as_type.loc7_52.2 => constants.%U.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @TakesA(constants.%A.facet) { +// CHECK:STDOUT: %T.loc5_11.2 => constants.%A.facet +// CHECK:STDOUT: %T.patt.loc5_11.2 => constants.%A.facet +// CHECK:STDOUT: %T.as_type.loc5_21.2 => constants.%U.as_type +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%require_complete.732 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @TakesA(@WithExtraWhere.%A.facet.loc8_11.3) {} +// CHECK:STDOUT: From d49f756b658be99c309d194de2d5214a138c4524 Mon Sep 17 00:00:00 2001 From: Josh L Date: Mon, 3 Mar 2025 16:42:49 +0000 Subject: [PATCH 2/8] Checkpoint progress. --- .../impl/lookup/no_prelude/subtyping.carbon | 34 +++++-------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/toolchain/check/testdata/impl/lookup/no_prelude/subtyping.carbon b/toolchain/check/testdata/impl/lookup/no_prelude/subtyping.carbon index 14dea103bbd48..eba2dfcfb5d6b 100644 --- a/toolchain/check/testdata/impl/lookup/no_prelude/subtyping.carbon +++ b/toolchain/check/testdata/impl/lookup/no_prelude/subtyping.carbon @@ -18,6 +18,13 @@ interface A {} fn TakesA[T:! A](x: T) {} fn WithExtraWhere[U:! A where .Self impls type](y: U) { + // CHECK:STDERR: equivalent.carbon:[[@LINE+7]]:3: error: `Core.ImplicitAs` implicitly referenced here, but package `Core` not found [CoreNotFound] + // CHECK:STDERR: TakesA(y); + // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: equivalent.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: fn TakesA[T:! A](x: T) {} + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: TakesA(y); } @@ -30,7 +37,6 @@ fn WithExtraWhere[U:! A where .Self impls type](y: U) { // CHECK:STDOUT: %T.patt: %A.type = symbolic_binding_pattern T, 0 [symbolic] // CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic] // CHECK:STDOUT: %TakesA.type: type = fn_type @TakesA [concrete] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %TakesA: %TakesA.type = struct_value () [concrete] // CHECK:STDOUT: %require_complete.cf4: = require_complete_type %T.as_type [symbolic] // CHECK:STDOUT: %.Self: %A.type = bind_symbolic_name .Self [symbolic_self] @@ -42,9 +48,6 @@ fn WithExtraWhere[U:! A where .Self impls type](y: U) { // CHECK:STDOUT: %WithExtraWhere.type: type = fn_type @WithExtraWhere [concrete] // CHECK:STDOUT: %WithExtraWhere: %WithExtraWhere.type = struct_value () [concrete] // CHECK:STDOUT: %require_complete.732: = require_complete_type %U.as_type [symbolic] -// CHECK:STDOUT: %U.as_wit: = facet_access_witness %U [symbolic] -// CHECK:STDOUT: %A.facet: %A.type = facet_value %U.as_type, %U.as_wit [symbolic] -// CHECK:STDOUT: %TakesA.specific_fn: = specific_function %TakesA, @TakesA(%A.facet) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -128,22 +131,12 @@ fn WithExtraWhere[U:! A where .Self impls type](y: U) { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete: = require_complete_type @WithExtraWhere.%U.as_type.loc7_52.2 (%U.as_type) [symbolic = %require_complete (constants.%require_complete.732)] -// CHECK:STDOUT: %U.as_wit.loc8_11.3: = facet_access_witness %U.loc7_19.2 [symbolic = %U.as_wit.loc8_11.3 (constants.%U.as_wit)] -// CHECK:STDOUT: %A.facet.loc8_11.3: %A.type = facet_value %U.as_type.loc7_52.2, %U.as_wit.loc8_11.3 [symbolic = %A.facet.loc8_11.3 (constants.%A.facet)] -// CHECK:STDOUT: %TakesA.specific_fn.loc8_3.2: = specific_function constants.%TakesA, @TakesA(%A.facet.loc8_11.3) [symbolic = %TakesA.specific_fn.loc8_3.2 (constants.%TakesA.specific_fn)] // CHECK:STDOUT: // CHECK:STDOUT: fn[%U.param_patt: %A_where.type](%y.param_patt: @WithExtraWhere.%U.as_type.loc7_52.2 (%U.as_type)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %TakesA.ref: %TakesA.type = name_ref TakesA, file.%TakesA.decl [concrete = constants.%TakesA] // CHECK:STDOUT: %y.ref: @WithExtraWhere.%U.as_type.loc7_52.2 (%U.as_type) = name_ref y, %y -// CHECK:STDOUT: %U.as_wit.loc8_11.1: = facet_access_witness constants.%U [symbolic = %U.as_wit.loc8_11.3 (constants.%U.as_wit)] -// CHECK:STDOUT: %A.facet.loc8_11.1: %A.type = facet_value constants.%U.as_type, %U.as_wit.loc8_11.1 [symbolic = %A.facet.loc8_11.3 (constants.%A.facet)] -// CHECK:STDOUT: %.loc8_11.1: %A.type = converted constants.%U.as_type, %A.facet.loc8_11.1 [symbolic = %A.facet.loc8_11.3 (constants.%A.facet)] -// CHECK:STDOUT: %U.as_wit.loc8_11.2: = facet_access_witness constants.%U [symbolic = %U.as_wit.loc8_11.3 (constants.%U.as_wit)] -// CHECK:STDOUT: %A.facet.loc8_11.2: %A.type = facet_value constants.%U.as_type, %U.as_wit.loc8_11.2 [symbolic = %A.facet.loc8_11.3 (constants.%A.facet)] -// CHECK:STDOUT: %.loc8_11.2: %A.type = converted constants.%U.as_type, %A.facet.loc8_11.2 [symbolic = %A.facet.loc8_11.3 (constants.%A.facet)] -// CHECK:STDOUT: %TakesA.specific_fn.loc8_3.1: = specific_function %TakesA.ref, @TakesA(constants.%A.facet) [symbolic = %TakesA.specific_fn.loc8_3.2 (constants.%TakesA.specific_fn)] -// CHECK:STDOUT: %TakesA.call: init %empty_tuple.type = call %TakesA.specific_fn.loc8_3.1(%y.ref) +// CHECK:STDOUT: %.loc15: %A.type = converted constants.%U.as_type, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -160,14 +153,3 @@ fn WithExtraWhere[U:! A where .Self impls type](y: U) { // CHECK:STDOUT: %U.as_type.loc7_52.2 => constants.%U.as_type // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @TakesA(constants.%A.facet) { -// CHECK:STDOUT: %T.loc5_11.2 => constants.%A.facet -// CHECK:STDOUT: %T.patt.loc5_11.2 => constants.%A.facet -// CHECK:STDOUT: %T.as_type.loc5_21.2 => constants.%U.as_type -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete => constants.%require_complete.732 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @TakesA(@WithExtraWhere.%A.facet.loc8_11.3) {} -// CHECK:STDOUT: From 42fafd8aa5e97764e5e33bc2776a0e2eba6e9ae9 Mon Sep 17 00:00:00 2001 From: Josh L Date: Mon, 3 Mar 2025 16:43:58 +0000 Subject: [PATCH 3/8] Checkpoint progress. --- .../testdata/facet/no_prelude/combine.carbon | 26 +- toolchain/check/testdata/impl/compound.carbon | 263 -- .../check/testdata/impl/lookup/generic.carbon | 332 ++- .../impl/lookup/no_prelude/import.carbon | 499 +++- .../lookup/no_prelude/specific_args.carbon | 191 +- .../testdata/impl/lookup/transitive.carbon | 88 +- .../testdata/impl/no_prelude/compound.carbon | 911 +++++++ .../impl/no_prelude/fail_impl_as_scope.carbon | 132 +- .../impl/no_prelude/import_compound.carbon | 1045 ++++++++ .../impl/no_prelude/import_use_generic.carbon | 94 +- .../impl/no_prelude/interface_args.carbon | 687 +++++- .../no_prelude/compound_member_access.carbon | 2122 +++++++++++++++++ .../interface/no_prelude/default_fn.carbon | 50 +- .../no_prelude/fail_member_lookup.carbon | 240 +- .../interface/no_prelude/local.carbon | 52 +- 15 files changed, 6036 insertions(+), 696 deletions(-) delete mode 100644 toolchain/check/testdata/impl/compound.carbon create mode 100644 toolchain/check/testdata/impl/no_prelude/compound.carbon create mode 100644 toolchain/check/testdata/impl/no_prelude/import_compound.carbon create mode 100644 toolchain/check/testdata/interface/no_prelude/compound_member_access.carbon diff --git a/toolchain/check/testdata/facet/no_prelude/combine.carbon b/toolchain/check/testdata/facet/no_prelude/combine.carbon index 466a859134a25..c640c5938a425 100644 --- a/toolchain/check/testdata/facet/no_prelude/combine.carbon +++ b/toolchain/check/testdata/facet/no_prelude/combine.carbon @@ -65,12 +65,12 @@ library "[[@TEST_NAME]]"; import Core; interface A { - fn G(); + fn G[self: Self](); } class C {} impl C as A { - fn G() {} + fn G[self: Self]() {} } fn F() { @@ -116,13 +116,13 @@ import Core; interface A {} interface B { - fn G(); + fn G[self: Self](); } class C {} impl C as A {} impl C as B { - fn G() {} + fn G[self: Self]() {} } fn F() { @@ -164,10 +164,10 @@ import Core; interface A { } interface B { - fn G(); + fn G[self: Self](); } -fn G[T:! A & B](t: T) { +fn H[T:! A & B](t: T) { // CHECK:STDERR: fail_todo_generic_combine.carbon:[[@LINE+4]]:3: error: cannot access member of interface `B` in type `T` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: t.(B.G)(); // CHECK:STDERR: ^~~~~~~ @@ -178,26 +178,26 @@ fn G[T:! A & B](t: T) { class C {} impl C as A {} impl C as B { - fn G() {} + fn G[self: Self]() {} } fn F() { // CHECK:STDERR: fail_todo_generic_combine.carbon:[[@LINE+17]]:3: error: semantics TODO: `impl lookup for a FacetType with more than one interface` [SemanticsTodo] - // CHECK:STDERR: G({} as C); + // CHECK:STDERR: H({} as C); // CHECK:STDERR: ^~~~~~~~~~ // CHECK:STDERR: fail_todo_generic_combine.carbon:[[@LINE-18]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn G[T:! A & B](t: T) { + // CHECK:STDERR: fn H[T:! A & B](t: T) { // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: // CHECK:STDERR: fail_todo_generic_combine.carbon:[[@LINE+10]]:3: error: cannot implicitly convert from `type` to `A & B` [ImplicitAsConversionFailure] - // CHECK:STDERR: G({} as C); + // CHECK:STDERR: H({} as C); // CHECK:STDERR: ^~~~~~~~~~ // CHECK:STDERR: fail_todo_generic_combine.carbon:[[@LINE+7]]:3: note: type `type` does not implement interface `Core.ImplicitAs(A & B)` [MissingImplInMemberAccessNote] - // CHECK:STDERR: G({} as C); + // CHECK:STDERR: H({} as C); // CHECK:STDERR: ^~~~~~~~~~ // CHECK:STDERR: fail_todo_generic_combine.carbon:[[@LINE-28]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn G[T:! A & B](t: T) { + // CHECK:STDERR: fn H[T:! A & B](t: T) { // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: - G({} as C); + H({} as C); } diff --git a/toolchain/check/testdata/impl/compound.carbon b/toolchain/check/testdata/impl/compound.carbon deleted file mode 100644 index 8981aad232583..0000000000000 --- a/toolchain/check/testdata/impl/compound.carbon +++ /dev/null @@ -1,263 +0,0 @@ -// Part of the Carbon Language project, under the Apache License v2.0 with LLVM -// Exceptions. See /LICENSE for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// AUTOUPDATE -// TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/compound.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/compound.carbon - -interface Simple { - fn F(); - fn G[self: Self](); -} - -impl i32 as Simple { - fn F(); - fn G[self: i32](); -} - -fn NonInstanceCall(n: i32) { - n.(Simple.F)(); -} - -fn InstanceCall(n: i32) { - n.(Simple.G)(); -} - -fn NonInstanceCallIndirect(p: i32*) { - p->(Simple.F)(); -} - -fn InstanceCallIndirect(p: i32*) { - p->(Simple.G)(); -} - -// CHECK:STDOUT: --- compound.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Simple.type: type = facet_type <@Simple> [concrete] -// CHECK:STDOUT: %Self.3c9: %Simple.type = bind_symbolic_name Self, 0 [symbolic] -// CHECK:STDOUT: %F.type.e2e: type = fn_type @F.1 [concrete] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %F.df8: %F.type.e2e = struct_value () [concrete] -// CHECK:STDOUT: %Simple.assoc_type: type = assoc_entity_type %Simple.type [concrete] -// CHECK:STDOUT: %assoc0.9ca: %Simple.assoc_type = assoc_entity element0, @Simple.%F.decl [concrete] -// CHECK:STDOUT: %Self.as_type.716: type = facet_access_type %Self.3c9 [symbolic] -// CHECK:STDOUT: %G.type.b60: type = fn_type @G.1 [concrete] -// CHECK:STDOUT: %G.cb0: %G.type.b60 = struct_value () [concrete] -// CHECK:STDOUT: %assoc1: %Simple.assoc_type = assoc_entity element1, @Simple.%G.decl [concrete] -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] -// CHECK:STDOUT: %impl_witness.5b2: = impl_witness (@impl.006.%F.decl, @impl.006.%G.decl) [concrete] -// CHECK:STDOUT: %F.type.758: type = fn_type @F.2 [concrete] -// CHECK:STDOUT: %F.df1: %F.type.758 = struct_value () [concrete] -// CHECK:STDOUT: %G.type.c98: type = fn_type @G.2 [concrete] -// CHECK:STDOUT: %G.e73: %G.type.c98 = struct_value () [concrete] -// CHECK:STDOUT: %Simple.facet: %Simple.type = facet_value %i32, %impl_witness.5b2 [concrete] -// CHECK:STDOUT: %NonInstanceCall.type: type = fn_type @NonInstanceCall [concrete] -// CHECK:STDOUT: %NonInstanceCall: %NonInstanceCall.type = struct_value () [concrete] -// CHECK:STDOUT: %.187: type = fn_type_with_self_type %F.type.e2e, %Simple.facet [concrete] -// CHECK:STDOUT: %InstanceCall.type: type = fn_type @InstanceCall [concrete] -// CHECK:STDOUT: %InstanceCall: %InstanceCall.type = struct_value () [concrete] -// CHECK:STDOUT: %.b73: type = fn_type_with_self_type %G.type.b60, %Simple.facet [concrete] -// CHECK:STDOUT: %ptr: type = ptr_type %i32 [concrete] -// CHECK:STDOUT: %NonInstanceCallIndirect.type: type = fn_type @NonInstanceCallIndirect [concrete] -// CHECK:STDOUT: %NonInstanceCallIndirect: %NonInstanceCallIndirect.type = struct_value () [concrete] -// CHECK:STDOUT: %InstanceCallIndirect.type: type = fn_type @InstanceCallIndirect [concrete] -// CHECK:STDOUT: %InstanceCallIndirect: %InstanceCallIndirect.type = struct_value () [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: .Int = %Core.Int -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Simple = %Simple.decl -// CHECK:STDOUT: .NonInstanceCall = %NonInstanceCall.decl -// CHECK:STDOUT: .InstanceCall = %InstanceCall.decl -// CHECK:STDOUT: .NonInstanceCallIndirect = %NonInstanceCallIndirect.decl -// CHECK:STDOUT: .InstanceCallIndirect = %InstanceCallIndirect.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Simple.decl: type = interface_decl @Simple [concrete = constants.%Simple.type] {} {} -// CHECK:STDOUT: impl_decl @impl.006 [concrete] {} { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [concrete = constants.%Simple.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.006.%F.decl, @impl.006.%G.decl) [concrete = constants.%impl_witness.5b2] -// CHECK:STDOUT: %NonInstanceCall.decl: %NonInstanceCall.type = fn_decl @NonInstanceCall [concrete = constants.%NonInstanceCall] { -// CHECK:STDOUT: %n.patt: %i32 = binding_pattern n -// CHECK:STDOUT: %n.param_patt: %i32 = value_param_pattern %n.patt, runtime_param0 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %n.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc21: type = splice_block %i32 [concrete = constants.%i32] { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %n: %i32 = bind_name n, %n.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %InstanceCall.decl: %InstanceCall.type = fn_decl @InstanceCall [concrete = constants.%InstanceCall] { -// CHECK:STDOUT: %n.patt: %i32 = binding_pattern n -// CHECK:STDOUT: %n.param_patt: %i32 = value_param_pattern %n.patt, runtime_param0 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %n.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc25: type = splice_block %i32 [concrete = constants.%i32] { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %n: %i32 = bind_name n, %n.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %NonInstanceCallIndirect.decl: %NonInstanceCallIndirect.type = fn_decl @NonInstanceCallIndirect [concrete = constants.%NonInstanceCallIndirect] { -// CHECK:STDOUT: %p.patt: %ptr = binding_pattern p -// CHECK:STDOUT: %p.param_patt: %ptr = value_param_pattern %p.patt, runtime_param0 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %p.param: %ptr = value_param runtime_param0 -// CHECK:STDOUT: %.loc29: type = splice_block %ptr [concrete = constants.%ptr] { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %ptr: type = ptr_type %i32 [concrete = constants.%ptr] -// CHECK:STDOUT: } -// CHECK:STDOUT: %p: %ptr = bind_name p, %p.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %InstanceCallIndirect.decl: %InstanceCallIndirect.type = fn_decl @InstanceCallIndirect [concrete = constants.%InstanceCallIndirect] { -// CHECK:STDOUT: %p.patt: %ptr = binding_pattern p -// CHECK:STDOUT: %p.param_patt: %ptr = value_param_pattern %p.patt, runtime_param0 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %p.param: %ptr = value_param runtime_param0 -// CHECK:STDOUT: %.loc33: type = splice_block %ptr [concrete = constants.%ptr] { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %ptr: type = ptr_type %i32 [concrete = constants.%ptr] -// CHECK:STDOUT: } -// CHECK:STDOUT: %p: %ptr = bind_name p, %p.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: interface @Simple { -// CHECK:STDOUT: %Self: %Simple.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.3c9] -// CHECK:STDOUT: %F.decl: %F.type.e2e = fn_decl @F.1 [concrete = constants.%F.df8] {} {} -// CHECK:STDOUT: %assoc0: %Simple.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0.9ca] -// CHECK:STDOUT: %G.decl: %G.type.b60 = fn_decl @G.1 [concrete = constants.%G.cb0] { -// CHECK:STDOUT: %self.patt: @G.1.%Self.as_type.loc13_14.1 (%Self.as_type.716) = binding_pattern self -// CHECK:STDOUT: %self.param_patt: @G.1.%Self.as_type.loc13_14.1 (%Self.as_type.716) = value_param_pattern %self.patt, runtime_param0 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: @G.1.%Self.as_type.loc13_14.1 (%Self.as_type.716) = value_param runtime_param0 -// CHECK:STDOUT: %.loc13_14.1: type = splice_block %.loc13_14.2 [symbolic = %Self.as_type.loc13_14.1 (constants.%Self.as_type.716)] { -// CHECK:STDOUT: %Self.ref: %Simple.type = name_ref Self, @Simple.%Self [symbolic = %Self (constants.%Self.3c9)] -// CHECK:STDOUT: %Self.as_type.loc13_14.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc13_14.1 (constants.%Self.as_type.716)] -// CHECK:STDOUT: %.loc13_14.2: type = converted %Self.ref, %Self.as_type.loc13_14.2 [symbolic = %Self.as_type.loc13_14.1 (constants.%Self.as_type.716)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: @G.1.%Self.as_type.loc13_14.1 (%Self.as_type.716) = bind_name self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %assoc1: %Simple.assoc_type = assoc_entity element1, %G.decl [concrete = constants.%assoc1] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %assoc0 -// CHECK:STDOUT: .G = %assoc1 -// CHECK:STDOUT: witness = (%F.decl, %G.decl) -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: impl @impl.006: %i32 as %Simple.ref { -// CHECK:STDOUT: %F.decl: %F.type.758 = fn_decl @F.2 [concrete = constants.%F.df1] {} {} -// CHECK:STDOUT: %G.decl: %G.type.c98 = fn_decl @G.2 [concrete = constants.%G.e73] { -// CHECK:STDOUT: %self.patt: %i32 = binding_pattern self -// CHECK:STDOUT: %self.param_patt: %i32 = value_param_pattern %self.patt, runtime_param0 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc18: type = splice_block %i32 [concrete = constants.%i32] { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: %i32 = bind_name self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: .G = %G.decl -// CHECK:STDOUT: witness = file.%impl_witness -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F.1(@Simple.%Self: %Simple.type) { -// CHECK:STDOUT: fn(); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @G.1(@Simple.%Self: %Simple.type) { -// CHECK:STDOUT: %Self: %Simple.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.3c9)] -// CHECK:STDOUT: %Self.as_type.loc13_14.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc13_14.1 (constants.%Self.as_type.716)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @G.1.%Self.as_type.loc13_14.1 (%Self.as_type.716)](); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2(); -// CHECK:STDOUT: -// CHECK:STDOUT: fn @G.2[%self.param_patt: %i32](); -// CHECK:STDOUT: -// CHECK:STDOUT: fn @NonInstanceCall(%n.param_patt: %i32) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %n.ref: %i32 = name_ref n, %n -// CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [concrete = constants.%Simple.type] -// CHECK:STDOUT: %F.ref: %Simple.assoc_type = name_ref F, @Simple.%assoc0 [concrete = constants.%assoc0.9ca] -// CHECK:STDOUT: %impl.elem0: %.187 = impl_witness_access constants.%impl_witness.5b2, element0 [concrete = constants.%F.df1] -// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %impl.elem0() -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @InstanceCall(%n.param_patt: %i32) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %n.ref: %i32 = name_ref n, %n -// CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [concrete = constants.%Simple.type] -// CHECK:STDOUT: %G.ref: %Simple.assoc_type = name_ref G, @Simple.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: %impl.elem1: %.b73 = impl_witness_access constants.%impl_witness.5b2, element1 [concrete = constants.%G.e73] -// CHECK:STDOUT: %bound_method: = bound_method %n.ref, %impl.elem1 -// CHECK:STDOUT: %G.call: init %empty_tuple.type = call %bound_method(%n.ref) -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @NonInstanceCallIndirect(%p.param_patt: %ptr) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %p.ref: %ptr = name_ref p, %p -// CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [concrete = constants.%Simple.type] -// CHECK:STDOUT: %F.ref: %Simple.assoc_type = name_ref F, @Simple.%assoc0 [concrete = constants.%assoc0.9ca] -// CHECK:STDOUT: %.loc30: ref %i32 = deref %p.ref -// CHECK:STDOUT: %impl.elem0: %.187 = impl_witness_access constants.%impl_witness.5b2, element0 [concrete = constants.%F.df1] -// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %impl.elem0() -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @InstanceCallIndirect(%p.param_patt: %ptr) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %p.ref: %ptr = name_ref p, %p -// CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [concrete = constants.%Simple.type] -// CHECK:STDOUT: %G.ref: %Simple.assoc_type = name_ref G, @Simple.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: %.loc34_4.1: ref %i32 = deref %p.ref -// CHECK:STDOUT: %impl.elem1: %.b73 = impl_witness_access constants.%impl_witness.5b2, element1 [concrete = constants.%G.e73] -// CHECK:STDOUT: %bound_method: = bound_method %.loc34_4.1, %impl.elem1 -// CHECK:STDOUT: %.loc34_4.2: %i32 = bind_value %.loc34_4.1 -// CHECK:STDOUT: %G.call: init %empty_tuple.type = call %bound_method(%.loc34_4.2) -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%Self.3c9) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @G.1(constants.%Self.3c9) { -// CHECK:STDOUT: %Self => constants.%Self.3c9 -// CHECK:STDOUT: %Self.as_type.loc13_14.1 => constants.%Self.as_type.716 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%Simple.facet) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @G.1(constants.%Simple.facet) { -// CHECK:STDOUT: %Self => constants.%Simple.facet -// CHECK:STDOUT: %Self.as_type.loc13_14.1 => constants.%i32 -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/generic.carbon b/toolchain/check/testdata/impl/lookup/generic.carbon index 6cd6bbdc17357..342f421e4d433 100644 --- a/toolchain/check/testdata/impl/lookup/generic.carbon +++ b/toolchain/check/testdata/impl/lookup/generic.carbon @@ -13,11 +13,11 @@ library "[[@TEST_NAME]]"; interface HasF { - fn F(); + fn F[self: Self](); } impl forall [T:! type] T as HasF { - fn F() {} + fn F[self: Self]() {} } fn G(x: {}) { @@ -45,13 +45,13 @@ fn G(x: {}) -> {} { library "[[@TEST_NAME]]"; interface HasF { - fn F(); + fn F[self: Self](); } class C(T:! type) {} impl forall [T:! type] C(T) as HasF { - fn F() {} + fn F[self: Self]() {} } fn G(x: C({})) { @@ -63,11 +63,11 @@ fn G(x: C({})) { library "[[@TEST_NAME]]"; interface HasF(T:! type) { - fn F(); + fn F[self: Self](); } impl forall [T:! type] {} as HasF(T) { - fn F() {} + fn F[self: Self]() {} } fn G(x: {}) { @@ -79,12 +79,12 @@ fn G(x: {}) { library "[[@TEST_NAME]]"; interface HasF { - fn F(); + fn F[self: Self](); } // TODO: Reject this declaration because U cannot be deduced. impl forall [T:! type, U:! type] T as HasF { - fn F() {} + fn F[self: Self]() {} } fn G(x: {}) { @@ -102,11 +102,11 @@ fn G(x: {}) { library "[[@TEST_NAME]]"; interface HasF(T:! type) { - fn F(); + fn F[self: Self](); } impl forall [T:! type] T as HasF(T) { - fn F() {} + fn F[self: Self]() {} } class A {} @@ -127,6 +127,7 @@ fn G(x: A) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %HasF.type: type = facet_type <@HasF> [concrete] // CHECK:STDOUT: %Self: %HasF.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] // CHECK:STDOUT: %F.type.b7b: type = fn_type @F.1 [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %F.f50: %F.type.b7b = struct_value () [concrete] @@ -138,6 +139,7 @@ fn G(x: A) { // CHECK:STDOUT: %F.type.3fd: type = fn_type @F.2, @impl(%T) [symbolic] // CHECK:STDOUT: %F.c98: %F.type.3fd = struct_value () [symbolic] // CHECK:STDOUT: %HasF.facet.6fc: %HasF.type = facet_value %T, %impl_witness.d55 [symbolic] +// CHECK:STDOUT: %require_complete: = require_complete_type %T [symbolic] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %G.type: type = fn_type @G [concrete] // CHECK:STDOUT: %G: %G.type = struct_value () [concrete] @@ -146,7 +148,7 @@ fn G(x: A) { // CHECK:STDOUT: %F.f13: %F.type.2e4 = struct_value () [concrete] // CHECK:STDOUT: %HasF.facet.18f: %HasF.type = facet_value %empty_struct_type, %impl_witness.d9b [concrete] // CHECK:STDOUT: %.658: type = fn_type_with_self_type %F.type.b7b, %HasF.facet.18f [concrete] -// CHECK:STDOUT: %F.specific_fn: = specific_function %F.f13, @F.2(%empty_struct_type) [concrete] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -189,7 +191,18 @@ fn G(x: A) { // CHECK:STDOUT: // CHECK:STDOUT: interface @HasF { // CHECK:STDOUT: %Self: %HasF.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F.decl: %F.type.b7b = fn_decl @F.1 [concrete = constants.%F.f50] {} {} +// CHECK:STDOUT: %F.decl: %F.type.b7b = fn_decl @F.1 [concrete = constants.%F.f50] { +// CHECK:STDOUT: %self.patt: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc5_14.1: type = splice_block %.loc5_14.2 [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %Self.ref: %HasF.type = name_ref Self, @HasF.%Self [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc5_14.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc5_14.2: type = converted %Self.ref, %Self.as_type.loc5_14.2 [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: %assoc0: %HasF.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -208,7 +221,14 @@ fn G(x: A) { // CHECK:STDOUT: %F: @impl.%F.type (%F.type.3fd) = struct_value () [symbolic = %F (constants.%F.c98)] // CHECK:STDOUT: // CHECK:STDOUT: impl: %T.ref as %HasF.ref { -// CHECK:STDOUT: %F.decl: @impl.%F.type (%F.type.3fd) = fn_decl @F.2 [symbolic = @impl.%F (constants.%F.c98)] {} {} +// CHECK:STDOUT: %F.decl: @impl.%F.type (%F.type.3fd) = fn_decl @F.2 [symbolic = @impl.%F (constants.%F.c98)] { +// CHECK:STDOUT: %self.patt: @F.2.%T (%T) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @F.2.%T (%T) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @F.2.%T (%T) = value_param runtime_param0 +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%T.ref [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %self: @F.2.%T (%T) = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F.decl @@ -217,13 +237,19 @@ fn G(x: A) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.1(@HasF.%Self: %HasF.type) { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %Self: %HasF.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc5_14.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.2(@impl.%T.loc8_14.1: type) { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: // CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @F.2.%T (%T) [symbolic = %require_complete (constants.%require_complete)] // CHECK:STDOUT: -// CHECK:STDOUT: fn() { +// CHECK:STDOUT: fn[%self.param_patt: @F.2.%T (%T)]() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -235,12 +261,16 @@ fn G(x: A) { // CHECK:STDOUT: %HasF.ref: type = name_ref HasF, file.%HasF.decl [concrete = constants.%HasF.type] // CHECK:STDOUT: %F.ref: %HasF.assoc_type = name_ref F, @HasF.%assoc0 [concrete = constants.%assoc0] // CHECK:STDOUT: %impl.elem0: %.658 = impl_witness_access constants.%impl_witness.d9b, element0 [concrete = constants.%F.f13] -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @F.2(constants.%empty_struct_type) [concrete = constants.%F.specific_fn] -// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %specific_fn() +// CHECK:STDOUT: %bound_method: = bound_method %x.ref, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %bound_method, @F.2(constants.%empty_struct_type) +// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %specific_fn(%x.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%Self) {} +// CHECK:STDOUT: specific @F.1(constants.%Self) { +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type.loc5_14.1 => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @impl(constants.%T) { // CHECK:STDOUT: %T.loc8_14.2 => constants.%T @@ -254,9 +284,14 @@ fn G(x: A) { // CHECK:STDOUT: // CHECK:STDOUT: specific @impl(%T.loc8_14.2) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.2(constants.%T) {} +// CHECK:STDOUT: specific @F.2(constants.%T) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%HasF.facet.6fc) {} +// CHECK:STDOUT: specific @F.1(constants.%HasF.facet.6fc) { +// CHECK:STDOUT: %Self => constants.%HasF.facet.6fc +// CHECK:STDOUT: %Self.as_type.loc5_14.1 => constants.%T +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @impl(constants.%empty_struct_type) { // CHECK:STDOUT: %T.loc8_14.2 => constants.%empty_struct_type @@ -269,7 +304,10 @@ fn G(x: A) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F.2(constants.%empty_struct_type) { +// CHECK:STDOUT: %T => constants.%empty_struct_type +// CHECK:STDOUT: // CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- deduced_type_subst.carbon @@ -489,6 +527,7 @@ fn G(x: A) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %HasF.type: type = facet_type <@HasF> [concrete] // CHECK:STDOUT: %Self: %HasF.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] // CHECK:STDOUT: %F.type.b7b: type = fn_type @F.1 [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %F.f50: %F.type.b7b = struct_value () [concrete] @@ -505,6 +544,7 @@ fn G(x: A) { // CHECK:STDOUT: %F.type.8fe: type = fn_type @F.2, @impl(%T) [symbolic] // CHECK:STDOUT: %F.92a: %F.type.8fe = struct_value () [symbolic] // CHECK:STDOUT: %HasF.facet.83b: %HasF.type = facet_value %C.f2e, %impl_witness.7d1 [symbolic] +// CHECK:STDOUT: %require_complete: = require_complete_type %C.f2e [symbolic] // CHECK:STDOUT: %C.7a7: type = class_type @C, @C(%empty_struct_type) [concrete] // CHECK:STDOUT: %G.type: type = fn_type @G [concrete] // CHECK:STDOUT: %G: %G.type = struct_value () [concrete] @@ -513,7 +553,6 @@ fn G(x: A) { // CHECK:STDOUT: %F.c77: %F.type.2e5 = struct_value () [concrete] // CHECK:STDOUT: %HasF.facet.007: %HasF.type = facet_value %C.7a7, %impl_witness.770 [concrete] // CHECK:STDOUT: %.4df: type = fn_type_with_self_type %F.type.b7b, %HasF.facet.007 [concrete] -// CHECK:STDOUT: %F.specific_fn: = specific_function %F.c77, @F.2(%empty_struct_type) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -568,7 +607,18 @@ fn G(x: A) { // CHECK:STDOUT: // CHECK:STDOUT: interface @HasF { // CHECK:STDOUT: %Self: %HasF.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F.decl: %F.type.b7b = fn_decl @F.1 [concrete = constants.%F.f50] {} {} +// CHECK:STDOUT: %F.decl: %F.type.b7b = fn_decl @F.1 [concrete = constants.%F.f50] { +// CHECK:STDOUT: %self.patt: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc5_14.1: type = splice_block %.loc5_14.2 [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %Self.ref: %HasF.type = name_ref Self, @HasF.%Self [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc5_14.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc5_14.2: type = converted %Self.ref, %Self.as_type.loc5_14.2 [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: %assoc0: %HasF.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -588,7 +638,14 @@ fn G(x: A) { // CHECK:STDOUT: %F: @impl.%F.type (%F.type.8fe) = struct_value () [symbolic = %F (constants.%F.92a)] // CHECK:STDOUT: // CHECK:STDOUT: impl: %C.loc10_27.1 as %HasF.ref { -// CHECK:STDOUT: %F.decl: @impl.%F.type (%F.type.8fe) = fn_decl @F.2 [symbolic = @impl.%F (constants.%F.92a)] {} {} +// CHECK:STDOUT: %F.decl: @impl.%F.type (%F.type.8fe) = fn_decl @F.2 [symbolic = @impl.%F (constants.%F.92a)] { +// CHECK:STDOUT: %self.patt: @F.2.%C (%C.f2e) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @F.2.%C (%C.f2e) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @F.2.%C (%C.f2e) = value_param runtime_param0 +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%C.loc10_27.1 [symbolic = %C (constants.%C.f2e)] +// CHECK:STDOUT: %self: @F.2.%C (%C.f2e) = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F.decl @@ -612,13 +669,20 @@ fn G(x: A) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.1(@HasF.%Self: %HasF.type) { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %Self: %HasF.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc5_14.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.2(@impl.%T.loc10_14.1: type) { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %C: type = class_type @C, @C(%T) [symbolic = %C (constants.%C.f2e)] +// CHECK:STDOUT: // CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @F.2.%C (%C.f2e) [symbolic = %require_complete (constants.%require_complete)] // CHECK:STDOUT: -// CHECK:STDOUT: fn() { +// CHECK:STDOUT: fn[%self.param_patt: @F.2.%C (%C.f2e)]() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -630,16 +694,22 @@ fn G(x: A) { // CHECK:STDOUT: %HasF.ref: type = name_ref HasF, file.%HasF.decl [concrete = constants.%HasF.type] // CHECK:STDOUT: %F.ref: %HasF.assoc_type = name_ref F, @HasF.%assoc0 [concrete = constants.%assoc0] // CHECK:STDOUT: %impl.elem0: %.4df = impl_witness_access constants.%impl_witness.770, element0 [concrete = constants.%F.c77] -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @F.2(constants.%empty_struct_type) [concrete = constants.%F.specific_fn] -// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %specific_fn() +// CHECK:STDOUT: %bound_method: = bound_method %x.ref, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %bound_method, @F.2(constants.%empty_struct_type) +// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %specific_fn(%x.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%Self) {} +// CHECK:STDOUT: specific @F.1(constants.%Self) { +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type.loc5_14.1 => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @C(constants.%T) { // CHECK:STDOUT: %T.loc8_9.2 => constants.%T // CHECK:STDOUT: %T.patt.loc8_9.2 => constants.%T +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @impl(constants.%T) { @@ -657,9 +727,17 @@ fn G(x: A) { // CHECK:STDOUT: // CHECK:STDOUT: specific @impl(%T.loc10_14.2) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.2(constants.%T) {} +// CHECK:STDOUT: specific @F.2(constants.%T) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %C => constants.%C.f2e +// CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%HasF.facet.83b) {} +// CHECK:STDOUT: specific @C(@F.2.%T) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @F.1(constants.%HasF.facet.83b) { +// CHECK:STDOUT: %Self => constants.%HasF.facet.83b +// CHECK:STDOUT: %Self.as_type.loc5_14.1 => constants.%C.f2e +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @C(constants.%empty_struct_type) { // CHECK:STDOUT: %T.loc8_9.2 => constants.%empty_struct_type @@ -680,7 +758,11 @@ fn G(x: A) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F.2(constants.%empty_struct_type) { +// CHECK:STDOUT: %T => constants.%empty_struct_type +// CHECK:STDOUT: %C => constants.%C.7a7 +// CHECK:STDOUT: // CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- deduced_interface_argument.carbon @@ -693,6 +775,7 @@ fn G(x: A) { // CHECK:STDOUT: %HasF.generic: %HasF.type.fe3 = struct_value () [concrete] // CHECK:STDOUT: %HasF.type.901: type = facet_type <@HasF, @HasF(%T)> [symbolic] // CHECK:STDOUT: %Self: %HasF.type.901 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] // CHECK:STDOUT: %F.type.46c: type = fn_type @F.1, @HasF(%T) [symbolic] // CHECK:STDOUT: %F.823: %F.type.46c = struct_value () [symbolic] // CHECK:STDOUT: %HasF.assoc_type.595: type = assoc_entity_type %HasF.type.901 [symbolic] @@ -716,7 +799,6 @@ fn G(x: A) { // CHECK:STDOUT: %F.8c6: %F.type.a13 = struct_value () [concrete] // CHECK:STDOUT: %HasF.facet.075: %HasF.type.072 = facet_value %empty_struct_type, %impl_witness.221 [concrete] // CHECK:STDOUT: %.a00: type = fn_type_with_self_type %F.type.b0b, %HasF.facet.075 [concrete] -// CHECK:STDOUT: %F.specific_fn: = specific_function %F.8c6, @F.2(%empty_struct_type) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -776,16 +858,28 @@ fn G(x: A) { // CHECK:STDOUT: %F.type: type = fn_type @F.1, @HasF(%T.loc4_16.2) [symbolic = %F.type (constants.%F.type.46c)] // CHECK:STDOUT: %F: @HasF.%F.type (%F.type.46c) = struct_value () [symbolic = %F (constants.%F.823)] // CHECK:STDOUT: %HasF.assoc_type: type = assoc_entity_type @HasF.%HasF.type (%HasF.type.901) [symbolic = %HasF.assoc_type (constants.%HasF.assoc_type.595)] -// CHECK:STDOUT: %assoc0.loc5_9.2: @HasF.%HasF.assoc_type (%HasF.assoc_type.595) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc5_9.2 (constants.%assoc0.35e)] +// CHECK:STDOUT: %assoc0.loc5_21.2: @HasF.%HasF.assoc_type (%HasF.assoc_type.595) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc5_21.2 (constants.%assoc0.35e)] // CHECK:STDOUT: // CHECK:STDOUT: interface { // CHECK:STDOUT: %Self.1: @HasF.%HasF.type (%HasF.type.901) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %F.decl: @HasF.%F.type (%F.type.46c) = fn_decl @F.1 [symbolic = @HasF.%F (constants.%F.823)] {} {} -// CHECK:STDOUT: %assoc0.loc5_9.1: @HasF.%HasF.assoc_type (%HasF.assoc_type.595) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc5_9.2 (constants.%assoc0.35e)] +// CHECK:STDOUT: %F.decl: @HasF.%F.type (%F.type.46c) = fn_decl @F.1 [symbolic = @HasF.%F (constants.%F.823)] { +// CHECK:STDOUT: %self.patt: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc5_14.1: type = splice_block %.loc5_14.3 [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %.loc5_14.2: @F.1.%HasF.type (%HasF.type.901) = specific_constant @HasF.%Self.1, @HasF(constants.%T) [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.ref: @F.1.%HasF.type (%HasF.type.901) = name_ref Self, %.loc5_14.2 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc5_14.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc5_14.3: type = converted %Self.ref, %Self.as_type.loc5_14.2 [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc5_21.1: @HasF.%HasF.assoc_type (%HasF.assoc_type.595) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc5_21.2 (constants.%assoc0.35e)] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .F = %assoc0.loc5_9.1 +// CHECK:STDOUT: .F = %assoc0.loc5_21.1 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -802,7 +896,14 @@ fn G(x: A) { // CHECK:STDOUT: %F: @impl.%F.type (%F.type.6c8) = struct_value () [symbolic = %F (constants.%F.008)] // CHECK:STDOUT: // CHECK:STDOUT: impl: %.loc8_25.2 as %HasF.type.loc8_36.1 { -// CHECK:STDOUT: %F.decl: @impl.%F.type (%F.type.6c8) = fn_decl @F.2 [symbolic = @impl.%F (constants.%F.008)] {} {} +// CHECK:STDOUT: %F.decl: @impl.%F.type (%F.type.6c8) = fn_decl @F.2 [symbolic = @impl.%F (constants.%F.008)] { +// CHECK:STDOUT: %self.patt: %empty_struct_type = binding_pattern self +// CHECK:STDOUT: %self.param_patt: %empty_struct_type = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: %empty_struct_type = value_param runtime_param0 +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%.loc8_25.2 [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %self: %empty_struct_type = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F.decl @@ -811,13 +912,18 @@ fn G(x: A) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.1(@HasF.%T.loc4_16.1: type, @HasF.%Self.1: @HasF.%HasF.type (%HasF.type.901)) { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %HasF.type: type = facet_type <@HasF, @HasF(%T)> [symbolic = %HasF.type (constants.%HasF.type.901)] +// CHECK:STDOUT: %Self: %HasF.type.901 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc5_14.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.2(@impl.%T.loc8_14.1: type) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: fn() { +// CHECK:STDOUT: fn[%self.param_patt: %empty_struct_type]() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -830,11 +936,12 @@ fn G(x: A) { // CHECK:STDOUT: %.loc13_12: %empty_struct_type = struct_literal () // CHECK:STDOUT: %.loc13_13: type = converted %.loc13_12, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %HasF.type: type = facet_type <@HasF, @HasF(constants.%empty_struct_type)> [concrete = constants.%HasF.type.072] -// CHECK:STDOUT: %.loc13_14: %HasF.assoc_type.60b = specific_constant @HasF.%assoc0.loc5_9.1, @HasF(constants.%empty_struct_type) [concrete = constants.%assoc0.46d] +// CHECK:STDOUT: %.loc13_14: %HasF.assoc_type.60b = specific_constant @HasF.%assoc0.loc5_21.1, @HasF(constants.%empty_struct_type) [concrete = constants.%assoc0.46d] // CHECK:STDOUT: %F.ref: %HasF.assoc_type.60b = name_ref F, %.loc13_14 [concrete = constants.%assoc0.46d] // CHECK:STDOUT: %impl.elem0: %.a00 = impl_witness_access constants.%impl_witness.221, element0 [concrete = constants.%F.8c6] -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @F.2(constants.%empty_struct_type) [concrete = constants.%F.specific_fn] -// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %specific_fn() +// CHECK:STDOUT: %bound_method: = bound_method %x.ref, %impl.elem0 +// CHECK:STDOUT: %specific_fn: = specific_function %bound_method, @F.2(constants.%empty_struct_type) +// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %specific_fn(%x.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -848,10 +955,17 @@ fn G(x: A) { // CHECK:STDOUT: %F.type => constants.%F.type.46c // CHECK:STDOUT: %F => constants.%F.823 // CHECK:STDOUT: %HasF.assoc_type => constants.%HasF.assoc_type.595 -// CHECK:STDOUT: %assoc0.loc5_9.2 => constants.%assoc0.35e +// CHECK:STDOUT: %assoc0.loc5_21.2 => constants.%assoc0.35e +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @F.1(constants.%T, constants.%Self) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %HasF.type => constants.%HasF.type.901 +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type.loc5_14.1 => constants.%Self.as_type // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%T, constants.%Self) {} +// CHECK:STDOUT: specific @HasF(@F.1.%T) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @HasF(%T.loc4_16.2) {} // CHECK:STDOUT: @@ -873,7 +987,12 @@ fn G(x: A) { // CHECK:STDOUT: // CHECK:STDOUT: specific @F.2(constants.%T) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%T, constants.%HasF.facet.77c) {} +// CHECK:STDOUT: specific @F.1(constants.%T, constants.%HasF.facet.77c) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %HasF.type => constants.%HasF.type.901 +// CHECK:STDOUT: %Self => constants.%HasF.facet.77c +// CHECK:STDOUT: %Self.as_type.loc5_14.1 => constants.%empty_struct_type +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @HasF(constants.%empty_struct_type) { // CHECK:STDOUT: %T.loc4_16.2 => constants.%empty_struct_type @@ -885,7 +1004,7 @@ fn G(x: A) { // CHECK:STDOUT: %F.type => constants.%F.type.b0b // CHECK:STDOUT: %F => constants.%F.418 // CHECK:STDOUT: %HasF.assoc_type => constants.%HasF.assoc_type.60b -// CHECK:STDOUT: %assoc0.loc5_9.2 => constants.%assoc0.46d +// CHECK:STDOUT: %assoc0.loc5_21.2 => constants.%assoc0.46d // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @impl(constants.%empty_struct_type) { @@ -909,6 +1028,7 @@ fn G(x: A) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %HasF.type: type = facet_type <@HasF> [concrete] // CHECK:STDOUT: %Self: %HasF.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] // CHECK:STDOUT: %F.type.b7b: type = fn_type @F.1 [concrete] // CHECK:STDOUT: %F.f50: %F.type.b7b = struct_value () [concrete] // CHECK:STDOUT: %HasF.assoc_type: type = assoc_entity_type %HasF.type [concrete] @@ -921,6 +1041,7 @@ fn G(x: A) { // CHECK:STDOUT: %F.type.56e: type = fn_type @F.2, @impl(%T, %U) [symbolic] // CHECK:STDOUT: %F.9b8: %F.type.56e = struct_value () [symbolic] // CHECK:STDOUT: %HasF.facet: %HasF.type = facet_value %T, %impl_witness [symbolic] +// CHECK:STDOUT: %require_complete: = require_complete_type %T [symbolic] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %G.type: type = fn_type @G [concrete] // CHECK:STDOUT: %G: %G.type = struct_value () [concrete] @@ -970,7 +1091,18 @@ fn G(x: A) { // CHECK:STDOUT: // CHECK:STDOUT: interface @HasF { // CHECK:STDOUT: %Self: %HasF.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F.decl: %F.type.b7b = fn_decl @F.1 [concrete = constants.%F.f50] {} {} +// CHECK:STDOUT: %F.decl: %F.type.b7b = fn_decl @F.1 [concrete = constants.%F.f50] { +// CHECK:STDOUT: %self.patt: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc5_14.1: type = splice_block %.loc5_14.2 [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %Self.ref: %HasF.type = name_ref Self, @HasF.%Self [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc5_14.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc5_14.2: type = converted %Self.ref, %Self.as_type.loc5_14.2 [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: %assoc0: %HasF.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -991,7 +1123,14 @@ fn G(x: A) { // CHECK:STDOUT: %F: @impl.%F.type (%F.type.56e) = struct_value () [symbolic = %F (constants.%F.9b8)] // CHECK:STDOUT: // CHECK:STDOUT: impl: %T.ref as %HasF.ref { -// CHECK:STDOUT: %F.decl: @impl.%F.type (%F.type.56e) = fn_decl @F.2 [symbolic = @impl.%F (constants.%F.9b8)] {} {} +// CHECK:STDOUT: %F.decl: @impl.%F.type (%F.type.56e) = fn_decl @F.2 [symbolic = @impl.%F (constants.%F.9b8)] { +// CHECK:STDOUT: %self.patt: @F.2.%T (%T) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @F.2.%T (%T) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @F.2.%T (%T) = value_param runtime_param0 +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%T.ref [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %self: @F.2.%T (%T) = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F.decl @@ -1000,13 +1139,19 @@ fn G(x: A) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.1(@HasF.%Self: %HasF.type) { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %Self: %HasF.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc5_14.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.2(@impl.%T.loc9_14.1: type, @impl.%U.loc9_24.1: type) { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: // CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @F.2.%T (%T) [symbolic = %require_complete (constants.%require_complete)] // CHECK:STDOUT: -// CHECK:STDOUT: fn() { +// CHECK:STDOUT: fn[%self.param_patt: @F.2.%T (%T)]() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -1020,7 +1165,10 @@ fn G(x: A) { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%Self) {} +// CHECK:STDOUT: specific @F.1(constants.%Self) { +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type.loc5_14.1 => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @impl(constants.%T, constants.%U) { // CHECK:STDOUT: %T.loc9_14.2 => constants.%T @@ -1036,9 +1184,14 @@ fn G(x: A) { // CHECK:STDOUT: // CHECK:STDOUT: specific @impl(%T.loc9_14.2, %U.loc9_24.2) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.2(constants.%T, constants.%U) {} +// CHECK:STDOUT: specific @F.2(constants.%T, constants.%U) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%HasF.facet) {} +// CHECK:STDOUT: specific @F.1(constants.%HasF.facet) { +// CHECK:STDOUT: %Self => constants.%HasF.facet +// CHECK:STDOUT: %Self.as_type.loc5_14.1 => constants.%T +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_inconsistent_deduction.carbon // CHECK:STDOUT: @@ -1049,15 +1202,17 @@ fn G(x: A) { // CHECK:STDOUT: %HasF.generic: %HasF.type.fe3 = struct_value () [concrete] // CHECK:STDOUT: %HasF.type.901: type = facet_type <@HasF, @HasF(%T)> [symbolic] // CHECK:STDOUT: %Self: %HasF.type.901 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] // CHECK:STDOUT: %F.type.46c: type = fn_type @F.1, @HasF(%T) [symbolic] // CHECK:STDOUT: %F.823: %F.type.46c = struct_value () [symbolic] // CHECK:STDOUT: %HasF.assoc_type.595: type = assoc_entity_type %HasF.type.901 [symbolic] // CHECK:STDOUT: %assoc0.35e: %HasF.assoc_type.595 = assoc_entity element0, @HasF.%F.decl [symbolic] -// CHECK:STDOUT: %require_complete: = require_complete_type %HasF.type.901 [symbolic] +// CHECK:STDOUT: %require_complete.03f: = require_complete_type %HasF.type.901 [symbolic] // CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%F.decl), @impl(%T) [symbolic] // CHECK:STDOUT: %F.type.912: type = fn_type @F.2, @impl(%T) [symbolic] // CHECK:STDOUT: %F.f30: %F.type.912 = struct_value () [symbolic] // CHECK:STDOUT: %HasF.facet: %HasF.type.901 = facet_value %T, %impl_witness [symbolic] +// CHECK:STDOUT: %require_complete.4ae: = require_complete_type %T [symbolic] // CHECK:STDOUT: %A: type = class_type @A [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] @@ -1128,16 +1283,28 @@ fn G(x: A) { // CHECK:STDOUT: %F.type: type = fn_type @F.1, @HasF(%T.loc4_16.2) [symbolic = %F.type (constants.%F.type.46c)] // CHECK:STDOUT: %F: @HasF.%F.type (%F.type.46c) = struct_value () [symbolic = %F (constants.%F.823)] // CHECK:STDOUT: %HasF.assoc_type: type = assoc_entity_type @HasF.%HasF.type (%HasF.type.901) [symbolic = %HasF.assoc_type (constants.%HasF.assoc_type.595)] -// CHECK:STDOUT: %assoc0.loc5_9.2: @HasF.%HasF.assoc_type (%HasF.assoc_type.595) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc5_9.2 (constants.%assoc0.35e)] +// CHECK:STDOUT: %assoc0.loc5_21.2: @HasF.%HasF.assoc_type (%HasF.assoc_type.595) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc5_21.2 (constants.%assoc0.35e)] // CHECK:STDOUT: // CHECK:STDOUT: interface { // CHECK:STDOUT: %Self.1: @HasF.%HasF.type (%HasF.type.901) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %F.decl: @HasF.%F.type (%F.type.46c) = fn_decl @F.1 [symbolic = @HasF.%F (constants.%F.823)] {} {} -// CHECK:STDOUT: %assoc0.loc5_9.1: @HasF.%HasF.assoc_type (%HasF.assoc_type.595) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc5_9.2 (constants.%assoc0.35e)] +// CHECK:STDOUT: %F.decl: @HasF.%F.type (%F.type.46c) = fn_decl @F.1 [symbolic = @HasF.%F (constants.%F.823)] { +// CHECK:STDOUT: %self.patt: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc5_14.1: type = splice_block %.loc5_14.3 [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %.loc5_14.2: @F.1.%HasF.type (%HasF.type.901) = specific_constant @HasF.%Self.1, @HasF(constants.%T) [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.ref: @F.1.%HasF.type (%HasF.type.901) = name_ref Self, %.loc5_14.2 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc5_14.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc5_14.3: type = converted %Self.ref, %Self.as_type.loc5_14.2 [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc5_21.1: @HasF.%HasF.assoc_type (%HasF.assoc_type.595) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc5_21.2 (constants.%assoc0.35e)] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .F = %assoc0.loc5_9.1 +// CHECK:STDOUT: .F = %assoc0.loc5_21.1 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -1146,7 +1313,7 @@ fn G(x: A) { // CHECK:STDOUT: %T.loc8_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc8_14.2 (constants.%T)] // CHECK:STDOUT: %T.patt.loc8_14.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_14.2 (constants.%T.patt)] // CHECK:STDOUT: %HasF.type.loc8_35.2: type = facet_type <@HasF, @HasF(%T.loc8_14.2)> [symbolic = %HasF.type.loc8_35.2 (constants.%HasF.type.901)] -// CHECK:STDOUT: %require_complete: = require_complete_type @impl.%HasF.type.loc8_35.2 (%HasF.type.901) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type @impl.%HasF.type.loc8_35.2 (%HasF.type.901) [symbolic = %require_complete (constants.%require_complete.03f)] // CHECK:STDOUT: %impl_witness: = impl_witness (%F.decl), @impl(%T.loc8_14.2) [symbolic = %impl_witness (constants.%impl_witness)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: @@ -1154,7 +1321,14 @@ fn G(x: A) { // CHECK:STDOUT: %F: @impl.%F.type (%F.type.912) = struct_value () [symbolic = %F (constants.%F.f30)] // CHECK:STDOUT: // CHECK:STDOUT: impl: %T.ref.loc8_24 as %HasF.type.loc8_35.1 { -// CHECK:STDOUT: %F.decl: @impl.%F.type (%F.type.912) = fn_decl @F.2 [symbolic = @impl.%F (constants.%F.f30)] {} {} +// CHECK:STDOUT: %F.decl: @impl.%F.type (%F.type.912) = fn_decl @F.2 [symbolic = @impl.%F (constants.%F.f30)] { +// CHECK:STDOUT: %self.patt: @F.2.%T (%T) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @F.2.%T (%T) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @F.2.%T (%T) = value_param runtime_param0 +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%T.ref.loc8_24 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %self: @F.2.%T (%T) = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F.decl @@ -1179,13 +1353,21 @@ fn G(x: A) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.1(@HasF.%T.loc4_16.1: type, @HasF.%Self.1: @HasF.%HasF.type (%HasF.type.901)) { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %HasF.type: type = facet_type <@HasF, @HasF(%T)> [symbolic = %HasF.type (constants.%HasF.type.901)] +// CHECK:STDOUT: %Self: %HasF.type.901 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc5_14.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.2(@impl.%T.loc8_14.1: type) { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: // CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @F.2.%T (%T) [symbolic = %require_complete (constants.%require_complete.4ae)] // CHECK:STDOUT: -// CHECK:STDOUT: fn() { +// CHECK:STDOUT: fn[%self.param_patt: @F.2.%T (%T)]() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -1197,7 +1379,7 @@ fn G(x: A) { // CHECK:STDOUT: %HasF.ref: %HasF.type.fe3 = name_ref HasF, file.%HasF.decl [concrete = constants.%HasF.generic] // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B] // CHECK:STDOUT: %HasF.type: type = facet_type <@HasF, @HasF(constants.%B)> [concrete = constants.%HasF.type.2f5] -// CHECK:STDOUT: %.loc22: %HasF.assoc_type.3e1 = specific_constant @HasF.%assoc0.loc5_9.1, @HasF(constants.%B) [concrete = constants.%assoc0.8ec] +// CHECK:STDOUT: %.loc22: %HasF.assoc_type.3e1 = specific_constant @HasF.%assoc0.loc5_21.1, @HasF(constants.%B) [concrete = constants.%assoc0.8ec] // CHECK:STDOUT: %F.ref: %HasF.assoc_type.3e1 = name_ref F, %.loc22 [concrete = constants.%assoc0.8ec] // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -1212,10 +1394,17 @@ fn G(x: A) { // CHECK:STDOUT: %F.type => constants.%F.type.46c // CHECK:STDOUT: %F => constants.%F.823 // CHECK:STDOUT: %HasF.assoc_type => constants.%HasF.assoc_type.595 -// CHECK:STDOUT: %assoc0.loc5_9.2 => constants.%assoc0.35e +// CHECK:STDOUT: %assoc0.loc5_21.2 => constants.%assoc0.35e +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @F.1(constants.%T, constants.%Self) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %HasF.type => constants.%HasF.type.901 +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type.loc5_14.1 => constants.%Self.as_type // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%T, constants.%Self) {} +// CHECK:STDOUT: specific @HasF(@F.1.%T) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @HasF(%T.loc4_16.2) {} // CHECK:STDOUT: @@ -1223,7 +1412,7 @@ fn G(x: A) { // CHECK:STDOUT: %T.loc8_14.2 => constants.%T // CHECK:STDOUT: %T.patt.loc8_14.2 => constants.%T // CHECK:STDOUT: %HasF.type.loc8_35.2 => constants.%HasF.type.901 -// CHECK:STDOUT: %require_complete => constants.%require_complete +// CHECK:STDOUT: %require_complete => constants.%require_complete.03f // CHECK:STDOUT: %impl_witness => constants.%impl_witness // CHECK:STDOUT: // CHECK:STDOUT: !definition: @@ -1235,9 +1424,16 @@ fn G(x: A) { // CHECK:STDOUT: // CHECK:STDOUT: specific @impl(%T.loc8_14.2) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.2(constants.%T) {} +// CHECK:STDOUT: specific @F.2(constants.%T) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%T, constants.%HasF.facet) {} +// CHECK:STDOUT: specific @F.1(constants.%T, constants.%HasF.facet) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %HasF.type => constants.%HasF.type.901 +// CHECK:STDOUT: %Self => constants.%HasF.facet +// CHECK:STDOUT: %Self.as_type.loc5_14.1 => constants.%T +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @HasF(constants.%B) { // CHECK:STDOUT: %T.loc4_16.2 => constants.%B @@ -1249,6 +1445,6 @@ fn G(x: A) { // CHECK:STDOUT: %F.type => constants.%F.type.1c6 // CHECK:STDOUT: %F => constants.%F.7cf // CHECK:STDOUT: %HasF.assoc_type => constants.%HasF.assoc_type.3e1 -// CHECK:STDOUT: %assoc0.loc5_9.2 => constants.%assoc0.8ec +// CHECK:STDOUT: %assoc0.loc5_21.2 => constants.%assoc0.8ec // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/no_prelude/import.carbon b/toolchain/check/testdata/impl/lookup/no_prelude/import.carbon index ea6196e5b8a19..b329c250680c3 100644 --- a/toolchain/check/testdata/impl/lookup/no_prelude/import.carbon +++ b/toolchain/check/testdata/impl/lookup/no_prelude/import.carbon @@ -13,14 +13,14 @@ package PackageA; interface HasF { - fn F(); + fn F[self: Self](); } class C {} // Same library as the class and interface. impl C as HasF { - fn F() {} + fn F[self: Self]() {} } // --- package_b.carbon @@ -30,24 +30,24 @@ package PackageB; import PackageA; interface HasG { - fn G(); + fn G[self: Self](); } class D {} // Same library as the interface. impl PackageA.C as HasG { - fn G() {} + fn G[self: Self]() {} } // Same library as the class. impl D as PackageA.HasF { - fn F() {} + fn F[self: Self]() {} } // Same library as the class and interface. impl D as HasG { - fn G() {} + fn G[self: Self]() {} } // --- use_cf.carbon @@ -98,11 +98,11 @@ fn TestDG(d: PackageB.D) { package PackageAssociatedInterface; interface Z { - fn H(); + fn H[self: Self](); } impl () as Z { - fn H() {} + fn H[self: Self]() {} } // --- import_associated_interface.carbon @@ -122,7 +122,7 @@ package PackageHasParam; class AnyParam[T:! type](X:! T) {} interface Y { - fn K() {} + fn K[self: Self]() {} } // --- has_generic_interface.carbon @@ -134,7 +134,7 @@ import PackageHasParam; interface GenericInterface(U:! type) {} impl PackageHasParam.AnyParam(GenericInterface) as PackageHasParam.Y { - fn K() {} + fn K[self: Self]() {} } fn L() { @@ -169,10 +169,10 @@ interface Extra7 {} interface Extra8 {} class C(T:! type) {} -interface I { fn F(); } +interface I { fn F[self: Self](); } impl C((Extra1, Extra2, Extra3, Extra4, Extra5, Extra6, Extra7, Extra8)) as I { - fn F() {} + fn F[self: Self]() {} } // --- fail_use_has_extra_interfaces.carbon @@ -195,6 +195,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %HasF.type: type = facet_type <@HasF> [concrete] // CHECK:STDOUT: %Self: %HasF.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] // CHECK:STDOUT: %F.type.b7b: type = fn_type @F.1 [concrete] // CHECK:STDOUT: %F.f50: %F.type.b7b = struct_value () [concrete] // CHECK:STDOUT: %HasF.assoc_type: type = assoc_entity_type %HasF.type [concrete] @@ -224,7 +225,18 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: // CHECK:STDOUT: interface @HasF { // CHECK:STDOUT: %Self: %HasF.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F.decl: %F.type.b7b = fn_decl @F.1 [concrete = constants.%F.f50] {} {} +// CHECK:STDOUT: %F.decl: %F.type.b7b = fn_decl @F.1 [concrete = constants.%F.f50] { +// CHECK:STDOUT: %self.patt: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc5_14.1: type = splice_block %.loc5_14.2 [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %Self.ref: %HasF.type = name_ref Self, @HasF.%Self [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc5_14.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc5_14.2: type = converted %Self.ref, %Self.as_type.loc5_14.2 [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: %assoc0: %HasF.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -234,7 +246,14 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: %C.ref as %HasF.ref { -// CHECK:STDOUT: %F.decl: %F.type.a02 = fn_decl @F.2 [concrete = constants.%F.dc7] {} {} +// CHECK:STDOUT: %F.decl: %F.type.a02 = fn_decl @F.2 [concrete = constants.%F.dc7] { +// CHECK:STDOUT: %self.patt: %C = binding_pattern self +// CHECK:STDOUT: %self.param_patt: %C = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: %C = value_param runtime_param0 +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%C.ref [concrete = constants.%C] +// CHECK:STDOUT: %self: %C = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F.decl @@ -250,23 +269,33 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.1(@HasF.%Self: %HasF.type) { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %Self: %HasF.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc5_14.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @F.1.%Self.as_type.loc5_14.1 (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2() { +// CHECK:STDOUT: fn @F.2[%self.param_patt: %C]() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%Self) {} +// CHECK:STDOUT: specific @F.1(constants.%Self) { +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type.loc5_14.1 => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%HasF.facet) {} +// CHECK:STDOUT: specific @F.1(constants.%HasF.facet) { +// CHECK:STDOUT: %Self => constants.%HasF.facet +// CHECK:STDOUT: %Self.as_type.loc5_14.1 => constants.%C +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- package_b.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %HasG.type: type = facet_type <@HasG> [concrete] // CHECK:STDOUT: %Self.d42: %HasG.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.as_type.133: type = facet_access_type %Self.d42 [symbolic] // CHECK:STDOUT: %G.type.d27: type = fn_type @G.1 [concrete] // CHECK:STDOUT: %G.688: %G.type.d27 = struct_value () [concrete] // CHECK:STDOUT: %HasG.assoc_type: type = assoc_entity_type %HasG.type [concrete] @@ -283,6 +312,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %Self.cf3: %HasF.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %F.type.dbc: type = fn_type @F.1 [concrete] // CHECK:STDOUT: %F.a2b: %F.type.dbc = struct_value () [concrete] +// CHECK:STDOUT: %Self.as_type.7cf: type = facet_access_type %Self.cf3 [symbolic] // CHECK:STDOUT: %impl_witness.a36: = impl_witness (@impl.8af.%F.decl) [concrete] // CHECK:STDOUT: %F.type.bab: type = fn_type @F.2 [concrete] // CHECK:STDOUT: %F.46f: %F.type.bab = struct_value () [concrete] @@ -301,10 +331,10 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: } // CHECK:STDOUT: %PackageA.C: type = import_ref PackageA//default, C, loaded [concrete = constants.%C] // CHECK:STDOUT: %PackageA.import_ref.8f2: = import_ref PackageA//default, loc8_10, loaded [concrete = constants.%complete_type] -// CHECK:STDOUT: %PackageA.import_ref.2c4 = import_ref PackageA//default, inst25 [no loc], unloaded +// CHECK:STDOUT: %PackageA.import_ref.2c4 = import_ref PackageA//default, inst36 [no loc], unloaded // CHECK:STDOUT: %PackageA.HasF: type = import_ref PackageA//default, HasF, loaded [concrete = constants.%HasF.type] // CHECK:STDOUT: %PackageA.import_ref.28c = import_ref PackageA//default, inst15 [no loc], unloaded -// CHECK:STDOUT: %PackageA.import_ref.a2a = import_ref PackageA//default, loc5_9, unloaded +// CHECK:STDOUT: %PackageA.import_ref.a2a = import_ref PackageA//default, loc5_21, unloaded // CHECK:STDOUT: %PackageA.F: %F.type.dbc = import_ref PackageA//default, F, loaded [concrete = constants.%F.a2b] // CHECK:STDOUT: %PackageA.import_ref.e73: %HasF.type = import_ref PackageA//default, inst15 [no loc], loaded [symbolic = constants.%Self.cf3] // CHECK:STDOUT: } @@ -339,7 +369,18 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: // CHECK:STDOUT: interface @HasG { // CHECK:STDOUT: %Self: %HasG.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.d42] -// CHECK:STDOUT: %G.decl: %G.type.d27 = fn_decl @G.1 [concrete = constants.%G.688] {} {} +// CHECK:STDOUT: %G.decl: %G.type.d27 = fn_decl @G.1 [concrete = constants.%G.688] { +// CHECK:STDOUT: %self.patt: @G.1.%Self.as_type.loc7_14.1 (%Self.as_type.133) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @G.1.%Self.as_type.loc7_14.1 (%Self.as_type.133) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @G.1.%Self.as_type.loc7_14.1 (%Self.as_type.133) = value_param runtime_param0 +// CHECK:STDOUT: %.loc7_14.1: type = splice_block %.loc7_14.2 [symbolic = %Self.as_type.loc7_14.1 (constants.%Self.as_type.133)] { +// CHECK:STDOUT: %Self.ref: %HasG.type = name_ref Self, @HasG.%Self [symbolic = %Self (constants.%Self.d42)] +// CHECK:STDOUT: %Self.as_type.loc7_14.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc7_14.1 (constants.%Self.as_type.133)] +// CHECK:STDOUT: %.loc7_14.2: type = converted %Self.ref, %Self.as_type.loc7_14.2 [symbolic = %Self.as_type.loc7_14.1 (constants.%Self.as_type.133)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @G.1.%Self.as_type.loc7_14.1 (%Self.as_type.133) = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: %assoc0: %HasG.assoc_type = assoc_entity element0, %G.decl [concrete = constants.%assoc0] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -356,7 +397,14 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.e95: %C.ref as %HasG.ref { -// CHECK:STDOUT: %G.decl: %G.type.05c = fn_decl @G.2 [concrete = constants.%G.486] {} {} +// CHECK:STDOUT: %G.decl: %G.type.05c = fn_decl @G.2 [concrete = constants.%G.486] { +// CHECK:STDOUT: %self.patt: %C = binding_pattern self +// CHECK:STDOUT: %self.param_patt: %C = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: %C = value_param runtime_param0 +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.e95.%C.ref [concrete = constants.%C] +// CHECK:STDOUT: %self: %C = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .G = %G.decl @@ -364,7 +412,14 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.8af: %D.ref as %HasF.ref { -// CHECK:STDOUT: %F.decl: %F.type.bab = fn_decl @F.2 [concrete = constants.%F.46f] {} {} +// CHECK:STDOUT: %F.decl: %F.type.bab = fn_decl @F.2 [concrete = constants.%F.46f] { +// CHECK:STDOUT: %self.patt: %D = binding_pattern self +// CHECK:STDOUT: %self.param_patt: %D = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: %D = value_param runtime_param0 +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.8af.%D.ref [concrete = constants.%D] +// CHECK:STDOUT: %self: %D = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F.decl @@ -372,7 +427,14 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.da9: %D.ref as %HasG.ref { -// CHECK:STDOUT: %G.decl: %G.type.c1d = fn_decl @G.3 [concrete = constants.%G.294] {} {} +// CHECK:STDOUT: %G.decl: %G.type.c1d = fn_decl @G.3 [concrete = constants.%G.294] { +// CHECK:STDOUT: %self.patt: %D = binding_pattern self +// CHECK:STDOUT: %self.param_patt: %D = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: %D = value_param runtime_param0 +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.da9.%D.ref [concrete = constants.%D] +// CHECK:STDOUT: %self: %D = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .G = %G.decl @@ -395,37 +457,58 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @G.1(@HasG.%Self: %HasG.type) { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %Self: %HasG.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.d42)] +// CHECK:STDOUT: %Self.as_type.loc7_14.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc7_14.1 (constants.%Self.as_type.133)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @G.1.%Self.as_type.loc7_14.1 (%Self.as_type.133)](); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @G.2() { +// CHECK:STDOUT: fn @G.2[%self.param_patt: %C]() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.1(imports.%PackageA.import_ref.e73: %HasF.type) [from "package_a.carbon"] { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %Self: %HasF.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.cf3)] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type.7cf)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @F.1.%Self.as_type (%Self.as_type.7cf)](); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2() { +// CHECK:STDOUT: fn @F.2[%self.param_patt: %D]() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @G.3() { +// CHECK:STDOUT: fn @G.3[%self.param_patt: %D]() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @G.1(constants.%Self.d42) {} +// CHECK:STDOUT: specific @G.1(constants.%Self.d42) { +// CHECK:STDOUT: %Self => constants.%Self.d42 +// CHECK:STDOUT: %Self.as_type.loc7_14.1 => constants.%Self.as_type.133 +// CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @G.1(constants.%HasG.facet.085) {} +// CHECK:STDOUT: specific @G.1(constants.%HasG.facet.085) { +// CHECK:STDOUT: %Self => constants.%HasG.facet.085 +// CHECK:STDOUT: %Self.as_type.loc7_14.1 => constants.%C +// CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%Self.cf3) {} +// CHECK:STDOUT: specific @F.1(constants.%Self.cf3) { +// CHECK:STDOUT: %Self => constants.%Self.cf3 +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type.7cf +// CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%HasF.facet) {} +// CHECK:STDOUT: specific @F.1(constants.%HasF.facet) { +// CHECK:STDOUT: %Self => constants.%HasF.facet +// CHECK:STDOUT: %Self.as_type => constants.%D +// CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @G.1(constants.%HasG.facet.6fc) {} +// CHECK:STDOUT: specific @G.1(constants.%HasG.facet.6fc) { +// CHECK:STDOUT: %Self => constants.%HasG.facet.6fc +// CHECK:STDOUT: %Self.as_type.loc7_14.1 => constants.%D +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- use_cf.carbon // CHECK:STDOUT: @@ -440,8 +523,10 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %Self: %HasF.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %HasF.assoc_type: type = assoc_entity_type %HasF.type [concrete] // CHECK:STDOUT: %assoc0: %HasF.assoc_type = assoc_entity element0, imports.%PackageA.import_ref.ab2 [concrete] -// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%PackageA.import_ref.148) [concrete] // CHECK:STDOUT: %F.type.dbc: type = fn_type @F.1 [concrete] +// CHECK:STDOUT: %F.a2b: %F.type.dbc = struct_value () [concrete] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] +// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%PackageA.import_ref.148) [concrete] // CHECK:STDOUT: %HasF.facet: %HasF.type = facet_value %C, %impl_witness [concrete] // CHECK:STDOUT: %.e6d: type = fn_type_with_self_type %F.type.dbc, %HasF.facet [concrete] // CHECK:STDOUT: %F.type.4e3: type = fn_type @F.2 [concrete] @@ -456,15 +541,15 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: } // CHECK:STDOUT: %PackageA.C: type = import_ref PackageA//default, C, loaded [concrete = constants.%C] // CHECK:STDOUT: %PackageA.import_ref.8f2: = import_ref PackageA//default, loc8_10, loaded [concrete = constants.%complete_type] -// CHECK:STDOUT: %PackageA.import_ref.2c4 = import_ref PackageA//default, inst25 [no loc], unloaded +// CHECK:STDOUT: %PackageA.import_ref.2c4 = import_ref PackageA//default, inst36 [no loc], unloaded // CHECK:STDOUT: %PackageA.HasF: type = import_ref PackageA//default, HasF, loaded [concrete = constants.%HasF.type] // CHECK:STDOUT: %PackageA.import_ref.28c = import_ref PackageA//default, inst15 [no loc], unloaded -// CHECK:STDOUT: %PackageA.import_ref.566: %HasF.assoc_type = import_ref PackageA//default, loc5_9, loaded [concrete = constants.%assoc0] -// CHECK:STDOUT: %PackageA.F = import_ref PackageA//default, F, unloaded +// CHECK:STDOUT: %PackageA.import_ref.566: %HasF.assoc_type = import_ref PackageA//default, loc5_21, loaded [concrete = constants.%assoc0] +// CHECK:STDOUT: %PackageA.F: %F.type.dbc = import_ref PackageA//default, F, loaded [concrete = constants.%F.a2b] +// CHECK:STDOUT: %PackageA.import_ref.e73: %HasF.type = import_ref PackageA//default, inst15 [no loc], loaded [symbolic = constants.%Self] // CHECK:STDOUT: %PackageA.import_ref.a71: = import_ref PackageA//default, loc11_16, loaded [concrete = constants.%impl_witness] // CHECK:STDOUT: %PackageA.import_ref.29a: type = import_ref PackageA//default, loc11_6, loaded [concrete = constants.%C] // CHECK:STDOUT: %PackageA.import_ref.e8c: type = import_ref PackageA//default, loc11_11, loaded [concrete = constants.%HasF.type] -// CHECK:STDOUT: %PackageA.import_ref.e73: %HasF.type = import_ref PackageA//default, inst15 [no loc], loaded [symbolic = constants.%Self] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -512,17 +597,24 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %HasF.ref: type = name_ref HasF, imports.%PackageA.HasF [concrete = constants.%HasF.type] // CHECK:STDOUT: %F.ref: %HasF.assoc_type = name_ref F, imports.%PackageA.import_ref.566 [concrete = constants.%assoc0] // CHECK:STDOUT: %impl.elem0: %.e6d = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%F.857] -// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %impl.elem0() +// CHECK:STDOUT: %bound_method: = bound_method %c.ref, %impl.elem0 +// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %bound_method(%c.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.1(imports.%PackageA.import_ref.e73: %HasF.type) [from "package_a.carbon"] { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %Self: %HasF.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] +// 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: @F.1.%Self.as_type (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2() [from "package_a.carbon"]; +// CHECK:STDOUT: fn @F.2[%self.param_patt: %C]() [from "package_a.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%Self) {} +// CHECK:STDOUT: specific @F.1(constants.%Self) { +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- use_df.carbon // CHECK:STDOUT: @@ -537,10 +629,12 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %Self.cf3: %HasF.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %HasF.assoc_type: type = assoc_entity_type %HasF.type [concrete] // CHECK:STDOUT: %assoc0: %HasF.assoc_type = assoc_entity element0, imports.%PackageA.import_ref.ab2 [concrete] +// CHECK:STDOUT: %F.type.dbc: type = fn_type @F.1 [concrete] +// CHECK:STDOUT: %F.a2b: %F.type.dbc = struct_value () [concrete] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.cf3 [symbolic] // CHECK:STDOUT: %C: type = class_type @C [concrete] // CHECK:STDOUT: %HasG.type: type = facet_type <@HasG> [concrete] // CHECK:STDOUT: %impl_witness: = impl_witness (imports.%PackageB.import_ref.0cd) [concrete] -// CHECK:STDOUT: %F.type.dbc: type = fn_type @F.1 [concrete] // CHECK:STDOUT: %HasF.facet: %HasF.type = facet_value %D, %impl_witness [concrete] // CHECK:STDOUT: %.205: type = fn_type_with_self_type %F.type.dbc, %HasF.facet [concrete] // CHECK:STDOUT: %F.type.394: type = fn_type @F.2 [concrete] @@ -558,18 +652,19 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: } // CHECK:STDOUT: %PackageB.D: type = import_ref PackageB//default, D, loaded [concrete = constants.%D] // CHECK:STDOUT: %PackageB.import_ref.8f2: = import_ref PackageB//default, loc10_10, loaded [concrete = constants.%complete_type] -// CHECK:STDOUT: %PackageB.import_ref.cab = import_ref PackageB//default, inst27 [no loc], unloaded +// CHECK:STDOUT: %PackageB.import_ref.cab = import_ref PackageB//default, inst38 [no loc], unloaded // CHECK:STDOUT: %PackageA.HasF: type = import_ref PackageA//default, HasF, loaded [concrete = constants.%HasF.type] // CHECK:STDOUT: %PackageA.import_ref.28c = import_ref PackageA//default, inst15 [no loc], unloaded -// CHECK:STDOUT: %PackageA.import_ref.566: %HasF.assoc_type = import_ref PackageA//default, loc5_9, loaded [concrete = constants.%assoc0] -// CHECK:STDOUT: %PackageA.F = import_ref PackageA//default, F, unloaded +// CHECK:STDOUT: %PackageA.import_ref.566: %HasF.assoc_type = import_ref PackageA//default, loc5_21, loaded [concrete = constants.%assoc0] +// CHECK:STDOUT: %PackageA.F: %F.type.dbc = import_ref PackageA//default, F, loaded [concrete = constants.%F.a2b] +// CHECK:STDOUT: %PackageA.import_ref.e73: %HasF.type = import_ref PackageA//default, inst15 [no loc], loaded [symbolic = constants.%Self.cf3] // CHECK:STDOUT: %PackageA.import_ref.0e8 = import_ref PackageA//default, loc11_16, unloaded // CHECK:STDOUT: %PackageA.import_ref.8f2: = import_ref PackageA//default, loc8_10, loaded [concrete = constants.%complete_type] -// CHECK:STDOUT: %PackageA.import_ref.2c4 = import_ref PackageA//default, inst25 [no loc], unloaded +// CHECK:STDOUT: %PackageA.import_ref.2c4 = import_ref PackageA//default, inst36 [no loc], unloaded // CHECK:STDOUT: %PackageA.import_ref.29a: type = import_ref PackageA//default, loc11_6, loaded [concrete = constants.%C] // CHECK:STDOUT: %PackageA.import_ref.e8c: type = import_ref PackageA//default, loc11_11, loaded [concrete = constants.%HasF.type] // CHECK:STDOUT: %PackageB.import_ref.5d8 = import_ref PackageB//default, inst17 [no loc], unloaded -// CHECK:STDOUT: %PackageB.import_ref.ed7 = import_ref PackageB//default, loc7_9, unloaded +// CHECK:STDOUT: %PackageB.import_ref.ed7 = import_ref PackageB//default, loc7_21, unloaded // CHECK:STDOUT: %PackageB.G = import_ref PackageB//default, G, unloaded // CHECK:STDOUT: %PackageB.import_ref.fa0 = import_ref PackageB//default, loc13_25, unloaded // CHECK:STDOUT: %PackageB.import_ref.dfb: type = import_ref PackageB//default, loc13_14, loaded [concrete = constants.%C] @@ -580,7 +675,6 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %PackageB.import_ref.231 = import_ref PackageB//default, loc23_16, unloaded // CHECK:STDOUT: %PackageB.import_ref.aa9f8a.2: type = import_ref PackageB//default, loc23_6, loaded [concrete = constants.%D] // CHECK:STDOUT: %PackageB.import_ref.cee586.2: type = import_ref PackageB//default, loc23_11, loaded [concrete = constants.%HasG.type] -// CHECK:STDOUT: %PackageA.import_ref.e73: %HasF.type = import_ref PackageA//default, inst15 [no loc], loaded [symbolic = constants.%Self.cf3] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -659,17 +753,24 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %HasF.ref: type = name_ref HasF, imports.%PackageA.HasF [concrete = constants.%HasF.type] // CHECK:STDOUT: %F.ref: %HasF.assoc_type = name_ref F, imports.%PackageA.import_ref.566 [concrete = constants.%assoc0] // CHECK:STDOUT: %impl.elem0: %.205 = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%F.1fc] -// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %impl.elem0() +// CHECK:STDOUT: %bound_method: = bound_method %d.ref, %impl.elem0 +// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %bound_method(%d.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.1(imports.%PackageA.import_ref.e73: %HasF.type) [from "package_a.carbon"] { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %Self: %HasF.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.cf3)] +// 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: @F.1.%Self.as_type (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2() [from "package_b.carbon"]; +// CHECK:STDOUT: fn @F.2[%self.param_patt: %D]() [from "package_b.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%Self.cf3) {} +// CHECK:STDOUT: specific @F.1(constants.%Self.cf3) { +// CHECK:STDOUT: %Self => constants.%Self.cf3 +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- use_cg.carbon // CHECK:STDOUT: @@ -684,10 +785,12 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %Self.fcb: %HasG.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %HasG.assoc_type: type = assoc_entity_type %HasG.type [concrete] // CHECK:STDOUT: %assoc0: %HasG.assoc_type = assoc_entity element0, imports.%PackageB.import_ref.70a [concrete] +// CHECK:STDOUT: %G.type.d9e: type = fn_type @G.1 [concrete] +// CHECK:STDOUT: %G.cd6: %G.type.d9e = struct_value () [concrete] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.fcb [symbolic] // CHECK:STDOUT: %HasF.type: type = facet_type <@HasF> [concrete] // CHECK:STDOUT: %D: type = class_type @D [concrete] // CHECK:STDOUT: %impl_witness: = impl_witness (imports.%PackageB.import_ref.9ec) [concrete] -// CHECK:STDOUT: %G.type.d9e: type = fn_type @G.1 [concrete] // CHECK:STDOUT: %HasG.facet: %HasG.type = facet_value %C, %impl_witness [concrete] // CHECK:STDOUT: %.25a: type = fn_type_with_self_type %G.type.d9e, %HasG.facet [concrete] // CHECK:STDOUT: %G.type.18e: type = fn_type @G.2 [concrete] @@ -705,13 +808,14 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: } // CHECK:STDOUT: %PackageA.C: type = import_ref PackageA//default, C, loaded [concrete = constants.%C] // CHECK:STDOUT: %PackageA.import_ref.8f2: = import_ref PackageA//default, loc8_10, loaded [concrete = constants.%complete_type] -// CHECK:STDOUT: %PackageA.import_ref.2c4 = import_ref PackageA//default, inst25 [no loc], unloaded +// CHECK:STDOUT: %PackageA.import_ref.2c4 = import_ref PackageA//default, inst36 [no loc], unloaded // CHECK:STDOUT: %PackageB.HasG: type = import_ref PackageB//default, HasG, loaded [concrete = constants.%HasG.type] // CHECK:STDOUT: %PackageB.import_ref.5d8 = import_ref PackageB//default, inst17 [no loc], unloaded -// CHECK:STDOUT: %PackageB.import_ref.604: %HasG.assoc_type = import_ref PackageB//default, loc7_9, loaded [concrete = constants.%assoc0] -// CHECK:STDOUT: %PackageB.G = import_ref PackageB//default, G, unloaded +// CHECK:STDOUT: %PackageB.import_ref.604: %HasG.assoc_type = import_ref PackageB//default, loc7_21, loaded [concrete = constants.%assoc0] +// CHECK:STDOUT: %PackageB.G: %G.type.d9e = import_ref PackageB//default, G, loaded [concrete = constants.%G.cd6] +// CHECK:STDOUT: %PackageB.import_ref.ef5: %HasG.type = import_ref PackageB//default, inst17 [no loc], loaded [symbolic = constants.%Self.fcb] // CHECK:STDOUT: %PackageA.import_ref.28c = import_ref PackageA//default, inst15 [no loc], unloaded -// CHECK:STDOUT: %PackageA.import_ref.a2a = import_ref PackageA//default, loc5_9, unloaded +// CHECK:STDOUT: %PackageA.import_ref.a2a = import_ref PackageA//default, loc5_21, unloaded // CHECK:STDOUT: %PackageA.F = import_ref PackageA//default, F, unloaded // CHECK:STDOUT: %PackageA.import_ref.0e8 = import_ref PackageA//default, loc11_16, unloaded // CHECK:STDOUT: %PackageA.import_ref.29a: type = import_ref PackageA//default, loc11_6, loaded [concrete = constants.%C] @@ -721,13 +825,12 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %PackageB.import_ref.cee586.1: type = import_ref PackageB//default, loc13_20, loaded [concrete = constants.%HasG.type] // CHECK:STDOUT: %PackageB.import_ref.7db = import_ref PackageB//default, loc18_25, unloaded // CHECK:STDOUT: %PackageB.import_ref.8f2: = import_ref PackageB//default, loc10_10, loaded [concrete = constants.%complete_type] -// CHECK:STDOUT: %PackageB.import_ref.cab = import_ref PackageB//default, inst27 [no loc], unloaded +// CHECK:STDOUT: %PackageB.import_ref.cab = import_ref PackageB//default, inst38 [no loc], unloaded // CHECK:STDOUT: %PackageB.import_ref.aa9f8a.1: type = import_ref PackageB//default, loc18_6, loaded [concrete = constants.%D] // CHECK:STDOUT: %PackageB.import_ref.831: type = import_ref PackageB//default, loc18_19, loaded [concrete = constants.%HasF.type] // CHECK:STDOUT: %PackageB.import_ref.231 = import_ref PackageB//default, loc23_16, unloaded // CHECK:STDOUT: %PackageB.import_ref.aa9f8a.2: type = import_ref PackageB//default, loc23_6, loaded [concrete = constants.%D] // CHECK:STDOUT: %PackageB.import_ref.cee586.2: type = import_ref PackageB//default, loc23_11, loaded [concrete = constants.%HasG.type] -// CHECK:STDOUT: %PackageB.import_ref.ef5: %HasG.type = import_ref PackageB//default, inst17 [no loc], loaded [symbolic = constants.%Self.fcb] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -806,17 +909,24 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %HasG.ref: type = name_ref HasG, imports.%PackageB.HasG [concrete = constants.%HasG.type] // CHECK:STDOUT: %G.ref: %HasG.assoc_type = name_ref G, imports.%PackageB.import_ref.604 [concrete = constants.%assoc0] // CHECK:STDOUT: %impl.elem0: %.25a = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%G.dbb] -// CHECK:STDOUT: %G.call: init %empty_tuple.type = call %impl.elem0() +// CHECK:STDOUT: %bound_method: = bound_method %c.ref, %impl.elem0 +// CHECK:STDOUT: %G.call: init %empty_tuple.type = call %bound_method(%c.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @G.1(imports.%PackageB.import_ref.ef5: %HasG.type) [from "package_b.carbon"] { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %Self: %HasG.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.fcb)] +// 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: @G.1.%Self.as_type (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @G.2() [from "package_b.carbon"]; +// CHECK:STDOUT: fn @G.2[%self.param_patt: %C]() [from "package_b.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: specific @G.1(constants.%Self.fcb) {} +// CHECK:STDOUT: specific @G.1(constants.%Self.fcb) { +// CHECK:STDOUT: %Self => constants.%Self.fcb +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- use_dg.carbon // CHECK:STDOUT: @@ -831,10 +941,12 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %Self.fcb: %HasG.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %HasG.assoc_type: type = assoc_entity_type %HasG.type [concrete] // CHECK:STDOUT: %assoc0: %HasG.assoc_type = assoc_entity element0, imports.%PackageB.import_ref.70a [concrete] +// CHECK:STDOUT: %G.type.d9e: type = fn_type @G.1 [concrete] +// CHECK:STDOUT: %G.cd6: %G.type.d9e = struct_value () [concrete] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.fcb [symbolic] // CHECK:STDOUT: %C: type = class_type @C [concrete] // CHECK:STDOUT: %HasF.type: type = facet_type <@HasF> [concrete] // CHECK:STDOUT: %impl_witness: = impl_witness (imports.%PackageB.import_ref.b0a) [concrete] -// CHECK:STDOUT: %G.type.d9e: type = fn_type @G.1 [concrete] // CHECK:STDOUT: %HasG.facet: %HasG.type = facet_value %D, %impl_witness [concrete] // CHECK:STDOUT: %.b8e: type = fn_type_with_self_type %G.type.d9e, %HasG.facet [concrete] // CHECK:STDOUT: %G.type.405: type = fn_type @G.2 [concrete] @@ -849,18 +961,19 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: } // CHECK:STDOUT: %PackageB.D: type = import_ref PackageB//default, D, loaded [concrete = constants.%D] // CHECK:STDOUT: %PackageB.import_ref.8f2: = import_ref PackageB//default, loc10_10, loaded [concrete = constants.%complete_type] -// CHECK:STDOUT: %PackageB.import_ref.cab = import_ref PackageB//default, inst27 [no loc], unloaded +// CHECK:STDOUT: %PackageB.import_ref.cab = import_ref PackageB//default, inst38 [no loc], unloaded // CHECK:STDOUT: %PackageB.HasG: type = import_ref PackageB//default, HasG, loaded [concrete = constants.%HasG.type] // CHECK:STDOUT: %PackageB.import_ref.5d8 = import_ref PackageB//default, inst17 [no loc], unloaded -// CHECK:STDOUT: %PackageB.import_ref.604: %HasG.assoc_type = import_ref PackageB//default, loc7_9, loaded [concrete = constants.%assoc0] -// CHECK:STDOUT: %PackageB.G = import_ref PackageB//default, G, unloaded +// CHECK:STDOUT: %PackageB.import_ref.604: %HasG.assoc_type = import_ref PackageB//default, loc7_21, loaded [concrete = constants.%assoc0] +// CHECK:STDOUT: %PackageB.G: %G.type.d9e = import_ref PackageB//default, G, loaded [concrete = constants.%G.cd6] +// CHECK:STDOUT: %PackageB.import_ref.ef5: %HasG.type = import_ref PackageB//default, inst17 [no loc], loaded [symbolic = constants.%Self.fcb] // CHECK:STDOUT: %PackageB.import_ref.fa0 = import_ref PackageB//default, loc13_25, unloaded -// CHECK:STDOUT: %PackageB.import_ref.8db: = import_ref PackageB//default, inst35 [indirect], loaded [concrete = constants.%complete_type] -// CHECK:STDOUT: %PackageB.import_ref.6a9 = import_ref PackageB//default, inst36 [indirect], unloaded +// CHECK:STDOUT: %PackageB.import_ref.8db: = import_ref PackageB//default, inst46 [indirect], loaded [concrete = constants.%complete_type] +// CHECK:STDOUT: %PackageB.import_ref.6a9 = import_ref PackageB//default, inst47 [indirect], unloaded // CHECK:STDOUT: %PackageB.import_ref.dfb: type = import_ref PackageB//default, loc13_14, loaded [concrete = constants.%C] // CHECK:STDOUT: %PackageB.import_ref.cee586.1: type = import_ref PackageB//default, loc13_20, loaded [concrete = constants.%HasG.type] -// CHECK:STDOUT: %PackageB.import_ref.96f = import_ref PackageB//default, inst53 [indirect], unloaded -// CHECK:STDOUT: %PackageB.import_ref.b30 = import_ref PackageB//default, inst54 [indirect], unloaded +// CHECK:STDOUT: %PackageB.import_ref.96f = import_ref PackageB//default, inst70 [indirect], unloaded +// CHECK:STDOUT: %PackageB.import_ref.b30 = import_ref PackageB//default, inst71 [indirect], unloaded // CHECK:STDOUT: %PackageB.F = import_ref PackageB//default, F, unloaded // CHECK:STDOUT: %PackageB.import_ref.7db = import_ref PackageB//default, loc18_25, unloaded // CHECK:STDOUT: %PackageB.import_ref.aa9f8a.1: type = import_ref PackageB//default, loc18_6, loaded [concrete = constants.%D] @@ -868,7 +981,6 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %PackageB.import_ref.240: = import_ref PackageB//default, loc23_16, loaded [concrete = constants.%impl_witness] // CHECK:STDOUT: %PackageB.import_ref.aa9f8a.2: type = import_ref PackageB//default, loc23_6, loaded [concrete = constants.%D] // CHECK:STDOUT: %PackageB.import_ref.cee586.2: type = import_ref PackageB//default, loc23_11, loaded [concrete = constants.%HasG.type] -// CHECK:STDOUT: %PackageB.import_ref.ef5: %HasG.type = import_ref PackageB//default, inst17 [no loc], loaded [symbolic = constants.%Self.fcb] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -940,23 +1052,31 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %HasG.ref: type = name_ref HasG, imports.%PackageB.HasG [concrete = constants.%HasG.type] // CHECK:STDOUT: %G.ref: %HasG.assoc_type = name_ref G, imports.%PackageB.import_ref.604 [concrete = constants.%assoc0] // CHECK:STDOUT: %impl.elem0: %.b8e = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%G.703] -// CHECK:STDOUT: %G.call: init %empty_tuple.type = call %impl.elem0() +// CHECK:STDOUT: %bound_method: = bound_method %d.ref, %impl.elem0 +// CHECK:STDOUT: %G.call: init %empty_tuple.type = call %bound_method(%d.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @G.1(imports.%PackageB.import_ref.ef5: %HasG.type) [from "package_b.carbon"] { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %Self: %HasG.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.fcb)] +// 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: @G.1.%Self.as_type (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @G.2() [from "package_b.carbon"]; +// CHECK:STDOUT: fn @G.2[%self.param_patt: %D]() [from "package_b.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: specific @G.1(constants.%Self.fcb) {} +// CHECK:STDOUT: specific @G.1(constants.%Self.fcb) { +// CHECK:STDOUT: %Self => constants.%Self.fcb +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- associated_interface.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete] // CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] // CHECK:STDOUT: %H.type.474: type = fn_type @H.1 [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %H.c1d: %H.type.474 = struct_value () [concrete] @@ -983,7 +1103,18 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: // CHECK:STDOUT: interface @Z { // CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %H.decl: %H.type.474 = fn_decl @H.1 [concrete = constants.%H.c1d] {} {} +// CHECK:STDOUT: %H.decl: %H.type.474 = fn_decl @H.1 [concrete = constants.%H.c1d] { +// CHECK:STDOUT: %self.patt: @H.1.%Self.as_type.loc5_14.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @H.1.%Self.as_type.loc5_14.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @H.1.%Self.as_type.loc5_14.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc5_14.1: type = splice_block %.loc5_14.2 [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %Self.ref: %Z.type = name_ref Self, @Z.%Self [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc5_14.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc5_14.2: type = converted %Self.ref, %Self.as_type.loc5_14.2 [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @H.1.%Self.as_type.loc5_14.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: %assoc0: %Z.assoc_type = assoc_entity element0, %H.decl [concrete = constants.%assoc0] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -993,7 +1124,14 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: %.loc8_7.2 as %Z.ref { -// CHECK:STDOUT: %H.decl: %H.type.707 = fn_decl @H.2 [concrete = constants.%H.8d7] {} {} +// CHECK:STDOUT: %H.decl: %H.type.707 = fn_decl @H.2 [concrete = constants.%H.8d7] { +// CHECK:STDOUT: %self.patt: %empty_tuple.type = binding_pattern self +// CHECK:STDOUT: %self.param_patt: %empty_tuple.type = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: %empty_tuple.type = value_param runtime_param0 +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%.loc8_7.2 [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %self: %empty_tuple.type = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .H = %H.decl @@ -1001,17 +1139,26 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @H.1(@Z.%Self: %Z.type) { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc5_14.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @H.1.%Self.as_type.loc5_14.1 (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @H.2() { +// CHECK:STDOUT: fn @H.2[%self.param_patt: %empty_tuple.type]() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @H.1(constants.%Self) {} +// CHECK:STDOUT: specific @H.1(constants.%Self) { +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type.loc5_14.1 => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @H.1(constants.%Z.facet) {} +// CHECK:STDOUT: specific @H.1(constants.%Z.facet) { +// CHECK:STDOUT: %Self => constants.%Z.facet +// CHECK:STDOUT: %Self.as_type.loc5_14.1 => constants.%empty_tuple.type +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- import_associated_interface.carbon // CHECK:STDOUT: @@ -1023,12 +1170,15 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %Z.assoc_type: type = assoc_entity_type %Z.type [concrete] // CHECK:STDOUT: %assoc0: %Z.assoc_type = assoc_entity element0, imports.%PackageAssociatedInterface.import_ref.250 [concrete] -// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%PackageAssociatedInterface.import_ref.6d7) [concrete] // CHECK:STDOUT: %H.type.386: type = fn_type @H.1 [concrete] +// CHECK:STDOUT: %H.246: %H.type.386 = struct_value () [concrete] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] +// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%PackageAssociatedInterface.import_ref.6d7) [concrete] // CHECK:STDOUT: %Z.facet: %Z.type = facet_value %empty_tuple.type, %impl_witness [concrete] // CHECK:STDOUT: %.a8b: type = fn_type_with_self_type %H.type.386, %Z.facet [concrete] // CHECK:STDOUT: %H.type.ab3: type = fn_type @H.2 [concrete] // CHECK:STDOUT: %H.c25: %H.type.ab3 = struct_value () [concrete] +// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -1038,12 +1188,12 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: } // CHECK:STDOUT: %PackageAssociatedInterface.Z: type = import_ref PackageAssociatedInterface//default, Z, loaded [concrete = constants.%Z.type] // CHECK:STDOUT: %PackageAssociatedInterface.import_ref.f88 = import_ref PackageAssociatedInterface//default, inst15 [no loc], unloaded -// CHECK:STDOUT: %PackageAssociatedInterface.import_ref.ddc: %Z.assoc_type = import_ref PackageAssociatedInterface//default, loc5_9, loaded [concrete = constants.%assoc0] -// CHECK:STDOUT: %PackageAssociatedInterface.H = import_ref PackageAssociatedInterface//default, H, unloaded +// CHECK:STDOUT: %PackageAssociatedInterface.import_ref.ddc: %Z.assoc_type = import_ref PackageAssociatedInterface//default, loc5_21, loaded [concrete = constants.%assoc0] +// CHECK:STDOUT: %PackageAssociatedInterface.H: %H.type.386 = import_ref PackageAssociatedInterface//default, H, loaded [concrete = constants.%H.246] +// CHECK:STDOUT: %PackageAssociatedInterface.import_ref.d26: %Z.type = import_ref PackageAssociatedInterface//default, inst15 [no loc], loaded [symbolic = constants.%Self] // CHECK:STDOUT: %PackageAssociatedInterface.import_ref.998: = import_ref PackageAssociatedInterface//default, loc8_14, loaded [concrete = constants.%impl_witness] // CHECK:STDOUT: %PackageAssociatedInterface.import_ref.e5c: type = import_ref PackageAssociatedInterface//default, loc8_7, loaded [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %PackageAssociatedInterface.import_ref.df1: type = import_ref PackageAssociatedInterface//default, loc8_12, loaded [concrete = constants.%Z.type] -// CHECK:STDOUT: %PackageAssociatedInterface.import_ref.d26: %Z.type = import_ref PackageAssociatedInterface//default, inst15 [no loc], loaded [symbolic = constants.%Self] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -1069,22 +1219,31 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: // CHECK:STDOUT: fn @J() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc7_4.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %PackageAssociatedInterface.ref: = name_ref PackageAssociatedInterface, imports.%PackageAssociatedInterface [concrete = imports.%PackageAssociatedInterface] // CHECK:STDOUT: %Z.ref: type = name_ref Z, imports.%PackageAssociatedInterface.Z [concrete = constants.%Z.type] // CHECK:STDOUT: %H.ref: %Z.assoc_type = name_ref H, imports.%PackageAssociatedInterface.import_ref.ddc [concrete = constants.%assoc0] // CHECK:STDOUT: %impl.elem0: %.a8b = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%H.c25] -// CHECK:STDOUT: %H.call: init %empty_tuple.type = call %impl.elem0() +// CHECK:STDOUT: %bound_method: = bound_method %.loc7_4.1, %impl.elem0 +// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc7_4.2: %empty_tuple.type = converted %.loc7_4.1, %empty_tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %H.call: init %empty_tuple.type = call %bound_method(%.loc7_4.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @H.1(imports.%PackageAssociatedInterface.import_ref.d26: %Z.type) [from "associated_interface.carbon"] { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] +// 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: @H.1.%Self.as_type (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @H.2() [from "associated_interface.carbon"]; +// CHECK:STDOUT: fn @H.2[%self.param_patt: %empty_tuple.type]() [from "associated_interface.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: specific @H.1(constants.%Self) {} +// CHECK:STDOUT: specific @H.1(constants.%Self) { +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- has_param.carbon // CHECK:STDOUT: @@ -1100,10 +1259,12 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete] // CHECK:STDOUT: %Self: %Y.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] // CHECK:STDOUT: %K.type: type = fn_type @K [concrete] // CHECK:STDOUT: %K: %K.type = struct_value () [concrete] // CHECK:STDOUT: %Y.assoc_type: type = assoc_entity_type %Y.type [concrete] // CHECK:STDOUT: %assoc0: %Y.assoc_type = assoc_entity element0, @Y.%K.decl [concrete] +// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -1128,7 +1289,18 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: // CHECK:STDOUT: interface @Y { // CHECK:STDOUT: %Self: %Y.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %K.decl: %K.type = fn_decl @K [concrete = constants.%K] {} {} +// CHECK:STDOUT: %K.decl: %K.type = fn_decl @K [concrete = constants.%K] { +// CHECK:STDOUT: %self.patt: @K.%Self.as_type.loc7_14.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @K.%Self.as_type.loc7_14.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @K.%Self.as_type.loc7_14.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc7_14.1: type = splice_block %.loc7_14.2 [symbolic = %Self.as_type.loc7_14.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %Self.ref: %Y.type = name_ref Self, @Y.%Self [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc7_14.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc7_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc7_14.2: type = converted %Self.ref, %Self.as_type.loc7_14.2 [symbolic = %Self.as_type.loc7_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @K.%Self.as_type.loc7_14.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: %assoc0: %Y.assoc_type = assoc_entity element0, %K.decl [concrete = constants.%assoc0] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -1155,9 +1327,13 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @K(@Y.%Self: %Y.type) { +// CHECK:STDOUT: %Self: %Y.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc7_14.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc7_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: // CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @K.%Self.as_type.loc7_14.1 (%Self.as_type) [symbolic = %require_complete (constants.%require_complete)] // CHECK:STDOUT: -// CHECK:STDOUT: fn() { +// CHECK:STDOUT: fn[%self.param_patt: @K.%Self.as_type.loc7_14.1 (%Self.as_type)]() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -1170,7 +1346,10 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %X.patt.loc4_26.2 => constants.%X // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @K(constants.%Self) {} +// CHECK:STDOUT: specific @K(constants.%Self) { +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type.loc7_14.1 => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- has_generic_interface.carbon // CHECK:STDOUT: @@ -1195,6 +1374,8 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %Self.f64: %Y.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %K.type.311: type = fn_type @K.1 [concrete] // CHECK:STDOUT: %K.7a1: %K.type.311 = struct_value () [concrete] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.f64 [symbolic] +// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type [symbolic] // CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%K.decl) [concrete] // CHECK:STDOUT: %K.type.dcd: type = fn_type @K.2 [concrete] // CHECK:STDOUT: %K.2e9: %K.type.dcd = struct_value () [concrete] @@ -1220,7 +1401,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %PackageHasParam.import_ref.601 = import_ref PackageHasParam//default, inst34 [no loc], unloaded // CHECK:STDOUT: %PackageHasParam.Y: type = import_ref PackageHasParam//default, Y, loaded [concrete = constants.%Y.type] // CHECK:STDOUT: %PackageHasParam.import_ref.dc1 = import_ref PackageHasParam//default, inst40 [no loc], unloaded -// CHECK:STDOUT: %PackageHasParam.import_ref.5e7: %Y.assoc_type = import_ref PackageHasParam//default, loc7_10, loaded [concrete = constants.%assoc0] +// CHECK:STDOUT: %PackageHasParam.import_ref.5e7: %Y.assoc_type = import_ref PackageHasParam//default, loc7_22, loaded [concrete = constants.%assoc0] // CHECK:STDOUT: %PackageHasParam.K: %K.type.311 = import_ref PackageHasParam//default, K, loaded [concrete = constants.%K.7a1] // CHECK:STDOUT: %PackageHasParam.import_ref.292: %Y.type = import_ref PackageHasParam//default, inst40 [no loc], loaded [symbolic = constants.%Self.f64] // CHECK:STDOUT: } @@ -1276,7 +1457,14 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: %AnyParam as %Y.ref { -// CHECK:STDOUT: %K.decl: %K.type.dcd = fn_decl @K.2 [concrete = constants.%K.2e9] {} {} +// CHECK:STDOUT: %K.decl: %K.type.dcd = fn_decl @K.2 [concrete = constants.%K.2e9] { +// CHECK:STDOUT: %self.patt: %AnyParam.241 = binding_pattern self +// CHECK:STDOUT: %self.param_patt: %AnyParam.241 = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: %AnyParam.241 = value_param runtime_param0 +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%AnyParam [concrete = constants.%AnyParam.241] +// CHECK:STDOUT: %self: %AnyParam.241 = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .K = %K.decl @@ -1300,12 +1488,16 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @K.1(imports.%PackageHasParam.import_ref.292: %Y.type) [from "has_param.carbon"] { +// CHECK:STDOUT: %Self: %Y.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.f64)] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type)] +// CHECK:STDOUT: // CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @K.1.%Self.as_type (%Self.as_type) [symbolic = %require_complete (constants.%require_complete)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: fn[%self.param_patt: @K.1.%Self.as_type (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @K.2() { +// CHECK:STDOUT: fn @K.2[%self.param_patt: %AnyParam.241]() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -1333,7 +1525,9 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %Y.ref: type = name_ref Y, imports.%PackageHasParam.Y [concrete = constants.%Y.type] // CHECK:STDOUT: %K.ref: %Y.assoc_type = name_ref K, imports.%PackageHasParam.import_ref.5e7 [concrete = constants.%assoc0] // CHECK:STDOUT: %impl.elem0: %.572 = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%K.2e9] -// CHECK:STDOUT: %K.call: init %empty_tuple.type = call %impl.elem0() +// CHECK:STDOUT: %bound_method: = bound_method %obj.ref, %impl.elem0 +// CHECK:STDOUT: %.loc14: %AnyParam.241 = bind_value %obj.ref +// CHECK:STDOUT: %K.call: init %empty_tuple.type = call %bound_method(%.loc14) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1360,9 +1554,15 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @K.1(constants.%Self.f64) {} +// CHECK:STDOUT: specific @K.1(constants.%Self.f64) { +// CHECK:STDOUT: %Self => constants.%Self.f64 +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @K.1(constants.%Y.facet) {} +// CHECK:STDOUT: specific @K.1(constants.%Y.facet) { +// CHECK:STDOUT: %Self => constants.%Y.facet +// CHECK:STDOUT: %Self.as_type => constants.%AnyParam.241 +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- use_generic_interface_as_param.carbon // CHECK:STDOUT: @@ -1390,8 +1590,11 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %Self.f64: %Y.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %Y.assoc_type: type = assoc_entity_type %Y.type [concrete] // CHECK:STDOUT: %assoc0: %Y.assoc_type = assoc_entity element0, imports.%PackageHasParam.import_ref.ce2 [concrete] -// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%PackageGenericInterface.import_ref.456) [concrete] // CHECK:STDOUT: %K.type.311: type = fn_type @K.1 [concrete] +// CHECK:STDOUT: %K.7a1: %K.type.311 = struct_value () [concrete] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.f64 [symbolic] +// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type [symbolic] +// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%PackageGenericInterface.import_ref.456) [concrete] // CHECK:STDOUT: %Y.facet: %Y.type = facet_value %AnyParam.861, %impl_witness [concrete] // CHECK:STDOUT: %.0fb: type = fn_type_with_self_type %K.type.311, %Y.facet [concrete] // CHECK:STDOUT: %K.type.7f9: type = fn_type @K.2 [concrete] @@ -1418,12 +1621,12 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %PackageGenericInterface.import_ref.c3b = import_ref PackageGenericInterface//default, inst28 [no loc], unloaded // CHECK:STDOUT: %PackageHasParam.Y: type = import_ref PackageHasParam//default, Y, loaded [concrete = constants.%Y.type] // CHECK:STDOUT: %PackageHasParam.import_ref.dc1 = import_ref PackageHasParam//default, inst40 [no loc], unloaded -// CHECK:STDOUT: %PackageHasParam.import_ref.5e7: %Y.assoc_type = import_ref PackageHasParam//default, loc7_10, loaded [concrete = constants.%assoc0] -// CHECK:STDOUT: %PackageHasParam.K = import_ref PackageHasParam//default, K, unloaded +// CHECK:STDOUT: %PackageHasParam.import_ref.5e7: %Y.assoc_type = import_ref PackageHasParam//default, loc7_22, loaded [concrete = constants.%assoc0] +// CHECK:STDOUT: %PackageHasParam.K: %K.type.311 = import_ref PackageHasParam//default, K, loaded [concrete = constants.%K.7a1] +// CHECK:STDOUT: %PackageHasParam.import_ref.292: %Y.type = import_ref PackageHasParam//default, inst40 [no loc], loaded [symbolic = constants.%Self.f64] // CHECK:STDOUT: %PackageGenericInterface.import_ref.ca8: = import_ref PackageGenericInterface//default, loc8_70, loaded [concrete = constants.%impl_witness] // CHECK:STDOUT: %PackageGenericInterface.import_ref.321: type = import_ref PackageGenericInterface//default, loc8_47, loaded [concrete = constants.%AnyParam.861] // CHECK:STDOUT: %PackageGenericInterface.import_ref.ca6: type = import_ref PackageGenericInterface//default, loc8_67, loaded [concrete = constants.%Y.type] -// CHECK:STDOUT: %PackageHasParam.import_ref.292: %Y.type = import_ref PackageHasParam//default, inst40 [no loc], loaded [symbolic = constants.%Self.f64] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -1504,17 +1707,23 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %Y.ref: type = name_ref Y, imports.%PackageHasParam.Y [concrete = constants.%Y.type] // CHECK:STDOUT: %K.ref: %Y.assoc_type = name_ref K, imports.%PackageHasParam.import_ref.5e7 [concrete = constants.%assoc0] // CHECK:STDOUT: %impl.elem0: %.0fb = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%K.c3c] -// CHECK:STDOUT: %K.call: init %empty_tuple.type = call %impl.elem0() +// CHECK:STDOUT: %bound_method: = bound_method %obj.ref, %impl.elem0 +// CHECK:STDOUT: %.loc10: %AnyParam.861 = bind_value %obj.ref +// CHECK:STDOUT: %K.call: init %empty_tuple.type = call %bound_method(%.loc10) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @K.1(imports.%PackageHasParam.import_ref.292: %Y.type) [from "has_param.carbon"] { +// CHECK:STDOUT: %Self: %Y.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.f64)] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type)] +// CHECK:STDOUT: // CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @K.1.%Self.as_type (%Self.as_type) [symbolic = %require_complete (constants.%require_complete)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: fn[%self.param_patt: @K.1.%Self.as_type (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @K.2() [from "has_generic_interface.carbon"]; +// CHECK:STDOUT: fn @K.2[%self.param_patt: %AnyParam.861]() [from "has_generic_interface.carbon"]; // CHECK:STDOUT: // CHECK:STDOUT: specific @AnyParam(constants.%T, constants.%X) { // CHECK:STDOUT: %T => constants.%T @@ -1539,7 +1748,10 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @K.1(constants.%Self.f64) {} +// CHECK:STDOUT: specific @K.1(constants.%Self.f64) { +// CHECK:STDOUT: %Self => constants.%Self.f64 +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- has_extra_interfaces.carbon // CHECK:STDOUT: @@ -1569,6 +1781,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete] // CHECK:STDOUT: %Self.826: %I.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.826 [symbolic] // CHECK:STDOUT: %F.type.cf0: type = fn_type @F.1 [concrete] // CHECK:STDOUT: %F.bc6: %F.type.cf0 = struct_value () [concrete] // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type %I.type [concrete] @@ -1695,7 +1908,18 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.826] -// CHECK:STDOUT: %F.decl: %F.type.cf0 = fn_decl @F.1 [concrete = constants.%F.bc6] {} {} +// CHECK:STDOUT: %F.decl: %F.type.cf0 = fn_decl @F.1 [concrete = constants.%F.bc6] { +// CHECK:STDOUT: %self.patt: @F.1.%Self.as_type.loc14_26.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @F.1.%Self.as_type.loc14_26.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @F.1.%Self.as_type.loc14_26.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc14_26.1: type = splice_block %.loc14_26.2 [symbolic = %Self.as_type.loc14_26.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %Self.ref: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self.826)] +// CHECK:STDOUT: %Self.as_type.loc14_26.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc14_26.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc14_26.2: type = converted %Self.ref, %Self.as_type.loc14_26.2 [symbolic = %Self.as_type.loc14_26.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @F.1.%Self.as_type.loc14_26.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -1705,7 +1929,14 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: %C as %I.ref { -// CHECK:STDOUT: %F.decl: %F.type.06f = fn_decl @F.2 [concrete = constants.%F.13c] {} {} +// CHECK:STDOUT: %F.decl: %F.type.06f = fn_decl @F.2 [concrete = constants.%F.13c] { +// CHECK:STDOUT: %self.patt: %C.69b = binding_pattern self +// CHECK:STDOUT: %self.param_patt: %C.69b = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: %C.69b = value_param runtime_param0 +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%C [concrete = constants.%C.69b] +// CHECK:STDOUT: %self: %C.69b = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F.decl @@ -1728,10 +1959,13 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.1(@I.%Self: %I.type) { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.826)] +// CHECK:STDOUT: %Self.as_type.loc14_26.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc14_26.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @F.1.%Self.as_type.loc14_26.1 (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2() { +// CHECK:STDOUT: fn @F.2[%self.param_patt: %C.69b]() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -1741,14 +1975,22 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %T.patt.loc13_9.2 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%Self.826) {} +// CHECK:STDOUT: specific @F.1(constants.%Self.826) { +// CHECK:STDOUT: %Self => constants.%Self.826 +// CHECK:STDOUT: %Self.as_type.loc14_26.1 => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @C(constants.%tuple.type.15d) { // CHECK:STDOUT: %T.loc13_9.2 => constants.%tuple.type.15d // CHECK:STDOUT: %T.patt.loc13_9.2 => constants.%tuple.type.15d +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%I.facet) {} +// CHECK:STDOUT: specific @F.1(constants.%I.facet) { +// CHECK:STDOUT: %Self => constants.%I.facet +// CHECK:STDOUT: %Self.as_type.loc14_26.1 => constants.%C.69b +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_use_has_extra_interfaces.carbon // CHECK:STDOUT: @@ -1763,8 +2005,12 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %Test.type: type = fn_type @Test [concrete] // CHECK:STDOUT: %Test: %Test.type = struct_value () [concrete] // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete] +// CHECK:STDOUT: %Self.013: %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, imports.%HasExtraInterfaces.import_ref.777 [concrete] +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.013 [symbolic] // CHECK:STDOUT: %Extra8.type: type = facet_type <@Extra8> [concrete] // CHECK:STDOUT: %Extra7.type: type = facet_type <@Extra7> [concrete] // CHECK:STDOUT: %Extra6.type: type = facet_type <@Extra6> [concrete] @@ -1789,8 +2035,9 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %HasExtraInterfaces.import_ref.4c0 = import_ref HasExtraInterfaces//default, inst57 [no loc], unloaded // CHECK:STDOUT: %HasExtraInterfaces.I: type = import_ref HasExtraInterfaces//default, I, loaded [concrete = constants.%I.type] // CHECK:STDOUT: %HasExtraInterfaces.import_ref.e5d = import_ref HasExtraInterfaces//default, inst63 [no loc], unloaded -// CHECK:STDOUT: %HasExtraInterfaces.import_ref.9cd: %I.assoc_type = import_ref HasExtraInterfaces//default, loc14_21, loaded [concrete = constants.%assoc0] -// CHECK:STDOUT: %HasExtraInterfaces.F = import_ref HasExtraInterfaces//default, F, unloaded +// CHECK:STDOUT: %HasExtraInterfaces.import_ref.9cd: %I.assoc_type = import_ref HasExtraInterfaces//default, loc14_33, loaded [concrete = constants.%assoc0] +// CHECK:STDOUT: %HasExtraInterfaces.F: %F.type = import_ref HasExtraInterfaces//default, F, loaded [concrete = constants.%F] +// CHECK:STDOUT: %HasExtraInterfaces.import_ref.1db: %I.type = import_ref HasExtraInterfaces//default, inst63 [no loc], loaded [symbolic = constants.%Self.013] // CHECK:STDOUT: %HasExtraInterfaces.import_ref.1c8 = import_ref HasExtraInterfaces//default, loc16_79, unloaded // CHECK:STDOUT: %HasExtraInterfaces.import_ref.9c8 = import_ref HasExtraInterfaces//default, inst43 [no loc], unloaded // CHECK:STDOUT: %HasExtraInterfaces.import_ref.dfe = import_ref HasExtraInterfaces//default, inst39 [no loc], unloaded @@ -1907,6 +2154,13 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: generic fn @F(imports.%HasExtraInterfaces.import_ref.1db: %I.type) [from "has_extra_interfaces.carbon"] { +// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.013)] +// 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: @F.%Self.as_type (%Self.as_type)](); +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: specific @C(constants.%T) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: %T.patt => constants.%T @@ -1919,8 +2173,15 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: specific @F(constants.%Self.013) { +// CHECK:STDOUT: %Self => constants.%Self.013 +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: specific @C(constants.%tuple.type) { // CHECK:STDOUT: %T => constants.%tuple.type // CHECK:STDOUT: %T.patt => constants.%tuple.type +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/no_prelude/specific_args.carbon b/toolchain/check/testdata/impl/lookup/no_prelude/specific_args.carbon index 3bc0b45ba0c69..13515009d1eb6 100644 --- a/toolchain/check/testdata/impl/lookup/no_prelude/specific_args.carbon +++ b/toolchain/check/testdata/impl/lookup/no_prelude/specific_args.carbon @@ -12,7 +12,7 @@ library "[[@TEST_NAME]]"; -interface I(T:! type) { fn F(); } +interface I(T:! type) { fn F[self: Self](); } class C(T:! type) {} class X {} @@ -24,7 +24,7 @@ import library "types"; class InInterfaceArgs {} -impl X as I(InInterfaceArgs) { fn F() {} } +impl X as I(InInterfaceArgs) { fn F[self: Self]() {} } // --- use_impl_in_interface_args.carbon @@ -41,7 +41,7 @@ import library "types"; class InClassArgs {} -impl C(InClassArgs) as I(X) { fn F() {} } +impl C(InClassArgs) as I(X) { fn F[self: Self]() {} } // --- use_impl_in_class_args.carbon @@ -60,6 +60,7 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: %I.generic: %I.type.dac = struct_value () [concrete] // CHECK:STDOUT: %I.type.325: type = facet_type <@I, @I(%T)> [symbolic] // CHECK:STDOUT: %Self: %I.type.325 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] // CHECK:STDOUT: %F.type: type = fn_type @F, @I(%T) [symbolic] // CHECK:STDOUT: %F: %F.type = struct_value () [symbolic] // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type %I.type.325 [symbolic] @@ -105,16 +106,28 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: %F.type: type = fn_type @F, @I(%T.loc4_13.2) [symbolic = %F.type (constants.%F.type)] // CHECK:STDOUT: %F: @I.%F.type (%F.type) = struct_value () [symbolic = %F (constants.%F)] // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I.%I.type (%I.type.325) [symbolic = %I.assoc_type (constants.%I.assoc_type)] -// CHECK:STDOUT: %assoc0.loc4_31.2: @I.%I.assoc_type (%I.assoc_type) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc4_31.2 (constants.%assoc0)] +// CHECK:STDOUT: %assoc0.loc4_43.2: @I.%I.assoc_type (%I.assoc_type) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc4_43.2 (constants.%assoc0)] // CHECK:STDOUT: // CHECK:STDOUT: interface { // CHECK:STDOUT: %Self.1: @I.%I.type (%I.type.325) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %F.decl: @I.%F.type (%F.type) = fn_decl @F [symbolic = @I.%F (constants.%F)] {} {} -// CHECK:STDOUT: %assoc0.loc4_31.1: @I.%I.assoc_type (%I.assoc_type) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc4_31.2 (constants.%assoc0)] +// CHECK:STDOUT: %F.decl: @I.%F.type (%F.type) = fn_decl @F [symbolic = @I.%F (constants.%F)] { +// CHECK:STDOUT: %self.patt: @F.%Self.as_type.loc4_36.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @F.%Self.as_type.loc4_36.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @F.%Self.as_type.loc4_36.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc4_36.1: type = splice_block %.loc4_36.3 [symbolic = %Self.as_type.loc4_36.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %.loc4_36.2: @F.%I.type (%I.type.325) = specific_constant @I.%Self.1, @I(constants.%T) [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.ref: @F.%I.type (%I.type.325) = name_ref Self, %.loc4_36.2 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc4_36.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc4_36.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc4_36.3: type = converted %Self.ref, %Self.as_type.loc4_36.2 [symbolic = %Self.as_type.loc4_36.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @F.%Self.as_type.loc4_36.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc4_43.1: @I.%I.assoc_type (%I.assoc_type) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc4_43.2 (constants.%assoc0)] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .F = %assoc0.loc4_31.1 +// CHECK:STDOUT: .F = %assoc0.loc4_43.1 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -143,7 +156,12 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F(@I.%T.loc4_13.1: type, @I.%Self.1: @I.%I.type (%I.type.325)) { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T)> [symbolic = %I.type (constants.%I.type.325)] +// CHECK:STDOUT: %Self: %I.type.325 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc4_36.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc4_36.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @F.%Self.as_type.loc4_36.1 (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @I(constants.%T) { @@ -151,7 +169,14 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: %T.patt.loc4_13.2 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F(constants.%T, constants.%Self) {} +// CHECK:STDOUT: specific @F(constants.%T, constants.%Self) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %I.type => constants.%I.type.325 +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type.loc4_36.1 => constants.%Self.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @I(@F.%T) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @I(%T.loc4_13.2) {} // CHECK:STDOUT: @@ -175,6 +200,7 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic] // CHECK:STDOUT: %F.type.2ae: type = fn_type @F.1, @I(%T) [symbolic] // CHECK:STDOUT: %F.bb2: %F.type.2ae = struct_value () [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] // CHECK:STDOUT: %I.assoc_type.955: type = assoc_entity_type %I.type.325 [symbolic] // CHECK:STDOUT: %assoc0.249: %I.assoc_type.955 = assoc_entity element0, imports.%Main.import_ref.479 [symbolic] // CHECK:STDOUT: %I.type.e45: type = facet_type <@I, @I(%InInterfaceArgs)> [concrete] @@ -193,14 +219,14 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: %Main.C = import_ref Main//types, C, unloaded // CHECK:STDOUT: %Main.X: type = import_ref Main//types, X, loaded [concrete = constants.%X] // CHECK:STDOUT: %Main.import_ref.8f2: = import_ref Main//types, loc7_10, loaded [concrete = constants.%complete_type] -// CHECK:STDOUT: %Main.import_ref.acf = import_ref Main//types, inst54 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.acf = import_ref Main//types, inst68 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.f6b058.1: type = import_ref Main//types, loc4_13, loaded [symbolic = @I.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.884 = import_ref Main//types, inst26 [no loc], unloaded -// CHECK:STDOUT: %Main.import_ref.cbe = import_ref Main//types, loc4_31, unloaded +// CHECK:STDOUT: %Main.import_ref.cbe = import_ref Main//types, loc4_43, unloaded // CHECK:STDOUT: %Main.F: @I.%F.type (%F.type.2ae) = import_ref Main//types, F, loaded [symbolic = @I.%F (constants.%F.bb2)] // CHECK:STDOUT: %Main.import_ref.f6b058.2: type = import_ref Main//types, loc4_13, loaded [symbolic = @I.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.38e: @I.%I.type (%I.type.325) = import_ref Main//types, inst26 [no loc], loaded [symbolic = @I.%Self (constants.%Self)] -// CHECK:STDOUT: %Main.import_ref.479 = import_ref Main//types, loc4_31, unloaded +// CHECK:STDOUT: %Main.import_ref.479 = import_ref Main//types, loc4_43, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -242,7 +268,14 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: %X.ref as %I.type { -// CHECK:STDOUT: %F.decl: %F.type.b63 = fn_decl @F.2 [concrete = constants.%F.d5f] {} {} +// CHECK:STDOUT: %F.decl: %F.type.b63 = fn_decl @F.2 [concrete = constants.%F.d5f] { +// CHECK:STDOUT: %self.patt: %X = binding_pattern self +// CHECK:STDOUT: %self.param_patt: %X = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: %X = value_param runtime_param0 +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%X.ref [concrete = constants.%X] +// CHECK:STDOUT: %self: %X = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F.decl @@ -265,10 +298,15 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.1(imports.%Main.import_ref.f6b058.2: type, imports.%Main.import_ref.38e: @I.%I.type (%I.type.325)) [from "types.carbon"] { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T)> [symbolic = %I.type (constants.%I.type.325)] +// CHECK:STDOUT: %Self: %I.type.325 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] +// 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: @F.1.%Self.as_type (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2() { +// CHECK:STDOUT: fn @F.2[%self.param_patt: %X]() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -280,7 +318,14 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: // CHECK:STDOUT: specific @I(%T) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%T, constants.%Self) {} +// CHECK:STDOUT: specific @I(@F.1.%T) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @F.1(constants.%T, constants.%Self) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %I.type => constants.%I.type.325 +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @I(constants.%InInterfaceArgs) { // CHECK:STDOUT: %T => constants.%InInterfaceArgs @@ -295,7 +340,12 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: %assoc0 => constants.%assoc0.055 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%InInterfaceArgs, constants.%I.facet) {} +// CHECK:STDOUT: specific @F.1(constants.%InInterfaceArgs, constants.%I.facet) { +// CHECK:STDOUT: %T => constants.%InInterfaceArgs +// CHECK:STDOUT: %I.type => constants.%I.type.e45 +// CHECK:STDOUT: %Self => constants.%I.facet +// CHECK:STDOUT: %Self.as_type => constants.%X +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- use_impl_in_interface_args.carbon // CHECK:STDOUT: @@ -314,6 +364,7 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic] // CHECK:STDOUT: %F.type.2ae: type = fn_type @F.1, @I(%T) [symbolic] // CHECK:STDOUT: %F.bb2: %F.type.2ae = struct_value () [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] // CHECK:STDOUT: %I.assoc_type.955: type = assoc_entity_type %I.type.325 [symbolic] // CHECK:STDOUT: %assoc0.62c: %I.assoc_type.955 = assoc_entity element0, imports.%Main.import_ref.e54 [symbolic] // CHECK:STDOUT: %InInterfaceArgs: type = class_type @InInterfaceArgs [concrete] @@ -336,14 +387,14 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: %Main.X: type = import_ref Main//types, X, loaded [concrete = constants.%X] // CHECK:STDOUT: %Main.InInterfaceArgs: type = import_ref Main//impl_in_interface_args, InInterfaceArgs, loaded [concrete = constants.%InInterfaceArgs] // CHECK:STDOUT: %Main.import_ref.8f24d3.1: = import_ref Main//types, loc7_10, loaded [concrete = constants.%complete_type] -// CHECK:STDOUT: %Main.import_ref.acf = import_ref Main//types, inst54 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.acf = import_ref Main//types, inst68 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.f6b058.1: type = import_ref Main//types, loc4_13, loaded [symbolic = @I.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.884 = import_ref Main//types, inst26 [no loc], unloaded -// CHECK:STDOUT: %Main.import_ref.cd3: @I.%I.assoc_type (%I.assoc_type.955) = import_ref Main//types, loc4_31, loaded [symbolic = @I.%assoc0 (constants.%assoc0.249)] -// CHECK:STDOUT: %Main.F = import_ref Main//types, F, unloaded +// CHECK:STDOUT: %Main.import_ref.cd3: @I.%I.assoc_type (%I.assoc_type.955) = import_ref Main//types, loc4_43, loaded [symbolic = @I.%assoc0 (constants.%assoc0.249)] +// CHECK:STDOUT: %Main.F: @I.%F.type (%F.type.2ae) = import_ref Main//types, F, loaded [symbolic = @I.%F (constants.%F.bb2)] // CHECK:STDOUT: %Main.import_ref.f6b058.2: type = import_ref Main//types, loc4_13, loaded [symbolic = @I.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.38e: @I.%I.type (%I.type.325) = import_ref Main//types, inst26 [no loc], loaded [symbolic = @I.%Self (constants.%Self)] -// CHECK:STDOUT: %Main.import_ref.e54: @I.%F.type (%F.type.2ae) = import_ref Main//types, loc4_31, loaded [symbolic = @I.%F (constants.%F.bb2)] +// CHECK:STDOUT: %Main.import_ref.e54: @I.%F.type (%F.type.2ae) = import_ref Main//types, loc4_43, loaded [symbolic = @I.%F (constants.%F.bb2)] // CHECK:STDOUT: %Main.import_ref.8f24d3.2: = import_ref Main//impl_in_interface_args, loc5_24, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.bf8 = import_ref Main//impl_in_interface_args, inst18 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.f9f: = import_ref Main//impl_in_interface_args, loc7_30, loaded [concrete = constants.%impl_witness] @@ -418,15 +469,21 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: %.loc6: %I.assoc_type.9f3 = specific_constant imports.%Main.import_ref.cd3, @I(constants.%InInterfaceArgs) [concrete = constants.%assoc0.0fc] // CHECK:STDOUT: %F.ref: %I.assoc_type.9f3 = name_ref F, %.loc6 [concrete = constants.%assoc0.0fc] // CHECK:STDOUT: %impl.elem0: %.e37 = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%F.d5f] -// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %impl.elem0() +// CHECK:STDOUT: %bound_method: = bound_method %x.ref, %impl.elem0 +// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %bound_method(%x.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.1(imports.%Main.import_ref.f6b058.2: type, imports.%Main.import_ref.38e: @I.%I.type (%I.type.325)) [from "types.carbon"] { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T)> [symbolic = %I.type (constants.%I.type.325)] +// CHECK:STDOUT: %Self: %I.type.325 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] +// 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: @F.1.%Self.as_type (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2() [from "impl_in_interface_args.carbon"]; +// CHECK:STDOUT: fn @F.2[%self.param_patt: %X]() [from "impl_in_interface_args.carbon"]; // CHECK:STDOUT: // CHECK:STDOUT: specific @I(constants.%T) { // CHECK:STDOUT: %T => constants.%T @@ -435,7 +492,14 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: // CHECK:STDOUT: specific @I(%T) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%T, constants.%Self) {} +// CHECK:STDOUT: specific @I(@F.1.%T) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @F.1(constants.%T, constants.%Self) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %I.type => constants.%I.type.325 +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @I(constants.%InInterfaceArgs) { // CHECK:STDOUT: %T => constants.%InInterfaceArgs @@ -467,6 +531,7 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: %Self: %I.type.325 = bind_symbolic_name Self, 1 [symbolic] // CHECK:STDOUT: %F.type.2ae: type = fn_type @F.1, @I(%T) [symbolic] // CHECK:STDOUT: %F.bb2: %F.type.2ae = struct_value () [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] // CHECK:STDOUT: %I.assoc_type.955: type = assoc_entity_type %I.type.325 [symbolic] // CHECK:STDOUT: %assoc0.249: %I.assoc_type.955 = assoc_entity element0, imports.%Main.import_ref.479 [symbolic] // CHECK:STDOUT: %X: type = class_type @X [concrete] @@ -487,16 +552,16 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: %Main.X: type = import_ref Main//types, X, loaded [concrete = constants.%X] // CHECK:STDOUT: %Main.import_ref.f6b058.1: type = import_ref Main//types, loc5_9, loaded [symbolic = @C.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.8f24d3.1: = import_ref Main//types, loc5_20, loaded [concrete = constants.%complete_type] -// CHECK:STDOUT: %Main.import_ref.4c0 = import_ref Main//types, inst49 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.4c0 = import_ref Main//types, inst63 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.f6b058.2: type = import_ref Main//types, loc4_13, loaded [symbolic = @I.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.884 = import_ref Main//types, inst26 [no loc], unloaded -// CHECK:STDOUT: %Main.import_ref.cbe = import_ref Main//types, loc4_31, unloaded +// CHECK:STDOUT: %Main.import_ref.cbe = import_ref Main//types, loc4_43, unloaded // CHECK:STDOUT: %Main.F: @I.%F.type (%F.type.2ae) = import_ref Main//types, F, loaded [symbolic = @I.%F (constants.%F.bb2)] // CHECK:STDOUT: %Main.import_ref.f6b058.3: type = import_ref Main//types, loc4_13, loaded [symbolic = @I.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.38e: @I.%I.type (%I.type.325) = import_ref Main//types, inst26 [no loc], loaded [symbolic = @I.%Self (constants.%Self)] -// CHECK:STDOUT: %Main.import_ref.479 = import_ref Main//types, loc4_31, unloaded +// CHECK:STDOUT: %Main.import_ref.479 = import_ref Main//types, loc4_43, unloaded // CHECK:STDOUT: %Main.import_ref.8f24d3.2: = import_ref Main//types, loc7_10, loaded [concrete = constants.%complete_type] -// CHECK:STDOUT: %Main.import_ref.acf = import_ref Main//types, inst54 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.acf = import_ref Main//types, inst68 [no loc], unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -540,7 +605,14 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: %C as %I.type { -// CHECK:STDOUT: %F.decl: %F.type.fab = fn_decl @F.2 [concrete = constants.%F.7ab] {} {} +// CHECK:STDOUT: %F.decl: %F.type.fab = fn_decl @F.2 [concrete = constants.%F.7ab] { +// CHECK:STDOUT: %self.patt: %C.23b = binding_pattern self +// CHECK:STDOUT: %self.param_patt: %C.23b = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: %C.23b = value_param runtime_param0 +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%C [concrete = constants.%C.23b] +// CHECK:STDOUT: %self: %C.23b = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F.decl @@ -577,10 +649,15 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.1(imports.%Main.import_ref.f6b058.3: type, imports.%Main.import_ref.38e: @I.%I.type (%I.type.325)) [from "types.carbon"] { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T)> [symbolic = %I.type (constants.%I.type.325)] +// CHECK:STDOUT: %Self: %I.type.325 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] +// 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: @F.1.%Self.as_type (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2() { +// CHECK:STDOUT: fn @F.2[%self.param_patt: %C.23b]() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -593,6 +670,8 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: specific @C(constants.%InClassArgs) { // CHECK:STDOUT: %T => constants.%InClassArgs // CHECK:STDOUT: %T.patt => constants.%InClassArgs +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @I(constants.%T) { @@ -602,7 +681,14 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: // CHECK:STDOUT: specific @I(%T) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%T, constants.%Self) {} +// CHECK:STDOUT: specific @I(@F.1.%T) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @F.1(constants.%T, constants.%Self) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %I.type => constants.%I.type.325 +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @I(constants.%X) { // CHECK:STDOUT: %T => constants.%X @@ -617,7 +703,12 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: %assoc0 => constants.%assoc0.7c6 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%X, constants.%I.facet) {} +// CHECK:STDOUT: specific @F.1(constants.%X, constants.%I.facet) { +// CHECK:STDOUT: %T => constants.%X +// CHECK:STDOUT: %I.type => constants.%I.type.45c +// CHECK:STDOUT: %Self => constants.%I.facet +// CHECK:STDOUT: %Self.as_type => constants.%C.23b +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- use_impl_in_class_args.carbon // CHECK:STDOUT: @@ -639,6 +730,7 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: %Self: %I.type.325 = bind_symbolic_name Self, 1 [symbolic] // CHECK:STDOUT: %F.type.2ae: type = fn_type @F.1, @I(%T) [symbolic] // CHECK:STDOUT: %F.bb2: %F.type.2ae = struct_value () [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] // CHECK:STDOUT: %I.assoc_type.955: type = assoc_entity_type %I.type.325 [symbolic] // CHECK:STDOUT: %assoc0.62c: %I.assoc_type.955 = assoc_entity element0, imports.%Main.import_ref.e54 [symbolic] // CHECK:STDOUT: %X: type = class_type @X [concrete] @@ -662,18 +754,18 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: %Main.InClassArgs: type = import_ref Main//impl_in_class_args, InClassArgs, loaded [concrete = constants.%InClassArgs] // CHECK:STDOUT: %Main.import_ref.f6b058.1: type = import_ref Main//types, loc5_9, loaded [symbolic = @C.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.8f24d3.1: = import_ref Main//types, loc5_20, loaded [concrete = constants.%complete_type] -// CHECK:STDOUT: %Main.import_ref.4c0 = import_ref Main//types, inst49 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.4c0 = import_ref Main//types, inst63 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.8f24d3.2: = import_ref Main//impl_in_class_args, loc5_20, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.683 = import_ref Main//impl_in_class_args, inst18 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.f6b058.2: type = import_ref Main//types, loc4_13, loaded [symbolic = @I.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.884 = import_ref Main//types, inst26 [no loc], unloaded -// CHECK:STDOUT: %Main.import_ref.cd3: @I.%I.assoc_type (%I.assoc_type.955) = import_ref Main//types, loc4_31, loaded [symbolic = @I.%assoc0 (constants.%assoc0.249)] -// CHECK:STDOUT: %Main.F = import_ref Main//types, F, unloaded +// CHECK:STDOUT: %Main.import_ref.cd3: @I.%I.assoc_type (%I.assoc_type.955) = import_ref Main//types, loc4_43, loaded [symbolic = @I.%assoc0 (constants.%assoc0.249)] +// CHECK:STDOUT: %Main.F: @I.%F.type (%F.type.2ae) = import_ref Main//types, F, loaded [symbolic = @I.%F (constants.%F.bb2)] // CHECK:STDOUT: %Main.import_ref.f6b058.3: type = import_ref Main//types, loc4_13, loaded [symbolic = @I.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.38e: @I.%I.type (%I.type.325) = import_ref Main//types, inst26 [no loc], loaded [symbolic = @I.%Self (constants.%Self)] -// CHECK:STDOUT: %Main.import_ref.e54: @I.%F.type (%F.type.2ae) = import_ref Main//types, loc4_31, loaded [symbolic = @I.%F (constants.%F.bb2)] +// CHECK:STDOUT: %Main.import_ref.e54: @I.%F.type (%F.type.2ae) = import_ref Main//types, loc4_43, loaded [symbolic = @I.%F (constants.%F.bb2)] // CHECK:STDOUT: %Main.import_ref.8f24d3.3: = import_ref Main//types, loc7_10, loaded [concrete = constants.%complete_type] -// CHECK:STDOUT: %Main.import_ref.acf = import_ref Main//types, inst54 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.acf = import_ref Main//types, inst68 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.6de: = import_ref Main//impl_in_class_args, loc7_29, loaded [concrete = constants.%impl_witness] // CHECK:STDOUT: %Main.import_ref.d6e: type = import_ref Main//impl_in_class_args, loc7_19, loaded [concrete = constants.%C.23b] // CHECK:STDOUT: %Main.import_ref.208: type = import_ref Main//impl_in_class_args, loc7_27, loaded [concrete = constants.%I.type.45c] @@ -764,15 +856,21 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: %.loc6_34: %I.assoc_type.a7e = specific_constant imports.%Main.import_ref.cd3, @I(constants.%X) [concrete = constants.%assoc0.ba0] // CHECK:STDOUT: %F.ref: %I.assoc_type.a7e = name_ref F, %.loc6_34 [concrete = constants.%assoc0.ba0] // CHECK:STDOUT: %impl.elem0: %.c87 = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%F.7ab] -// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %impl.elem0() +// CHECK:STDOUT: %bound_method: = bound_method %c.ref, %impl.elem0 +// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %bound_method(%c.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.1(imports.%Main.import_ref.f6b058.3: type, imports.%Main.import_ref.38e: @I.%I.type (%I.type.325)) [from "types.carbon"] { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T)> [symbolic = %I.type (constants.%I.type.325)] +// CHECK:STDOUT: %Self: %I.type.325 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] +// 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: @F.1.%Self.as_type (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2() [from "impl_in_class_args.carbon"]; +// CHECK:STDOUT: fn @F.2[%self.param_patt: %C.23b]() [from "impl_in_class_args.carbon"]; // CHECK:STDOUT: // CHECK:STDOUT: specific @C(constants.%T) { // CHECK:STDOUT: %T => constants.%T @@ -793,7 +891,14 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: // CHECK:STDOUT: specific @I(%T) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%T, constants.%Self) {} +// CHECK:STDOUT: specific @I(@F.1.%T) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @F.1(constants.%T, constants.%Self) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %I.type => constants.%I.type.325 +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @I(constants.%X) { // CHECK:STDOUT: %T => constants.%X diff --git a/toolchain/check/testdata/impl/lookup/transitive.carbon b/toolchain/check/testdata/impl/lookup/transitive.carbon index d659623875316..a26f70464b61a 100644 --- a/toolchain/check/testdata/impl/lookup/transitive.carbon +++ b/toolchain/check/testdata/impl/lookup/transitive.carbon @@ -12,7 +12,7 @@ library "[[@TEST_NAME]]"; -interface I { fn F(); } +interface I { fn F[self: Self](); } // --- c.carbon @@ -21,7 +21,7 @@ library "[[@TEST_NAME]]"; import library "i"; class C {} -impl C as I { fn F() {} } +impl C as I { fn F[self: Self]() {} } // --- get.carbon @@ -48,6 +48,7 @@ fn Call() { // 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: %Self.as_type: type = facet_access_type %Self [symbolic] // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type %I.type [concrete] @@ -72,7 +73,18 @@ fn Call() { // CHECK:STDOUT: // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { +// CHECK:STDOUT: %self.patt: @F.%Self.as_type.loc4_26.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @F.%Self.as_type.loc4_26.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @F.%Self.as_type.loc4_26.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc4_26.1: type = splice_block %.loc4_26.2 [symbolic = %Self.as_type.loc4_26.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %Self.ref: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc4_26.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc4_26.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc4_26.2: type = converted %Self.ref, %Self.as_type.loc4_26.2 [symbolic = %Self.as_type.loc4_26.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @F.%Self.as_type.loc4_26.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -82,10 +94,16 @@ fn Call() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F(@I.%Self: %I.type) { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc4_26.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc4_26.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @F.%Self.as_type.loc4_26.1 (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F(constants.%Self) {} +// CHECK:STDOUT: specific @F(constants.%Self) { +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type.loc4_26.1 => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- c.carbon // CHECK:STDOUT: @@ -97,6 +115,7 @@ fn Call() { // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %F.type.cf0: type = fn_type @F.1 [concrete] // CHECK:STDOUT: %F.bc6: %F.type.cf0 = struct_value () [concrete] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] // CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%F.decl) [concrete] // CHECK:STDOUT: %F.type.5d6: type = fn_type @F.2 [concrete] // CHECK:STDOUT: %F.a2e: %F.type.5d6 = struct_value () [concrete] @@ -110,7 +129,7 @@ fn Call() { // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Main.import_ref.e5d = import_ref Main//i, inst17 [no loc], unloaded -// CHECK:STDOUT: %Main.import_ref.1e0 = import_ref Main//i, loc4_21, unloaded +// CHECK:STDOUT: %Main.import_ref.1e0 = import_ref Main//i, loc4_33, unloaded // CHECK:STDOUT: %Main.F: %F.type.cf0 = import_ref Main//i, F, loaded [concrete = constants.%F.bc6] // CHECK:STDOUT: %Main.import_ref.5dd: %I.type = import_ref Main//i, inst17 [no loc], loaded [symbolic = constants.%Self] // CHECK:STDOUT: } @@ -139,7 +158,14 @@ fn Call() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: %C.ref as %I.ref { -// CHECK:STDOUT: %F.decl: %F.type.5d6 = fn_decl @F.2 [concrete = constants.%F.a2e] {} {} +// CHECK:STDOUT: %F.decl: %F.type.5d6 = fn_decl @F.2 [concrete = constants.%F.a2e] { +// CHECK:STDOUT: %self.patt: %C = binding_pattern self +// CHECK:STDOUT: %self.param_patt: %C = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: %C = value_param runtime_param0 +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%C.ref [concrete = constants.%C] +// CHECK:STDOUT: %self: %C = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F.decl @@ -155,17 +181,26 @@ fn Call() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.1(imports.%Main.import_ref.5dd: %I.type) [from "i.carbon"] { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] +// 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: @F.1.%Self.as_type (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2() { +// CHECK:STDOUT: fn @F.2[%self.param_patt: %C]() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%Self) {} +// CHECK:STDOUT: specific @F.1(constants.%Self) { +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%I.facet) {} +// CHECK:STDOUT: specific @F.1(constants.%I.facet) { +// CHECK:STDOUT: %Self => constants.%I.facet +// CHECK:STDOUT: %Self.as_type => constants.%C +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- get.carbon // CHECK:STDOUT: @@ -229,8 +264,10 @@ fn Call() { // 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, imports.%Main.import_ref.e03 [concrete] -// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%Main.import_ref.742) [concrete] // CHECK:STDOUT: %F.type.cf0: type = fn_type @F.1 [concrete] +// CHECK:STDOUT: %F.bc6: %F.type.cf0 = struct_value () [concrete] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] +// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%Main.import_ref.742) [concrete] // CHECK:STDOUT: %I.facet: %I.type = facet_value %C, %impl_witness [concrete] // CHECK:STDOUT: %.076: type = fn_type_with_self_type %F.type.cf0, %I.facet [concrete] // CHECK:STDOUT: %F.type.5d6: type = fn_type @F.2 [concrete] @@ -247,12 +284,12 @@ fn Call() { // CHECK:STDOUT: %Main.import_ref.8db: = import_ref Main//get, inst21 [indirect], loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.6a9 = import_ref Main//get, inst22 [indirect], unloaded // CHECK:STDOUT: %Main.import_ref.e5d = import_ref Main//i, inst17 [no loc], unloaded -// CHECK:STDOUT: %Main.import_ref.bcb: %I.assoc_type = import_ref Main//i, loc4_21, loaded [concrete = constants.%assoc0] -// CHECK:STDOUT: %Main.F = import_ref Main//i, F, unloaded +// CHECK:STDOUT: %Main.import_ref.bcb: %I.assoc_type = import_ref Main//i, loc4_33, loaded [concrete = constants.%assoc0] +// CHECK:STDOUT: %Main.F: %F.type.cf0 = import_ref Main//i, F, loaded [concrete = constants.%F.bc6] +// CHECK:STDOUT: %Main.import_ref.5dd: %I.type = import_ref Main//i, inst17 [no loc], loaded [symbolic = constants.%Self] // CHECK:STDOUT: %Main.import_ref.e53: = import_ref Main//c, loc7_13, loaded [concrete = constants.%impl_witness] // CHECK:STDOUT: %Main.import_ref.29a: type = import_ref Main//c, loc7_6, loaded [concrete = constants.%C] // CHECK:STDOUT: %Main.import_ref.f50: type = import_ref Main//c, loc7_11, loaded [concrete = constants.%I.type] -// CHECK:STDOUT: %Main.import_ref.5dd: %I.type = import_ref Main//i, inst17 [no loc], loaded [symbolic = constants.%Self] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -289,22 +326,31 @@ fn Call() { // CHECK:STDOUT: fn @Call() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Get.ref: %Get.type = name_ref Get, imports.%Main.Get [concrete = constants.%Get] -// CHECK:STDOUT: %.loc9: ref %C = temporary_storage -// CHECK:STDOUT: %Get.call: init %C = call %Get.ref() to %.loc9 +// CHECK:STDOUT: %.loc9_7.1: ref %C = temporary_storage +// CHECK:STDOUT: %Get.call: init %C = call %Get.ref() to %.loc9_7.1 // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] // CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, imports.%Main.import_ref.bcb [concrete = constants.%assoc0] // CHECK:STDOUT: %impl.elem0: %.076 = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%F.a2e] -// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %impl.elem0() +// CHECK:STDOUT: %bound_method: = bound_method %Get.call, %impl.elem0 +// CHECK:STDOUT: %.loc9_7.2: ref %C = temporary %.loc9_7.1, %Get.call +// CHECK:STDOUT: %.loc9_7.3: %C = bind_value %.loc9_7.2 +// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %bound_method(%.loc9_7.3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Get() -> %C [from "get.carbon"]; // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.1(imports.%Main.import_ref.5dd: %I.type) [from "i.carbon"] { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] +// 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: @F.1.%Self.as_type (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2() [from "c.carbon"]; +// CHECK:STDOUT: fn @F.2[%self.param_patt: %C]() [from "c.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%Self) {} +// CHECK:STDOUT: specific @F.1(constants.%Self) { +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/no_prelude/compound.carbon b/toolchain/check/testdata/impl/no_prelude/compound.carbon new file mode 100644 index 0000000000000..2c43588a95f72 --- /dev/null +++ b/toolchain/check/testdata/impl/no_prelude/compound.carbon @@ -0,0 +1,911 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/no_prelude/compound.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/no_prelude/compound.carbon + +// --- non-instance_success.carbon +library "[[@TEST_NAME]]"; + +interface NonInstance1 { + fn F1(); +} + +impl {.a: ()} as NonInstance1 { + fn F1() {} +} + +fn NonInstanceCall1() { + {.a: ()}.(NonInstance1.F1)(); +} + +// --- core.carbon +package Core; + +interface ImplicitAs(Dest:! type) { + fn Convert[self: Self]() -> Dest; +} + +// --- fail_non-instance.carbon +library "[[@TEST_NAME]]"; + +import Core; + +interface NonInstance2 { + fn F2(); +} + +impl {.b: ()} as NonInstance2 { + fn F2() {} +} + +fn NonInstanceCall2(n: {.b: ()}) { + // CHECK:STDERR: fail_non-instance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `{.b: ()}` to `NonInstance2` [ImplicitAsConversionFailure] + // CHECK:STDERR: n.(NonInstance2.F2)(); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_non-instance.carbon:[[@LINE+4]]:3: note: type `{.b: ()}` does not implement interface `Core.ImplicitAs(NonInstance2)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: n.(NonInstance2.F2)(); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + n.(NonInstance2.F2)(); +} + +// --- fail_non-instance_indirect.carbon +library "[[@TEST_NAME]]"; + +import Core; + +interface NonInstance3 { + fn F3(); +} + +impl {.c: ()} as NonInstance3 { + fn F3() {} +} + +fn NonInstanceCallIndirect(p: {.c: ()}*) { + // CHECK:STDERR: fail_non-instance_indirect.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `{.c: ()}` to `NonInstance3` [ImplicitAsConversionFailure] + // CHECK:STDERR: p->(NonInstance3.F3)(); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_non-instance_indirect.carbon:[[@LINE+4]]:3: note: type `{.c: ()}` does not implement interface `Core.ImplicitAs(NonInstance3)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: p->(NonInstance3.F3)(); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + p->(NonInstance3.F3)(); +} + +// --- instance_success.carbon +library "[[@TEST_NAME]]"; + +interface Instance1 { + fn G1[self: Self](); +} + +impl {.d: ()} as Instance1 { + fn G1[self: Self]() {} +} + +fn InstanceCall(n: {.d: ()}) { + n.(Instance1.G1)(); +} + +fn InstanceCallIndirect(p: {.d: ()}*) { + p->(Instance1.G1)(); +} + +// --- fail_instance.carbon +library "[[@TEST_NAME]]"; + +interface Instance2 { + fn G2[self: Self](); +} + +impl {.e: ()} as Instance2 { + fn G2[self: Self]() {} +} + +fn InstanceCallFail() { + // CHECK:STDERR: fail_instance.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Instance2` in type `type` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: {.e: ()}.(Instance2.G2)(); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + {.e: ()}.(Instance2.G2)(); +} + +// CHECK:STDOUT: --- non-instance_success.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %NonInstance1.type: type = facet_type <@NonInstance1> [concrete] +// CHECK:STDOUT: %Self: %NonInstance1.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %F1.type.163: type = fn_type @F1.1 [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F1.b1f: %F1.type.163 = struct_value () [concrete] +// CHECK:STDOUT: %NonInstance1.assoc_type: type = assoc_entity_type %NonInstance1.type [concrete] +// CHECK:STDOUT: %assoc0: %NonInstance1.assoc_type = assoc_entity element0, @NonInstance1.%F1.decl [concrete] +// CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_tuple.type} [concrete] +// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%F1.decl) [concrete] +// CHECK:STDOUT: %F1.type.d4a: type = fn_type @F1.2 [concrete] +// CHECK:STDOUT: %F1.c75: %F1.type.d4a = struct_value () [concrete] +// CHECK:STDOUT: %NonInstance1.facet: %NonInstance1.type = facet_value %struct_type.a, %impl_witness [concrete] +// CHECK:STDOUT: %NonInstanceCall1.type: type = fn_type @NonInstanceCall1 [concrete] +// CHECK:STDOUT: %NonInstanceCall1: %NonInstanceCall1.type = struct_value () [concrete] +// CHECK:STDOUT: %.a93: type = fn_type_with_self_type %F1.type.163, %NonInstance1.facet [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .NonInstance1 = %NonInstance1.decl +// CHECK:STDOUT: .NonInstanceCall1 = %NonInstanceCall1.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %NonInstance1.decl: type = interface_decl @NonInstance1 [concrete = constants.%NonInstance1.type] {} {} +// CHECK:STDOUT: impl_decl @impl [concrete] {} { +// CHECK:STDOUT: %.loc7_12.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc7_12.2: type = converted %.loc7_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_tuple.type} [concrete = constants.%struct_type.a] +// CHECK:STDOUT: %NonInstance1.ref: type = name_ref NonInstance1, file.%NonInstance1.decl [concrete = constants.%NonInstance1.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%F1.decl) [concrete = constants.%impl_witness] +// CHECK:STDOUT: %NonInstanceCall1.decl: %NonInstanceCall1.type = fn_decl @NonInstanceCall1 [concrete = constants.%NonInstanceCall1] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @NonInstance1 { +// CHECK:STDOUT: %Self: %NonInstance1.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] +// CHECK:STDOUT: %F1.decl: %F1.type.163 = fn_decl @F1.1 [concrete = constants.%F1.b1f] {} {} +// CHECK:STDOUT: %assoc0: %NonInstance1.assoc_type = assoc_entity element0, %F1.decl [concrete = constants.%assoc0] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: .F1 = %assoc0 +// CHECK:STDOUT: witness = (%F1.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl: %struct_type.a as %NonInstance1.ref { +// CHECK:STDOUT: %F1.decl: %F1.type.d4a = fn_decl @F1.2 [concrete = constants.%F1.c75] {} {} +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .F1 = %F1.decl +// CHECK:STDOUT: witness = file.%impl_witness +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @F1.1(@NonInstance1.%Self: %NonInstance1.type) { +// CHECK:STDOUT: fn(); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F1.2() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @NonInstanceCall1() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc12_9.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc12_9.2: type = converted %.loc12_9.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_tuple.type} [concrete = constants.%struct_type.a] +// CHECK:STDOUT: %NonInstance1.ref: type = name_ref NonInstance1, file.%NonInstance1.decl [concrete = constants.%NonInstance1.type] +// CHECK:STDOUT: %F1.ref: %NonInstance1.assoc_type = name_ref F1, @NonInstance1.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %NonInstance1.facet: %NonInstance1.type = facet_value constants.%struct_type.a, constants.%impl_witness [concrete = constants.%NonInstance1.facet] +// CHECK:STDOUT: %.loc12_11: %NonInstance1.type = converted %struct_type.a, %NonInstance1.facet [concrete = constants.%NonInstance1.facet] +// CHECK:STDOUT: %as_wit: = facet_access_witness %.loc12_11 [concrete = constants.%impl_witness] +// CHECK:STDOUT: %impl.elem0: %.a93 = impl_witness_access %as_wit, element0 [concrete = constants.%F1.c75] +// CHECK:STDOUT: %F1.call: init %empty_tuple.type = call %impl.elem0() +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @F1.1(constants.%Self) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @F1.1(constants.%NonInstance1.facet) {} +// CHECK:STDOUT: +// 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.loc3_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: %Dest.param_patt: type = value_param_pattern %Dest.patt.loc3_22.1, runtime_param [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.param: type = value_param runtime_param +// CHECK:STDOUT: %Dest.loc3_22.1: type = bind_symbolic_name Dest, 0, %Dest.param [symbolic = %Dest.loc3_22.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc3_22.1: type) { +// CHECK:STDOUT: %Dest.loc3_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc3_22.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc3_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc3_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.loc3_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.loc4_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc4_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.loc4_20.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: @Convert.%Dest (%Dest) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Convert.%Dest (%Dest) = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc3_22.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc4_20.1: type = splice_block %.loc4_20.3 [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %.loc4_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, %.loc4_20.2 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc4_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc4_20.3: type = converted %Self.ref, %Self.as_type.loc4_20.2 [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.%Dest (%Dest) = out_param runtime_param1 +// CHECK:STDOUT: %return: ref @Convert.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc4_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc4_35.2 (constants.%assoc0)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc4_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert(@ImplicitAs.%Dest.loc3_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.loc4_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type)]() -> @Convert.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc3_22.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc3_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.loc4_20.1 => constants.%Self.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(%Dest.loc3_22.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_non-instance.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %NonInstance2.type: type = facet_type <@NonInstance2> [concrete] +// CHECK:STDOUT: %Self.5a9: %NonInstance2.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %F2.type.608: type = fn_type @F2.1 [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F2.86a: %F2.type.608 = struct_value () [concrete] +// CHECK:STDOUT: %NonInstance2.assoc_type: type = assoc_entity_type %NonInstance2.type [concrete] +// CHECK:STDOUT: %assoc0.97a: %NonInstance2.assoc_type = assoc_entity element0, @NonInstance2.%F2.decl [concrete] +// CHECK:STDOUT: %struct_type.b: type = struct_type {.b: %empty_tuple.type} [concrete] +// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%F2.decl) [concrete] +// CHECK:STDOUT: %F2.type.1ec: type = fn_type @F2.2 [concrete] +// CHECK:STDOUT: %F2.941: %F2.type.1ec = struct_value () [concrete] +// CHECK:STDOUT: %NonInstance2.facet: %NonInstance2.type = facet_value %struct_type.b, %impl_witness [concrete] +// CHECK:STDOUT: %NonInstanceCall2.type: type = fn_type @NonInstanceCall2 [concrete] +// CHECK:STDOUT: %NonInstanceCall2: %NonInstanceCall2.type = struct_value () [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.43db8b.1: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.1 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.c38: type = facet_type <@ImplicitAs, @ImplicitAs(%NonInstance2.type)> [concrete] +// CHECK:STDOUT: %Convert.type.d1f: type = fn_type @Convert, @ImplicitAs(%NonInstance2.type) [concrete] +// CHECK:STDOUT: %Convert.079: %Convert.type.d1f = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.assoc_type.5d3: type = assoc_entity_type %ImplicitAs.type.c38 [concrete] +// CHECK:STDOUT: %assoc0.947: %ImplicitAs.assoc_type.5d3 = assoc_entity element0, imports.%Core.import_ref.207961.1 [concrete] +// CHECK:STDOUT: %assoc0.43db8b.2: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.2 [symbolic] +// CHECK:STDOUT: } +// 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.ffd566.1: type = import_ref Core//default, loc3_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst26 [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.43db8b.2)] +// CHECK:STDOUT: %Core.Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, Convert, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] +// CHECK:STDOUT: %Core.import_ref.ffd566.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, inst26 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] +// CHECK:STDOUT: %Core.import_ref.207961.1 = import_ref Core//default, loc4_35, unloaded +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .NonInstance2 = %NonInstance2.decl +// CHECK:STDOUT: .NonInstanceCall2 = %NonInstanceCall2.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %NonInstance2.decl: type = interface_decl @NonInstance2 [concrete = constants.%NonInstance2.type] {} {} +// CHECK:STDOUT: impl_decl @impl [concrete] {} { +// CHECK:STDOUT: %.loc9_12.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc9_12.2: type = converted %.loc9_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %struct_type.b: type = struct_type {.b: %empty_tuple.type} [concrete = constants.%struct_type.b] +// CHECK:STDOUT: %NonInstance2.ref: type = name_ref NonInstance2, file.%NonInstance2.decl [concrete = constants.%NonInstance2.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%F2.decl) [concrete = constants.%impl_witness] +// CHECK:STDOUT: %NonInstanceCall2.decl: %NonInstanceCall2.type = fn_decl @NonInstanceCall2 [concrete = constants.%NonInstanceCall2] { +// CHECK:STDOUT: %n.patt: %struct_type.b = binding_pattern n +// CHECK:STDOUT: %n.param_patt: %struct_type.b = value_param_pattern %n.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %n.param: %struct_type.b = value_param runtime_param0 +// CHECK:STDOUT: %.loc13_31: type = splice_block %struct_type.b [concrete = constants.%struct_type.b] { +// CHECK:STDOUT: %.loc13_30.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc13_30.2: type = converted %.loc13_30.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %struct_type.b: type = struct_type {.b: %empty_tuple.type} [concrete = constants.%struct_type.b] +// CHECK:STDOUT: } +// CHECK:STDOUT: %n: %struct_type.b = bind_name n, %n.param +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @NonInstance2 { +// CHECK:STDOUT: %Self: %NonInstance2.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.5a9] +// CHECK:STDOUT: %F2.decl: %F2.type.608 = fn_decl @F2.1 [concrete = constants.%F2.86a] {} {} +// CHECK:STDOUT: %assoc0: %NonInstance2.assoc_type = assoc_entity element0, %F2.decl [concrete = constants.%assoc0.97a] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: .F2 = %assoc0 +// CHECK:STDOUT: witness = (%F2.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.ffd566.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.207961.1 [symbolic = %assoc0 (constants.%assoc0.43db8b.1)] +// 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: impl @impl: %struct_type.b as %NonInstance2.ref { +// CHECK:STDOUT: %F2.decl: %F2.type.1ec = fn_decl @F2.2 [concrete = constants.%F2.941] {} {} +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .F2 = %F2.decl +// CHECK:STDOUT: witness = file.%impl_witness +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @F2.1(@NonInstance2.%Self: %NonInstance2.type) { +// CHECK:STDOUT: fn(); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F2.2() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @NonInstanceCall2(%n.param_patt: %struct_type.b) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %n.ref: %struct_type.b = name_ref n, %n +// CHECK:STDOUT: %NonInstance2.ref: type = name_ref NonInstance2, file.%NonInstance2.decl [concrete = constants.%NonInstance2.type] +// CHECK:STDOUT: %F2.ref: %NonInstance2.assoc_type = name_ref F2, @NonInstance2.%assoc0 [concrete = constants.%assoc0.97a] +// CHECK:STDOUT: %.loc21: %NonInstance2.type = converted %n.ref, [concrete = ] +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.ffd566.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: specific @F2.1(constants.%Self.5a9) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @F2.1(constants.%NonInstance2.facet) {} +// 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.%NonInstance2.type) { +// CHECK:STDOUT: %Dest => constants.%NonInstance2.type +// CHECK:STDOUT: %Dest.patt => constants.%NonInstance2.type +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.c38 +// CHECK:STDOUT: %Self => constants.%Self.519 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.d1f +// CHECK:STDOUT: %Convert => constants.%Convert.079 +// CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.5d3 +// CHECK:STDOUT: %assoc0 => constants.%assoc0.947 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_non-instance_indirect.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %NonInstance3.type: type = facet_type <@NonInstance3> [concrete] +// CHECK:STDOUT: %Self.dd1: %NonInstance3.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %F3.type.ee4: type = fn_type @F3.1 [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F3.752: %F3.type.ee4 = struct_value () [concrete] +// CHECK:STDOUT: %NonInstance3.assoc_type: type = assoc_entity_type %NonInstance3.type [concrete] +// CHECK:STDOUT: %assoc0.140: %NonInstance3.assoc_type = assoc_entity element0, @NonInstance3.%F3.decl [concrete] +// CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %empty_tuple.type} [concrete] +// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%F3.decl) [concrete] +// CHECK:STDOUT: %F3.type.1c2: type = fn_type @F3.2 [concrete] +// CHECK:STDOUT: %F3.1d3: %F3.type.1c2 = struct_value () [concrete] +// CHECK:STDOUT: %NonInstance3.facet: %NonInstance3.type = facet_value %struct_type.c, %impl_witness [concrete] +// CHECK:STDOUT: %ptr: type = ptr_type %struct_type.c [concrete] +// CHECK:STDOUT: %NonInstanceCallIndirect.type: type = fn_type @NonInstanceCallIndirect [concrete] +// CHECK:STDOUT: %NonInstanceCallIndirect: %NonInstanceCallIndirect.type = struct_value () [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.43db8b.1: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.1 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.c69: type = facet_type <@ImplicitAs, @ImplicitAs(%NonInstance3.type)> [concrete] +// CHECK:STDOUT: %Convert.type.0f1: type = fn_type @Convert, @ImplicitAs(%NonInstance3.type) [concrete] +// CHECK:STDOUT: %Convert.bb3: %Convert.type.0f1 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.assoc_type.43b: type = assoc_entity_type %ImplicitAs.type.c69 [concrete] +// CHECK:STDOUT: %assoc0.f5b: %ImplicitAs.assoc_type.43b = assoc_entity element0, imports.%Core.import_ref.207961.1 [concrete] +// CHECK:STDOUT: %assoc0.43db8b.2: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.2 [symbolic] +// CHECK:STDOUT: } +// 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.ffd566.1: type = import_ref Core//default, loc3_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst26 [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.43db8b.2)] +// CHECK:STDOUT: %Core.Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, Convert, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] +// CHECK:STDOUT: %Core.import_ref.ffd566.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, inst26 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] +// CHECK:STDOUT: %Core.import_ref.207961.1 = import_ref Core//default, loc4_35, unloaded +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .NonInstance3 = %NonInstance3.decl +// CHECK:STDOUT: .NonInstanceCallIndirect = %NonInstanceCallIndirect.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %NonInstance3.decl: type = interface_decl @NonInstance3 [concrete = constants.%NonInstance3.type] {} {} +// CHECK:STDOUT: impl_decl @impl [concrete] {} { +// CHECK:STDOUT: %.loc9_12.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc9_12.2: type = converted %.loc9_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %empty_tuple.type} [concrete = constants.%struct_type.c] +// CHECK:STDOUT: %NonInstance3.ref: type = name_ref NonInstance3, file.%NonInstance3.decl [concrete = constants.%NonInstance3.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%F3.decl) [concrete = constants.%impl_witness] +// CHECK:STDOUT: %NonInstanceCallIndirect.decl: %NonInstanceCallIndirect.type = fn_decl @NonInstanceCallIndirect [concrete = constants.%NonInstanceCallIndirect] { +// CHECK:STDOUT: %p.patt: %ptr = binding_pattern p +// CHECK:STDOUT: %p.param_patt: %ptr = value_param_pattern %p.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %p.param: %ptr = value_param runtime_param0 +// CHECK:STDOUT: %.loc13_39: type = splice_block %ptr [concrete = constants.%ptr] { +// CHECK:STDOUT: %.loc13_37.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc13_37.2: type = converted %.loc13_37.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %empty_tuple.type} [concrete = constants.%struct_type.c] +// CHECK:STDOUT: %ptr: type = ptr_type %struct_type.c [concrete = constants.%ptr] +// CHECK:STDOUT: } +// CHECK:STDOUT: %p: %ptr = bind_name p, %p.param +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @NonInstance3 { +// CHECK:STDOUT: %Self: %NonInstance3.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.dd1] +// CHECK:STDOUT: %F3.decl: %F3.type.ee4 = fn_decl @F3.1 [concrete = constants.%F3.752] {} {} +// CHECK:STDOUT: %assoc0: %NonInstance3.assoc_type = assoc_entity element0, %F3.decl [concrete = constants.%assoc0.140] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: .F3 = %assoc0 +// CHECK:STDOUT: witness = (%F3.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.ffd566.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.207961.1 [symbolic = %assoc0 (constants.%assoc0.43db8b.1)] +// 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: impl @impl: %struct_type.c as %NonInstance3.ref { +// CHECK:STDOUT: %F3.decl: %F3.type.1c2 = fn_decl @F3.2 [concrete = constants.%F3.1d3] {} {} +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .F3 = %F3.decl +// CHECK:STDOUT: witness = file.%impl_witness +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @F3.1(@NonInstance3.%Self: %NonInstance3.type) { +// CHECK:STDOUT: fn(); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F3.2() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @NonInstanceCallIndirect(%p.param_patt: %ptr) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %p.ref: %ptr = name_ref p, %p +// CHECK:STDOUT: %NonInstance3.ref: type = name_ref NonInstance3, file.%NonInstance3.decl [concrete = constants.%NonInstance3.type] +// CHECK:STDOUT: %F3.ref: %NonInstance3.assoc_type = name_ref F3, @NonInstance3.%assoc0 [concrete = constants.%assoc0.140] +// CHECK:STDOUT: %.loc21_4.1: ref %struct_type.c = deref %p.ref +// CHECK:STDOUT: %.loc21_4.2: %NonInstance3.type = converted %.loc21_4.1, [concrete = ] +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.ffd566.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: specific @F3.1(constants.%Self.dd1) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @F3.1(constants.%NonInstance3.facet) {} +// 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.%NonInstance3.type) { +// CHECK:STDOUT: %Dest => constants.%NonInstance3.type +// CHECK:STDOUT: %Dest.patt => constants.%NonInstance3.type +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.c69 +// CHECK:STDOUT: %Self => constants.%Self.519 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.0f1 +// CHECK:STDOUT: %Convert => constants.%Convert.bb3 +// CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.43b +// CHECK:STDOUT: %assoc0 => constants.%assoc0.f5b +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- instance_success.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Instance1.type: type = facet_type <@Instance1> [concrete] +// CHECK:STDOUT: %Self: %Instance1.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] +// CHECK:STDOUT: %G1.type.cde: type = fn_type @G1.1 [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %G1.79a: %G1.type.cde = struct_value () [concrete] +// CHECK:STDOUT: %Instance1.assoc_type: type = assoc_entity_type %Instance1.type [concrete] +// CHECK:STDOUT: %assoc0: %Instance1.assoc_type = assoc_entity element0, @Instance1.%G1.decl [concrete] +// CHECK:STDOUT: %struct_type.d: type = struct_type {.d: %empty_tuple.type} [concrete] +// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%G1.decl) [concrete] +// CHECK:STDOUT: %G1.type.c50: type = fn_type @G1.2 [concrete] +// CHECK:STDOUT: %G1.fee: %G1.type.c50 = struct_value () [concrete] +// CHECK:STDOUT: %Instance1.facet: %Instance1.type = facet_value %struct_type.d, %impl_witness [concrete] +// CHECK:STDOUT: %InstanceCall.type: type = fn_type @InstanceCall [concrete] +// CHECK:STDOUT: %InstanceCall: %InstanceCall.type = struct_value () [concrete] +// CHECK:STDOUT: %.4d6: type = fn_type_with_self_type %G1.type.cde, %Instance1.facet [concrete] +// CHECK:STDOUT: %ptr: type = ptr_type %struct_type.d [concrete] +// CHECK:STDOUT: %InstanceCallIndirect.type: type = fn_type @InstanceCallIndirect [concrete] +// CHECK:STDOUT: %InstanceCallIndirect: %InstanceCallIndirect.type = struct_value () [concrete] +// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] +// CHECK:STDOUT: %struct: %struct_type.d = struct_value (%empty_tuple) [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Instance1 = %Instance1.decl +// CHECK:STDOUT: .InstanceCall = %InstanceCall.decl +// CHECK:STDOUT: .InstanceCallIndirect = %InstanceCallIndirect.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Instance1.decl: type = interface_decl @Instance1 [concrete = constants.%Instance1.type] {} {} +// CHECK:STDOUT: impl_decl @impl [concrete] {} { +// CHECK:STDOUT: %.loc7_12.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc7_12.2: type = converted %.loc7_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %struct_type.d: type = struct_type {.d: %empty_tuple.type} [concrete = constants.%struct_type.d] +// CHECK:STDOUT: %Instance1.ref: type = name_ref Instance1, file.%Instance1.decl [concrete = constants.%Instance1.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%G1.decl) [concrete = constants.%impl_witness] +// CHECK:STDOUT: %InstanceCall.decl: %InstanceCall.type = fn_decl @InstanceCall [concrete = constants.%InstanceCall] { +// CHECK:STDOUT: %n.patt: %struct_type.d = binding_pattern n +// CHECK:STDOUT: %n.param_patt: %struct_type.d = value_param_pattern %n.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %n.param: %struct_type.d = value_param runtime_param0 +// CHECK:STDOUT: %.loc11_27: type = splice_block %struct_type.d [concrete = constants.%struct_type.d] { +// CHECK:STDOUT: %.loc11_26.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc11_26.2: type = converted %.loc11_26.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %struct_type.d: type = struct_type {.d: %empty_tuple.type} [concrete = constants.%struct_type.d] +// CHECK:STDOUT: } +// CHECK:STDOUT: %n: %struct_type.d = bind_name n, %n.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %InstanceCallIndirect.decl: %InstanceCallIndirect.type = fn_decl @InstanceCallIndirect [concrete = constants.%InstanceCallIndirect] { +// CHECK:STDOUT: %p.patt: %ptr = binding_pattern p +// CHECK:STDOUT: %p.param_patt: %ptr = value_param_pattern %p.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %p.param: %ptr = value_param runtime_param0 +// CHECK:STDOUT: %.loc15_36: type = splice_block %ptr [concrete = constants.%ptr] { +// CHECK:STDOUT: %.loc15_34.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc15_34.2: type = converted %.loc15_34.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %struct_type.d: type = struct_type {.d: %empty_tuple.type} [concrete = constants.%struct_type.d] +// CHECK:STDOUT: %ptr: type = ptr_type %struct_type.d [concrete = constants.%ptr] +// CHECK:STDOUT: } +// CHECK:STDOUT: %p: %ptr = bind_name p, %p.param +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @Instance1 { +// CHECK:STDOUT: %Self: %Instance1.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] +// CHECK:STDOUT: %G1.decl: %G1.type.cde = fn_decl @G1.1 [concrete = constants.%G1.79a] { +// CHECK:STDOUT: %self.patt: @G1.1.%Self.as_type.loc4_15.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @G1.1.%Self.as_type.loc4_15.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @G1.1.%Self.as_type.loc4_15.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc4_15.1: type = splice_block %.loc4_15.2 [symbolic = %Self.as_type.loc4_15.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %Self.ref: %Instance1.type = name_ref Self, @Instance1.%Self [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc4_15.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc4_15.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc4_15.2: type = converted %Self.ref, %Self.as_type.loc4_15.2 [symbolic = %Self.as_type.loc4_15.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @G1.1.%Self.as_type.loc4_15.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0: %Instance1.assoc_type = assoc_entity element0, %G1.decl [concrete = constants.%assoc0] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: .G1 = %assoc0 +// CHECK:STDOUT: witness = (%G1.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl: %struct_type.d as %Instance1.ref { +// CHECK:STDOUT: %G1.decl: %G1.type.c50 = fn_decl @G1.2 [concrete = constants.%G1.fee] { +// CHECK:STDOUT: %self.patt: %struct_type.d = binding_pattern self +// CHECK:STDOUT: %self.param_patt: %struct_type.d = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: %struct_type.d = value_param runtime_param0 +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%struct_type.d [concrete = constants.%struct_type.d] +// CHECK:STDOUT: %self: %struct_type.d = bind_name self, %self.param +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .G1 = %G1.decl +// CHECK:STDOUT: witness = file.%impl_witness +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @G1.1(@Instance1.%Self: %Instance1.type) { +// CHECK:STDOUT: %Self: %Instance1.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc4_15.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc4_15.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @G1.1.%Self.as_type.loc4_15.1 (%Self.as_type)](); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @G1.2[%self.param_patt: %struct_type.d]() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @InstanceCall(%n.param_patt: %struct_type.d) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %n.ref: %struct_type.d = name_ref n, %n +// CHECK:STDOUT: %Instance1.ref: type = name_ref Instance1, file.%Instance1.decl [concrete = constants.%Instance1.type] +// CHECK:STDOUT: %G1.ref: %Instance1.assoc_type = name_ref G1, @Instance1.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0: %.4d6 = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%G1.fee] +// CHECK:STDOUT: %bound_method: = bound_method %n.ref, %impl.elem0 +// CHECK:STDOUT: %G1.call: init %empty_tuple.type = call %bound_method(%n.ref) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @InstanceCallIndirect(%p.param_patt: %ptr) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %p.ref: %ptr = name_ref p, %p +// CHECK:STDOUT: %Instance1.ref: type = name_ref Instance1, file.%Instance1.decl [concrete = constants.%Instance1.type] +// CHECK:STDOUT: %G1.ref: %Instance1.assoc_type = name_ref G1, @Instance1.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %.loc16_4.1: ref %struct_type.d = deref %p.ref +// CHECK:STDOUT: %impl.elem0: %.4d6 = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%G1.fee] +// CHECK:STDOUT: %bound_method: = bound_method %.loc16_4.1, %impl.elem0 +// CHECK:STDOUT: %.loc16_4.2: ref %empty_tuple.type = struct_access %.loc16_4.1, element0 +// CHECK:STDOUT: %tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc16_4.3: %empty_tuple.type = converted %.loc16_4.2, %tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %struct: %struct_type.d = struct_value (%.loc16_4.3) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc16_4.4: %struct_type.d = converted %.loc16_4.1, %struct [concrete = constants.%struct] +// CHECK:STDOUT: %G1.call: init %empty_tuple.type = call %bound_method(%.loc16_4.4) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @G1.1(constants.%Self) { +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type.loc4_15.1 => constants.%Self.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @G1.1(constants.%Instance1.facet) { +// CHECK:STDOUT: %Self => constants.%Instance1.facet +// CHECK:STDOUT: %Self.as_type.loc4_15.1 => constants.%struct_type.d +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_instance.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Instance2.type: type = facet_type <@Instance2> [concrete] +// CHECK:STDOUT: %Self: %Instance2.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] +// CHECK:STDOUT: %G2.type.aa7: type = fn_type @G2.1 [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %G2.588: %G2.type.aa7 = struct_value () [concrete] +// CHECK:STDOUT: %Instance2.assoc_type: type = assoc_entity_type %Instance2.type [concrete] +// CHECK:STDOUT: %assoc0: %Instance2.assoc_type = assoc_entity element0, @Instance2.%G2.decl [concrete] +// CHECK:STDOUT: %struct_type.e: type = struct_type {.e: %empty_tuple.type} [concrete] +// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%G2.decl) [concrete] +// CHECK:STDOUT: %G2.type.50c: type = fn_type @G2.2 [concrete] +// CHECK:STDOUT: %G2.707: %G2.type.50c = struct_value () [concrete] +// CHECK:STDOUT: %Instance2.facet: %Instance2.type = facet_value %struct_type.e, %impl_witness [concrete] +// CHECK:STDOUT: %InstanceCallFail.type: type = fn_type @InstanceCallFail [concrete] +// CHECK:STDOUT: %InstanceCallFail: %InstanceCallFail.type = struct_value () [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Instance2 = %Instance2.decl +// CHECK:STDOUT: .InstanceCallFail = %InstanceCallFail.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Instance2.decl: type = interface_decl @Instance2 [concrete = constants.%Instance2.type] {} {} +// CHECK:STDOUT: impl_decl @impl [concrete] {} { +// CHECK:STDOUT: %.loc7_12.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc7_12.2: type = converted %.loc7_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %struct_type.e: type = struct_type {.e: %empty_tuple.type} [concrete = constants.%struct_type.e] +// CHECK:STDOUT: %Instance2.ref: type = name_ref Instance2, file.%Instance2.decl [concrete = constants.%Instance2.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%G2.decl) [concrete = constants.%impl_witness] +// CHECK:STDOUT: %InstanceCallFail.decl: %InstanceCallFail.type = fn_decl @InstanceCallFail [concrete = constants.%InstanceCallFail] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @Instance2 { +// CHECK:STDOUT: %Self: %Instance2.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] +// CHECK:STDOUT: %G2.decl: %G2.type.aa7 = fn_decl @G2.1 [concrete = constants.%G2.588] { +// CHECK:STDOUT: %self.patt: @G2.1.%Self.as_type.loc4_15.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @G2.1.%Self.as_type.loc4_15.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @G2.1.%Self.as_type.loc4_15.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc4_15.1: type = splice_block %.loc4_15.2 [symbolic = %Self.as_type.loc4_15.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %Self.ref: %Instance2.type = name_ref Self, @Instance2.%Self [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc4_15.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc4_15.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc4_15.2: type = converted %Self.ref, %Self.as_type.loc4_15.2 [symbolic = %Self.as_type.loc4_15.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @G2.1.%Self.as_type.loc4_15.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0: %Instance2.assoc_type = assoc_entity element0, %G2.decl [concrete = constants.%assoc0] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: .G2 = %assoc0 +// CHECK:STDOUT: witness = (%G2.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl: %struct_type.e as %Instance2.ref { +// CHECK:STDOUT: %G2.decl: %G2.type.50c = fn_decl @G2.2 [concrete = constants.%G2.707] { +// CHECK:STDOUT: %self.patt: %struct_type.e = binding_pattern self +// CHECK:STDOUT: %self.param_patt: %struct_type.e = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: %struct_type.e = value_param runtime_param0 +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%struct_type.e [concrete = constants.%struct_type.e] +// CHECK:STDOUT: %self: %struct_type.e = bind_name self, %self.param +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .G2 = %G2.decl +// CHECK:STDOUT: witness = file.%impl_witness +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @G2.1(@Instance2.%Self: %Instance2.type) { +// CHECK:STDOUT: %Self: %Instance2.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc4_15.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc4_15.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @G2.1.%Self.as_type.loc4_15.1 (%Self.as_type)](); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @G2.2[%self.param_patt: %struct_type.e]() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @InstanceCallFail() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc16_9.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc16_9.2: type = converted %.loc16_9.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %struct_type.e: type = struct_type {.e: %empty_tuple.type} [concrete = constants.%struct_type.e] +// CHECK:STDOUT: %Instance2.ref: type = name_ref Instance2, file.%Instance2.decl [concrete = constants.%Instance2.type] +// CHECK:STDOUT: %G2.ref: %Instance2.assoc_type = name_ref G2, @Instance2.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @G2.1(constants.%Self) { +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type.loc4_15.1 => constants.%Self.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @G2.1(constants.%Instance2.facet) { +// CHECK:STDOUT: %Self => constants.%Instance2.facet +// CHECK:STDOUT: %Self.as_type.loc4_15.1 => constants.%struct_type.e +// CHECK:STDOUT: } +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/no_prelude/fail_impl_as_scope.carbon b/toolchain/check/testdata/impl/no_prelude/fail_impl_as_scope.carbon index 486158b0f0346..bf7df1ef834fe 100644 --- a/toolchain/check/testdata/impl/no_prelude/fail_impl_as_scope.carbon +++ b/toolchain/check/testdata/impl/no_prelude/fail_impl_as_scope.carbon @@ -44,6 +44,7 @@ library "[[@TEST_NAME]]"; interface Z { fn Zero(); + fn Method[self: Self](); // CHECK:STDERR: fail_impl_as_self_interface.carbon:[[@LINE+11]]:9: error: `impl as` can only be used in a class [ImplAsOutsideClass] // CHECK:STDERR: impl as Z { @@ -52,18 +53,20 @@ interface Z { // CHECK:STDERR: fail_impl_as_self_interface.carbon:[[@LINE+7]]:4: error: impl as incomplete facet type `Z` [ImplAsIncompleteFacetType] // CHECK:STDERR: impl as Z { // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: fail_impl_as_self_interface.carbon:[[@LINE-10]]:1: note: interface is currently being defined [InterfaceUndefinedWithinDefinition] + // CHECK:STDERR: fail_impl_as_self_interface.carbon:[[@LINE-11]]:1: note: interface is currently being defined [InterfaceUndefinedWithinDefinition] // CHECK:STDERR: interface Z { // CHECK:STDERR: ^~~~~~~~~~~~~ // CHECK:STDERR: impl as Z { fn Zero() {} + fn Method[self: Self]() {} } } class Point { impl as Z { fn Zero() {} + fn Method[self: Self]() {} } } @@ -71,7 +74,8 @@ fn F() { // Even if the `impl` is diagnosed above, we must not add the impl of the // interface to itself in a way that allows it to be used during impl lookup, // or we end up with infinite impl lookup recursion here. - ({} as Point).(Z.Zero)(); + Point.(Z.Zero)(); + ({} as Point).(Z.Method)(); } // --- fail_impl_as_other_interface.carbon @@ -212,19 +216,29 @@ class X { // CHECK:STDOUT: %Zero.d14: %Zero.type.822 = struct_value () [concrete] // CHECK:STDOUT: %Z.assoc_type: type = assoc_entity_type %Z.type [concrete] // CHECK:STDOUT: %assoc0: %Z.assoc_type = assoc_entity element0, @Z.%Zero.decl [concrete] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] +// CHECK:STDOUT: %Method.type.f12: type = fn_type @Method.1 [concrete] +// CHECK:STDOUT: %Method.724: %Method.type.f12 = struct_value () [concrete] +// CHECK:STDOUT: %assoc1: %Z.assoc_type = assoc_entity element1, @Z.%Method.decl [concrete] // CHECK:STDOUT: %Zero.type.db4: type = fn_type @Zero.2, @impl.6b5(%Self) [symbolic] // CHECK:STDOUT: %Zero.8fb: %Zero.type.db4 = struct_value () [symbolic] +// CHECK:STDOUT: %Method.type.163: type = fn_type @Method.2, @impl.6b5(%Self) [symbolic] +// CHECK:STDOUT: %Method.84d: %Method.type.163 = struct_value () [symbolic] +// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type [symbolic] // CHECK:STDOUT: %Point: type = class_type @Point [concrete] -// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.c94.%Zero.decl) [concrete] +// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.c94.%Zero.decl, @impl.c94.%Method.decl) [concrete] // CHECK:STDOUT: %Zero.type.e33: type = fn_type @Zero.3 [concrete] // CHECK:STDOUT: %Zero.dec: %Zero.type.e33 = struct_value () [concrete] +// CHECK:STDOUT: %Method.type.2ed: type = fn_type @Method.3 [concrete] +// CHECK:STDOUT: %Method.2c2: %Method.type.2ed = struct_value () [concrete] // CHECK:STDOUT: %Z.facet: %Z.type = facet_value %Point, %impl_witness [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %.c03: type = fn_type_with_self_type %Zero.type.822, %Z.facet [concrete] // CHECK:STDOUT: %Point.val: %Point = struct_value () [concrete] -// CHECK:STDOUT: %.c37: type = fn_type_with_self_type %Zero.type.822, %Z.facet [concrete] +// CHECK:STDOUT: %.6a1: type = fn_type_with_self_type %Method.type.f12, %Z.facet [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -242,6 +256,19 @@ class X { // CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] // CHECK:STDOUT: %Zero.decl: %Zero.type.822 = fn_decl @Zero.1 [concrete = constants.%Zero.d14] {} {} // CHECK:STDOUT: %assoc0: %Z.assoc_type = assoc_entity element0, %Zero.decl [concrete = constants.%assoc0] +// CHECK:STDOUT: %Method.decl: %Method.type.f12 = fn_decl @Method.1 [concrete = constants.%Method.724] { +// CHECK:STDOUT: %self.patt: @Method.1.%Self.as_type.loc5_19.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Method.1.%Self.as_type.loc5_19.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @Method.1.%Self.as_type.loc5_19.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc5_19.1: type = splice_block %.loc5_19.2 [symbolic = %Self.as_type.loc5_19.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %Self.ref: %Z.type = name_ref Self, @Z.%Self [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc5_19.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_19.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc5_19.2: type = converted %Self.ref, %Self.as_type.loc5_19.2 [symbolic = %Self.as_type.loc5_19.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Method.1.%Self.as_type.loc5_19.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc1: %Z.assoc_type = assoc_entity element1, %Method.decl [concrete = constants.%assoc1] // CHECK:STDOUT: impl_decl @impl.6b5 [concrete] {} { // CHECK:STDOUT: %Self.ref: type = name_ref Self, [concrete = ] // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] @@ -250,8 +277,9 @@ class X { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Zero = %assoc0 +// CHECK:STDOUT: .Method = %assoc1 // CHECK:STDOUT: .Z = -// CHECK:STDOUT: witness = (%Zero.decl) +// CHECK:STDOUT: witness = (%Zero.decl, %Method.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic impl @impl.6b5(@Z.%Self: %Z.type) { @@ -259,21 +287,45 @@ class X { // CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] // CHECK:STDOUT: %Zero.type: type = fn_type @Zero.2, @impl.6b5(%Self) [symbolic = %Zero.type (constants.%Zero.type.db4)] // CHECK:STDOUT: %Zero: @impl.6b5.%Zero.type (%Zero.type.db4) = struct_value () [symbolic = %Zero (constants.%Zero.8fb)] +// CHECK:STDOUT: %Method.type: type = fn_type @Method.2, @impl.6b5(%Self) [symbolic = %Method.type (constants.%Method.type.163)] +// CHECK:STDOUT: %Method: @impl.6b5.%Method.type (%Method.type.163) = struct_value () [symbolic = %Method (constants.%Method.84d)] // CHECK:STDOUT: // CHECK:STDOUT: impl: %Self.ref as %Z.ref { // CHECK:STDOUT: %Zero.decl: @impl.6b5.%Zero.type (%Zero.type.db4) = fn_decl @Zero.2 [symbolic = @impl.6b5.%Zero (constants.%Zero.8fb)] {} {} +// CHECK:STDOUT: %Method.decl: @impl.6b5.%Method.type (%Method.type.163) = fn_decl @Method.2 [symbolic = @impl.6b5.%Method (constants.%Method.84d)] { +// CHECK:STDOUT: %self.patt: @Method.2.%Self.as_type.loc20_21.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Method.2.%Self.as_type.loc20_21.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @Method.2.%Self.as_type.loc20_21.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc20_21.1: type = splice_block %.loc20_21.2 [symbolic = %Self.as_type.loc20_21.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %Self.ref: %Z.type = name_ref Self, @Z.%Self [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc20_21.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc20_21.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc20_21.2: type = converted %Self.ref, %Self.as_type.loc20_21.2 [symbolic = %Self.as_type.loc20_21.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Method.2.%Self.as_type.loc20_21.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Zero = %Zero.decl +// CHECK:STDOUT: .Method = %Method.decl // CHECK:STDOUT: witness = // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.c94: %Self.ref as %Z.ref { // CHECK:STDOUT: %Zero.decl: %Zero.type.e33 = fn_decl @Zero.3 [concrete = constants.%Zero.dec] {} {} +// CHECK:STDOUT: %Method.decl: %Method.type.2ed = fn_decl @Method.3 [concrete = constants.%Method.2c2] { +// CHECK:STDOUT: %self.patt: %Point = binding_pattern self +// CHECK:STDOUT: %self.param_patt: %Point = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: %Point = value_param runtime_param0 +// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Point [concrete = constants.%Point] +// CHECK:STDOUT: %self: %Point = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Zero = %Zero.decl +// CHECK:STDOUT: .Method = %Method.decl // CHECK:STDOUT: witness = @Point.%impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: @@ -282,7 +334,7 @@ class X { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Point [concrete = constants.%Point] // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.c94.%Zero.decl) [concrete = constants.%impl_witness] +// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.c94.%Zero.decl, @impl.c94.%Method.decl) [concrete = constants.%impl_witness] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -295,6 +347,13 @@ class X { // CHECK:STDOUT: fn(); // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Method.1(@Z.%Self: %Z.type) { +// CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc5_19.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_19.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Method.1.%Self.as_type.loc5_19.1 (%Self.as_type)](); +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: generic fn @Zero.2(@Z.%Self: %Z.type) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -304,41 +363,86 @@ class X { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Method.2(@Z.%Self: %Z.type) { +// CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc20_21.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc20_21.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Method.2.%Self.as_type.loc20_21.1 (%Self.as_type) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Method.2.%Self.as_type.loc20_21.1 (%Self.as_type)]() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: fn @Zero.3() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Method.3[%self.param_patt: %Point]() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc32_5.1: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %Point.ref: type = name_ref Point, file.%Point.decl [concrete = constants.%Point] -// CHECK:STDOUT: %.loc32_5.2: ref %Point = temporary_storage -// CHECK:STDOUT: %.loc32_5.3: init %Point = class_init (), %.loc32_5.2 [concrete = constants.%Point.val] -// CHECK:STDOUT: %.loc32_5.4: ref %Point = temporary %.loc32_5.2, %.loc32_5.3 -// CHECK:STDOUT: %.loc32_7: ref %Point = converted %.loc32_5.1, %.loc32_5.4 -// CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] +// CHECK:STDOUT: %Point.ref.loc35: type = name_ref Point, file.%Point.decl [concrete = constants.%Point] +// CHECK:STDOUT: %Z.ref.loc35: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] // CHECK:STDOUT: %Zero.ref: %Z.assoc_type = name_ref Zero, @Z.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0: %.c37 = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%Zero.dec] +// CHECK:STDOUT: %Z.facet: %Z.type = facet_value constants.%Point, constants.%impl_witness [concrete = constants.%Z.facet] +// CHECK:STDOUT: %.loc35: %Z.type = converted %Point.ref.loc35, %Z.facet [concrete = constants.%Z.facet] +// CHECK:STDOUT: %as_wit: = facet_access_witness %.loc35 [concrete = constants.%impl_witness] +// CHECK:STDOUT: %impl.elem0: %.c03 = impl_witness_access %as_wit, element0 [concrete = constants.%Zero.dec] // CHECK:STDOUT: %Zero.call: init %empty_tuple.type = call %impl.elem0() +// CHECK:STDOUT: %.loc36_5.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %Point.ref.loc36: type = name_ref Point, file.%Point.decl [concrete = constants.%Point] +// CHECK:STDOUT: %.loc36_5.2: ref %Point = temporary_storage +// CHECK:STDOUT: %.loc36_5.3: init %Point = class_init (), %.loc36_5.2 [concrete = constants.%Point.val] +// CHECK:STDOUT: %.loc36_5.4: ref %Point = temporary %.loc36_5.2, %.loc36_5.3 +// CHECK:STDOUT: %.loc36_7.1: ref %Point = converted %.loc36_5.1, %.loc36_5.4 +// CHECK:STDOUT: %Z.ref.loc36: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] +// CHECK:STDOUT: %Method.ref: %Z.assoc_type = name_ref Method, @Z.%assoc1 [concrete = constants.%assoc1] +// CHECK:STDOUT: %impl.elem1: %.6a1 = impl_witness_access constants.%impl_witness, element1 [concrete = constants.%Method.2c2] +// CHECK:STDOUT: %bound_method: = bound_method %.loc36_7.1, %impl.elem1 +// CHECK:STDOUT: %.loc36_7.2: %Point = bind_value %.loc36_7.1 +// CHECK:STDOUT: %Method.call: init %empty_tuple.type = call %bound_method(%.loc36_7.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Zero.1(constants.%Self) {} // CHECK:STDOUT: +// CHECK:STDOUT: specific @Method.1(constants.%Self) { +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type.loc5_19.1 => constants.%Self.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: specific @impl.6b5(constants.%Self) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Self => constants.%Self // CHECK:STDOUT: %Zero.type => constants.%Zero.type.db4 // CHECK:STDOUT: %Zero => constants.%Zero.8fb +// CHECK:STDOUT: %Method.type => constants.%Method.type.163 +// CHECK:STDOUT: %Method => constants.%Method.84d // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Zero.2(constants.%Self) {} // CHECK:STDOUT: +// CHECK:STDOUT: specific @Method.2(constants.%Self) { +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type.loc20_21.1 => constants.%Self.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: specific @impl.6b5(%Self) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Zero.1(constants.%Z.facet) {} // CHECK:STDOUT: +// CHECK:STDOUT: specific @Method.1(constants.%Z.facet) { +// CHECK:STDOUT: %Self => constants.%Z.facet +// CHECK:STDOUT: %Self.as_type.loc5_19.1 => constants.%Point +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_impl_as_other_interface.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { diff --git a/toolchain/check/testdata/impl/no_prelude/import_compound.carbon b/toolchain/check/testdata/impl/no_prelude/import_compound.carbon new file mode 100644 index 0000000000000..250e80ac4af33 --- /dev/null +++ b/toolchain/check/testdata/impl/no_prelude/import_compound.carbon @@ -0,0 +1,1045 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/no_prelude/import_compound.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/no_prelude/import_compound.carbon + +// --- lib.carbon +library "[[@TEST_NAME]]"; + +interface NonInstance { + fn F(); +} + +impl {.i: ()} as NonInstance { + fn F() {} +} + +interface Instance { + fn G[self: Self](); +} + +impl {.i: ()} as Instance { + fn G[self: Self]() {} +} + +// --- import_non-instance_success.carbon +library "[[@TEST_NAME]]"; + +import library "lib"; + +fn NonInstanceCallImport() { + {.i: ()}.(NonInstance.F)(); +} + +// --- core.carbon +package Core; + +interface ImplicitAs(Dest:! type) { + fn Convert[self: Self]() -> Dest; +} + +// --- fail_import_non-instance.carbon +library "[[@TEST_NAME]]"; + +import library "lib"; +import Core; + +fn NonInstanceCallImportFail(n: {.i: ()}) { + // CHECK:STDERR: fail_import_non-instance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `{.i: ()}` to `NonInstance` [ImplicitAsConversionFailure] + // CHECK:STDERR: n.(NonInstance.F)(); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_non-instance.carbon:[[@LINE+4]]:3: note: type `{.i: ()}` does not implement interface `Core.ImplicitAs(NonInstance)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: n.(NonInstance.F)(); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + n.(NonInstance.F)(); +} + +// --- fail_import_non-instance_indirect.carbon +library "[[@TEST_NAME]]"; + +import library "lib"; +import Core; + +fn NonInstanceCallIndirectImport(p: {.i: ()}*) { + // CHECK:STDERR: fail_import_non-instance_indirect.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `{.i: ()}` to `NonInstance` [ImplicitAsConversionFailure] + // CHECK:STDERR: p->(NonInstance.F)(); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_import_non-instance_indirect.carbon:[[@LINE+4]]:3: note: type `{.i: ()}` does not implement interface `Core.ImplicitAs(NonInstance)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: p->(NonInstance.F)(); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + p->(NonInstance.F)(); +} + +// --- import_instance_success.carbon +library "[[@TEST_NAME]]"; + +import library "lib"; + +fn InstanceCallImport(n: {.i: ()}) { + n.(Instance.G)(); +} + +fn InstanceCallIndirectImport(p: {.i: ()}*) { + p->(Instance.G)(); +} + +// --- fail_import_instance.carbon +library "[[@TEST_NAME]]"; + +import library "lib"; +import Core; + +fn InstanceCallImportFail() { + // CHECK:STDERR: fail_import_instance.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Instance` in type `type` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: {.i: ()}.(Instance.G)(); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + {.i: ()}.(Instance.G)(); +} + +// CHECK:STDOUT: --- lib.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %NonInstance.type: type = facet_type <@NonInstance> [concrete] +// CHECK:STDOUT: %Self.73c: %NonInstance.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %F.type.9e5: type = fn_type @F.1 [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F.4e4: %F.type.9e5 = struct_value () [concrete] +// CHECK:STDOUT: %NonInstance.assoc_type: type = assoc_entity_type %NonInstance.type [concrete] +// CHECK:STDOUT: %assoc0.b89: %NonInstance.assoc_type = assoc_entity element0, @NonInstance.%F.decl [concrete] +// CHECK:STDOUT: %struct_type.i: type = struct_type {.i: %empty_tuple.type} [concrete] +// CHECK:STDOUT: %impl_witness.e97: = impl_witness (@impl.c58.%F.decl) [concrete] +// CHECK:STDOUT: %F.type.042: type = fn_type @F.2 [concrete] +// CHECK:STDOUT: %F.db4: %F.type.042 = struct_value () [concrete] +// CHECK:STDOUT: %NonInstance.facet: %NonInstance.type = facet_value %struct_type.i, %impl_witness.e97 [concrete] +// CHECK:STDOUT: %Instance.type: type = facet_type <@Instance> [concrete] +// CHECK:STDOUT: %Self.cf8: %Instance.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.cf8 [symbolic] +// CHECK:STDOUT: %G.type.1e1: type = fn_type @G.1 [concrete] +// CHECK:STDOUT: %G.449: %G.type.1e1 = struct_value () [concrete] +// CHECK:STDOUT: %Instance.assoc_type: type = assoc_entity_type %Instance.type [concrete] +// CHECK:STDOUT: %assoc0.b0a: %Instance.assoc_type = assoc_entity element0, @Instance.%G.decl [concrete] +// CHECK:STDOUT: %impl_witness.114: = impl_witness (@impl.477.%G.decl) [concrete] +// CHECK:STDOUT: %G.type.0c0: type = fn_type @G.2 [concrete] +// CHECK:STDOUT: %G.484: %G.type.0c0 = struct_value () [concrete] +// CHECK:STDOUT: %Instance.facet: %Instance.type = facet_value %struct_type.i, %impl_witness.114 [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .NonInstance = %NonInstance.decl +// CHECK:STDOUT: .Instance = %Instance.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %NonInstance.decl: type = interface_decl @NonInstance [concrete = constants.%NonInstance.type] {} {} +// CHECK:STDOUT: impl_decl @impl.c58 [concrete] {} { +// CHECK:STDOUT: %.loc7_12.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc7_12.2: type = converted %.loc7_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %struct_type.i: type = struct_type {.i: %empty_tuple.type} [concrete = constants.%struct_type.i] +// CHECK:STDOUT: %NonInstance.ref: type = name_ref NonInstance, file.%NonInstance.decl [concrete = constants.%NonInstance.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness.loc7: = impl_witness (@impl.c58.%F.decl) [concrete = constants.%impl_witness.e97] +// CHECK:STDOUT: %Instance.decl: type = interface_decl @Instance [concrete = constants.%Instance.type] {} {} +// CHECK:STDOUT: impl_decl @impl.477 [concrete] {} { +// CHECK:STDOUT: %.loc15_12.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc15_12.2: type = converted %.loc15_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %struct_type.i: type = struct_type {.i: %empty_tuple.type} [concrete = constants.%struct_type.i] +// CHECK:STDOUT: %Instance.ref: type = name_ref Instance, file.%Instance.decl [concrete = constants.%Instance.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness.loc15: = impl_witness (@impl.477.%G.decl) [concrete = constants.%impl_witness.114] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @NonInstance { +// CHECK:STDOUT: %Self: %NonInstance.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.73c] +// CHECK:STDOUT: %F.decl: %F.type.9e5 = fn_decl @F.1 [concrete = constants.%F.4e4] {} {} +// CHECK:STDOUT: %assoc0: %NonInstance.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0.b89] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: .F = %assoc0 +// CHECK:STDOUT: witness = (%F.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @Instance { +// CHECK:STDOUT: %Self: %Instance.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.cf8] +// CHECK:STDOUT: %G.decl: %G.type.1e1 = fn_decl @G.1 [concrete = constants.%G.449] { +// CHECK:STDOUT: %self.patt: @G.1.%Self.as_type.loc12_14.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @G.1.%Self.as_type.loc12_14.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @G.1.%Self.as_type.loc12_14.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc12_14.1: type = splice_block %.loc12_14.2 [symbolic = %Self.as_type.loc12_14.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %Self.ref: %Instance.type = name_ref Self, @Instance.%Self [symbolic = %Self (constants.%Self.cf8)] +// CHECK:STDOUT: %Self.as_type.loc12_14.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc12_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc12_14.2: type = converted %Self.ref, %Self.as_type.loc12_14.2 [symbolic = %Self.as_type.loc12_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @G.1.%Self.as_type.loc12_14.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0: %Instance.assoc_type = assoc_entity element0, %G.decl [concrete = constants.%assoc0.b0a] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: .G = %assoc0 +// CHECK:STDOUT: witness = (%G.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.c58: %struct_type.i as %NonInstance.ref { +// CHECK:STDOUT: %F.decl: %F.type.042 = fn_decl @F.2 [concrete = constants.%F.db4] {} {} +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: witness = file.%impl_witness.loc7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.477: %struct_type.i as %Instance.ref { +// CHECK:STDOUT: %G.decl: %G.type.0c0 = fn_decl @G.2 [concrete = constants.%G.484] { +// CHECK:STDOUT: %self.patt: %struct_type.i = binding_pattern self +// CHECK:STDOUT: %self.param_patt: %struct_type.i = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: %struct_type.i = value_param runtime_param0 +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.477.%struct_type.i [concrete = constants.%struct_type.i] +// CHECK:STDOUT: %self: %struct_type.i = bind_name self, %self.param +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: witness = file.%impl_witness.loc15 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @F.1(@NonInstance.%Self: %NonInstance.type) { +// CHECK:STDOUT: fn(); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F.2() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @G.1(@Instance.%Self: %Instance.type) { +// CHECK:STDOUT: %Self: %Instance.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.cf8)] +// CHECK:STDOUT: %Self.as_type.loc12_14.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc12_14.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @G.1.%Self.as_type.loc12_14.1 (%Self.as_type)](); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @G.2[%self.param_patt: %struct_type.i]() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @F.1(constants.%Self.73c) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @F.1(constants.%NonInstance.facet) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @G.1(constants.%Self.cf8) { +// CHECK:STDOUT: %Self => constants.%Self.cf8 +// CHECK:STDOUT: %Self.as_type.loc12_14.1 => constants.%Self.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @G.1(constants.%Instance.facet) { +// CHECK:STDOUT: %Self => constants.%Instance.facet +// CHECK:STDOUT: %Self.as_type.loc12_14.1 => constants.%struct_type.i +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- import_non-instance_success.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %NonInstanceCallImport.type: type = fn_type @NonInstanceCallImport [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %NonInstanceCallImport: %NonInstanceCallImport.type = struct_value () [concrete] +// CHECK:STDOUT: %struct_type.i: type = struct_type {.i: %empty_tuple.type} [concrete] +// CHECK:STDOUT: %NonInstance.type: type = facet_type <@NonInstance> [concrete] +// CHECK:STDOUT: %Self.73c: %NonInstance.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %NonInstance.assoc_type: type = assoc_entity_type %NonInstance.type [concrete] +// CHECK:STDOUT: %assoc0: %NonInstance.assoc_type = assoc_entity element0, imports.%Main.import_ref.bb3 [concrete] +// CHECK:STDOUT: %F.type.9e5: type = fn_type @F.1 [concrete] +// CHECK:STDOUT: %F.4e4: %F.type.9e5 = struct_value () [concrete] +// CHECK:STDOUT: %Instance.type: type = facet_type <@Instance> [concrete] +// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%Main.import_ref.2d7) [concrete] +// CHECK:STDOUT: %NonInstance.facet: %NonInstance.type = facet_value %struct_type.i, %impl_witness [concrete] +// CHECK:STDOUT: %.582: type = fn_type_with_self_type %F.type.9e5, %NonInstance.facet [concrete] +// CHECK:STDOUT: %F.type.042: type = fn_type @F.2 [concrete] +// CHECK:STDOUT: %F.db4: %F.type.042 = struct_value () [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Main.NonInstance: type = import_ref Main//lib, NonInstance, loaded [concrete = constants.%NonInstance.type] +// CHECK:STDOUT: %Main.Instance = import_ref Main//lib, Instance, unloaded +// CHECK:STDOUT: %Main.import_ref.c55 = import_ref Main//lib, inst15 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.69f: %NonInstance.assoc_type = import_ref Main//lib, loc4_9, loaded [concrete = constants.%assoc0] +// CHECK:STDOUT: %Main.F: %F.type.9e5 = import_ref Main//lib, F, loaded [concrete = constants.%F.4e4] +// CHECK:STDOUT: %Main.import_ref.f85: %NonInstance.type = import_ref Main//lib, inst15 [no loc], loaded [symbolic = constants.%Self.73c] +// CHECK:STDOUT: %Main.import_ref.826: = import_ref Main//lib, loc7_30, loaded [concrete = constants.%impl_witness] +// CHECK:STDOUT: %Main.import_ref.ded207.1: type = import_ref Main//lib, loc7_13, loaded [concrete = constants.%struct_type.i] +// CHECK:STDOUT: %Main.import_ref.ef5: type = import_ref Main//lib, loc7_18, loaded [concrete = constants.%NonInstance.type] +// CHECK:STDOUT: %Main.import_ref.dcd = import_ref Main//lib, inst39 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.c1d = import_ref Main//lib, loc12_21, unloaded +// CHECK:STDOUT: %Main.G = import_ref Main//lib, G, unloaded +// CHECK:STDOUT: %Main.import_ref.ab2 = import_ref Main//lib, loc15_27, unloaded +// CHECK:STDOUT: %Main.import_ref.ded207.2: type = import_ref Main//lib, loc15_13, loaded [concrete = constants.%struct_type.i] +// CHECK:STDOUT: %Main.import_ref.b49: type = import_ref Main//lib, loc15_18, loaded [concrete = constants.%Instance.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .NonInstance = imports.%Main.NonInstance +// CHECK:STDOUT: .Instance = imports.%Main.Instance +// CHECK:STDOUT: .NonInstanceCallImport = %NonInstanceCallImport.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %default.import = import +// CHECK:STDOUT: %NonInstanceCallImport.decl: %NonInstanceCallImport.type = fn_decl @NonInstanceCallImport [concrete = constants.%NonInstanceCallImport] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @NonInstance [from "lib.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%Main.import_ref.c55 +// CHECK:STDOUT: .F = imports.%Main.import_ref.69f +// CHECK:STDOUT: witness = (imports.%Main.F) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @Instance [from "lib.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%Main.import_ref.dcd +// CHECK:STDOUT: .G = imports.%Main.import_ref.c1d +// CHECK:STDOUT: witness = (imports.%Main.G) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.c58: imports.%Main.import_ref.ded207.1 as imports.%Main.import_ref.ef5 [from "lib.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%Main.import_ref.826 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.477: imports.%Main.import_ref.ded207.2 as imports.%Main.import_ref.b49 [from "lib.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%Main.import_ref.ab2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @NonInstanceCallImport() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc6_9.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc6_9.2: type = converted %.loc6_9.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %struct_type.i: type = struct_type {.i: %empty_tuple.type} [concrete = constants.%struct_type.i] +// CHECK:STDOUT: %NonInstance.ref: type = name_ref NonInstance, imports.%Main.NonInstance [concrete = constants.%NonInstance.type] +// CHECK:STDOUT: %F.ref: %NonInstance.assoc_type = name_ref F, imports.%Main.import_ref.69f [concrete = constants.%assoc0] +// CHECK:STDOUT: %NonInstance.facet: %NonInstance.type = facet_value constants.%struct_type.i, constants.%impl_witness [concrete = constants.%NonInstance.facet] +// CHECK:STDOUT: %.loc6_11: %NonInstance.type = converted %struct_type.i, %NonInstance.facet [concrete = constants.%NonInstance.facet] +// CHECK:STDOUT: %as_wit: = facet_access_witness %.loc6_11 [concrete = constants.%impl_witness] +// CHECK:STDOUT: %impl.elem0: %.582 = impl_witness_access %as_wit, element0 [concrete = constants.%F.db4] +// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %impl.elem0() +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @F.1(imports.%Main.import_ref.f85: %NonInstance.type) [from "lib.carbon"] { +// CHECK:STDOUT: fn(); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F.2() [from "lib.carbon"]; +// CHECK:STDOUT: +// CHECK:STDOUT: specific @F.1(constants.%Self.73c) {} +// CHECK:STDOUT: +// 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.loc3_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: %Dest.param_patt: type = value_param_pattern %Dest.patt.loc3_22.1, runtime_param [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.param: type = value_param runtime_param +// CHECK:STDOUT: %Dest.loc3_22.1: type = bind_symbolic_name Dest, 0, %Dest.param [symbolic = %Dest.loc3_22.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc3_22.1: type) { +// CHECK:STDOUT: %Dest.loc3_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc3_22.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc3_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc3_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.loc3_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.loc4_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc4_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.loc4_20.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: @Convert.%Dest (%Dest) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Convert.%Dest (%Dest) = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc3_22.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc4_20.1: type = splice_block %.loc4_20.3 [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %.loc4_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, %.loc4_20.2 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc4_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc4_20.3: type = converted %Self.ref, %Self.as_type.loc4_20.2 [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.%Dest (%Dest) = out_param runtime_param1 +// CHECK:STDOUT: %return: ref @Convert.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc4_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc4_35.2 (constants.%assoc0)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc4_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert(@ImplicitAs.%Dest.loc3_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.loc4_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type)]() -> @Convert.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc3_22.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc3_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.loc4_20.1 => constants.%Self.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(%Dest.loc3_22.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_import_non-instance.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %struct_type.i: type = struct_type {.i: %empty_tuple.type} [concrete] +// CHECK:STDOUT: %NonInstanceCallImportFail.type: type = fn_type @NonInstanceCallImportFail [concrete] +// CHECK:STDOUT: %NonInstanceCallImportFail: %NonInstanceCallImportFail.type = struct_value () [concrete] +// CHECK:STDOUT: %NonInstance.type: type = facet_type <@NonInstance> [concrete] +// CHECK:STDOUT: %Self.73c: %NonInstance.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %NonInstance.assoc_type: type = assoc_entity_type %NonInstance.type [concrete] +// CHECK:STDOUT: %assoc0.3d0: %NonInstance.assoc_type = assoc_entity element0, imports.%Main.import_ref.bb3 [concrete] +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [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.43db8b.1: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.1 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.a4a: type = facet_type <@ImplicitAs, @ImplicitAs(%NonInstance.type)> [concrete] +// CHECK:STDOUT: %Convert.type.0a7: type = fn_type @Convert, @ImplicitAs(%NonInstance.type) [concrete] +// CHECK:STDOUT: %Convert.c2d: %Convert.type.0a7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.assoc_type.ffd: type = assoc_entity_type %ImplicitAs.type.a4a [concrete] +// CHECK:STDOUT: %assoc0.ff2: %ImplicitAs.assoc_type.ffd = assoc_entity element0, imports.%Core.import_ref.207961.1 [concrete] +// CHECK:STDOUT: %assoc0.43db8b.2: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.2 [symbolic] +// CHECK:STDOUT: %Instance.type: type = facet_type <@Instance> [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Main.NonInstance: type = import_ref Main//lib, NonInstance, loaded [concrete = constants.%NonInstance.type] +// CHECK:STDOUT: %Main.Instance = import_ref Main//lib, Instance, unloaded +// 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.c55 = import_ref Main//lib, inst15 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.69f: %NonInstance.assoc_type = import_ref Main//lib, loc4_9, loaded [concrete = constants.%assoc0.3d0] +// CHECK:STDOUT: %Main.F: %F.type = import_ref Main//lib, F, loaded [concrete = constants.%F] +// CHECK:STDOUT: %Main.import_ref.f85: %NonInstance.type = import_ref Main//lib, inst15 [no loc], loaded [symbolic = constants.%Self.73c] +// CHECK:STDOUT: %Core.import_ref.ffd566.1: type = import_ref Core//default, loc3_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst26 [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.43db8b.2)] +// CHECK:STDOUT: %Core.Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, Convert, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] +// CHECK:STDOUT: %Core.import_ref.ffd566.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, inst26 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] +// CHECK:STDOUT: %Core.import_ref.207961.1 = import_ref Core//default, loc4_35, unloaded +// CHECK:STDOUT: %Main.import_ref.112 = import_ref Main//lib, loc7_30, unloaded +// CHECK:STDOUT: %Main.import_ref.ded207.1: type = import_ref Main//lib, loc7_13, loaded [concrete = constants.%struct_type.i] +// CHECK:STDOUT: %Main.import_ref.ef5: type = import_ref Main//lib, loc7_18, loaded [concrete = constants.%NonInstance.type] +// CHECK:STDOUT: %Main.import_ref.dcd = import_ref Main//lib, inst39 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.c1d = import_ref Main//lib, loc12_21, unloaded +// CHECK:STDOUT: %Main.G = import_ref Main//lib, G, unloaded +// CHECK:STDOUT: %Main.import_ref.ab2 = import_ref Main//lib, loc15_27, unloaded +// CHECK:STDOUT: %Main.import_ref.ded207.2: type = import_ref Main//lib, loc15_13, loaded [concrete = constants.%struct_type.i] +// CHECK:STDOUT: %Main.import_ref.b49: type = import_ref Main//lib, loc15_18, loaded [concrete = constants.%Instance.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .NonInstance = imports.%Main.NonInstance +// CHECK:STDOUT: .Instance = imports.%Main.Instance +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .NonInstanceCallImportFail = %NonInstanceCallImportFail.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %default.import = import +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %NonInstanceCallImportFail.decl: %NonInstanceCallImportFail.type = fn_decl @NonInstanceCallImportFail [concrete = constants.%NonInstanceCallImportFail] { +// CHECK:STDOUT: %n.patt: %struct_type.i = binding_pattern n +// CHECK:STDOUT: %n.param_patt: %struct_type.i = value_param_pattern %n.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %n.param: %struct_type.i = value_param runtime_param0 +// CHECK:STDOUT: %.loc6_40: type = splice_block %struct_type.i [concrete = constants.%struct_type.i] { +// CHECK:STDOUT: %.loc6_39.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc6_39.2: type = converted %.loc6_39.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %struct_type.i: type = struct_type {.i: %empty_tuple.type} [concrete = constants.%struct_type.i] +// CHECK:STDOUT: } +// CHECK:STDOUT: %n: %struct_type.i = bind_name n, %n.param +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @NonInstance [from "lib.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%Main.import_ref.c55 +// CHECK:STDOUT: .F = imports.%Main.import_ref.69f +// CHECK:STDOUT: witness = (imports.%Main.F) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.ffd566.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.207961.1 [symbolic = %assoc0 (constants.%assoc0.43db8b.1)] +// 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: interface @Instance [from "lib.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%Main.import_ref.dcd +// CHECK:STDOUT: .G = imports.%Main.import_ref.c1d +// CHECK:STDOUT: witness = (imports.%Main.G) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.c58: imports.%Main.import_ref.ded207.1 as imports.%Main.import_ref.ef5 [from "lib.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%Main.import_ref.112 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.477: imports.%Main.import_ref.ded207.2 as imports.%Main.import_ref.b49 [from "lib.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%Main.import_ref.ab2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @NonInstanceCallImportFail(%n.param_patt: %struct_type.i) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %n.ref: %struct_type.i = name_ref n, %n +// CHECK:STDOUT: %NonInstance.ref: type = name_ref NonInstance, imports.%Main.NonInstance [concrete = constants.%NonInstance.type] +// CHECK:STDOUT: %F.ref: %NonInstance.assoc_type = name_ref F, imports.%Main.import_ref.69f [concrete = constants.%assoc0.3d0] +// CHECK:STDOUT: %.loc14: %NonInstance.type = converted %n.ref, [concrete = ] +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @F(imports.%Main.import_ref.f85: %NonInstance.type) [from "lib.carbon"] { +// CHECK:STDOUT: fn(); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.ffd566.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: specific @F(constants.%Self.73c) {} +// 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.%NonInstance.type) { +// CHECK:STDOUT: %Dest => constants.%NonInstance.type +// CHECK:STDOUT: %Dest.patt => constants.%NonInstance.type +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.a4a +// CHECK:STDOUT: %Self => constants.%Self.519 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.0a7 +// CHECK:STDOUT: %Convert => constants.%Convert.c2d +// CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.ffd +// CHECK:STDOUT: %assoc0 => constants.%assoc0.ff2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_import_non-instance_indirect.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %struct_type.i: type = struct_type {.i: %empty_tuple.type} [concrete] +// CHECK:STDOUT: %ptr: type = ptr_type %struct_type.i [concrete] +// CHECK:STDOUT: %NonInstanceCallIndirectImport.type: type = fn_type @NonInstanceCallIndirectImport [concrete] +// CHECK:STDOUT: %NonInstanceCallIndirectImport: %NonInstanceCallIndirectImport.type = struct_value () [concrete] +// CHECK:STDOUT: %NonInstance.type: type = facet_type <@NonInstance> [concrete] +// CHECK:STDOUT: %Self.73c: %NonInstance.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %NonInstance.assoc_type: type = assoc_entity_type %NonInstance.type [concrete] +// CHECK:STDOUT: %assoc0.3d0: %NonInstance.assoc_type = assoc_entity element0, imports.%Main.import_ref.bb3 [concrete] +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [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.43db8b.1: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.1 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.a4a: type = facet_type <@ImplicitAs, @ImplicitAs(%NonInstance.type)> [concrete] +// CHECK:STDOUT: %Convert.type.0a7: type = fn_type @Convert, @ImplicitAs(%NonInstance.type) [concrete] +// CHECK:STDOUT: %Convert.c2d: %Convert.type.0a7 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.assoc_type.ffd: type = assoc_entity_type %ImplicitAs.type.a4a [concrete] +// CHECK:STDOUT: %assoc0.ff2: %ImplicitAs.assoc_type.ffd = assoc_entity element0, imports.%Core.import_ref.207961.1 [concrete] +// CHECK:STDOUT: %assoc0.43db8b.2: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.2 [symbolic] +// CHECK:STDOUT: %Instance.type: type = facet_type <@Instance> [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Main.NonInstance: type = import_ref Main//lib, NonInstance, loaded [concrete = constants.%NonInstance.type] +// CHECK:STDOUT: %Main.Instance = import_ref Main//lib, Instance, unloaded +// 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.c55 = import_ref Main//lib, inst15 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.69f: %NonInstance.assoc_type = import_ref Main//lib, loc4_9, loaded [concrete = constants.%assoc0.3d0] +// CHECK:STDOUT: %Main.F: %F.type = import_ref Main//lib, F, loaded [concrete = constants.%F] +// CHECK:STDOUT: %Main.import_ref.f85: %NonInstance.type = import_ref Main//lib, inst15 [no loc], loaded [symbolic = constants.%Self.73c] +// CHECK:STDOUT: %Core.import_ref.ffd566.1: type = import_ref Core//default, loc3_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst26 [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.43db8b.2)] +// CHECK:STDOUT: %Core.Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, Convert, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] +// CHECK:STDOUT: %Core.import_ref.ffd566.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, inst26 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] +// CHECK:STDOUT: %Core.import_ref.207961.1 = import_ref Core//default, loc4_35, unloaded +// CHECK:STDOUT: %Main.import_ref.112 = import_ref Main//lib, loc7_30, unloaded +// CHECK:STDOUT: %Main.import_ref.ded207.1: type = import_ref Main//lib, loc7_13, loaded [concrete = constants.%struct_type.i] +// CHECK:STDOUT: %Main.import_ref.ef5: type = import_ref Main//lib, loc7_18, loaded [concrete = constants.%NonInstance.type] +// CHECK:STDOUT: %Main.import_ref.dcd = import_ref Main//lib, inst39 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.c1d = import_ref Main//lib, loc12_21, unloaded +// CHECK:STDOUT: %Main.G = import_ref Main//lib, G, unloaded +// CHECK:STDOUT: %Main.import_ref.ab2 = import_ref Main//lib, loc15_27, unloaded +// CHECK:STDOUT: %Main.import_ref.ded207.2: type = import_ref Main//lib, loc15_13, loaded [concrete = constants.%struct_type.i] +// CHECK:STDOUT: %Main.import_ref.b49: type = import_ref Main//lib, loc15_18, loaded [concrete = constants.%Instance.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .NonInstance = imports.%Main.NonInstance +// CHECK:STDOUT: .Instance = imports.%Main.Instance +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .NonInstanceCallIndirectImport = %NonInstanceCallIndirectImport.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %default.import = import +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %NonInstanceCallIndirectImport.decl: %NonInstanceCallIndirectImport.type = fn_decl @NonInstanceCallIndirectImport [concrete = constants.%NonInstanceCallIndirectImport] { +// CHECK:STDOUT: %p.patt: %ptr = binding_pattern p +// CHECK:STDOUT: %p.param_patt: %ptr = value_param_pattern %p.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %p.param: %ptr = value_param runtime_param0 +// CHECK:STDOUT: %.loc6_45: type = splice_block %ptr [concrete = constants.%ptr] { +// CHECK:STDOUT: %.loc6_43.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc6_43.2: type = converted %.loc6_43.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %struct_type.i: type = struct_type {.i: %empty_tuple.type} [concrete = constants.%struct_type.i] +// CHECK:STDOUT: %ptr: type = ptr_type %struct_type.i [concrete = constants.%ptr] +// CHECK:STDOUT: } +// CHECK:STDOUT: %p: %ptr = bind_name p, %p.param +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @NonInstance [from "lib.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%Main.import_ref.c55 +// CHECK:STDOUT: .F = imports.%Main.import_ref.69f +// CHECK:STDOUT: witness = (imports.%Main.F) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.ffd566.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.207961.1 [symbolic = %assoc0 (constants.%assoc0.43db8b.1)] +// 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: interface @Instance [from "lib.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%Main.import_ref.dcd +// CHECK:STDOUT: .G = imports.%Main.import_ref.c1d +// CHECK:STDOUT: witness = (imports.%Main.G) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.c58: imports.%Main.import_ref.ded207.1 as imports.%Main.import_ref.ef5 [from "lib.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%Main.import_ref.112 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.477: imports.%Main.import_ref.ded207.2 as imports.%Main.import_ref.b49 [from "lib.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%Main.import_ref.ab2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @NonInstanceCallIndirectImport(%p.param_patt: %ptr) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %p.ref: %ptr = name_ref p, %p +// CHECK:STDOUT: %NonInstance.ref: type = name_ref NonInstance, imports.%Main.NonInstance [concrete = constants.%NonInstance.type] +// CHECK:STDOUT: %F.ref: %NonInstance.assoc_type = name_ref F, imports.%Main.import_ref.69f [concrete = constants.%assoc0.3d0] +// CHECK:STDOUT: %.loc14_4.1: ref %struct_type.i = deref %p.ref +// CHECK:STDOUT: %.loc14_4.2: %NonInstance.type = converted %.loc14_4.1, [concrete = ] +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @F(imports.%Main.import_ref.f85: %NonInstance.type) [from "lib.carbon"] { +// CHECK:STDOUT: fn(); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.ffd566.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: specific @F(constants.%Self.73c) {} +// 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.%NonInstance.type) { +// CHECK:STDOUT: %Dest => constants.%NonInstance.type +// CHECK:STDOUT: %Dest.patt => constants.%NonInstance.type +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.a4a +// CHECK:STDOUT: %Self => constants.%Self.519 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.0a7 +// CHECK:STDOUT: %Convert => constants.%Convert.c2d +// CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.ffd +// CHECK:STDOUT: %assoc0 => constants.%assoc0.ff2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- import_instance_success.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %struct_type.i: type = struct_type {.i: %empty_tuple.type} [concrete] +// CHECK:STDOUT: %InstanceCallImport.type: type = fn_type @InstanceCallImport [concrete] +// CHECK:STDOUT: %InstanceCallImport: %InstanceCallImport.type = struct_value () [concrete] +// CHECK:STDOUT: %Instance.type: type = facet_type <@Instance> [concrete] +// CHECK:STDOUT: %Self.cf8: %Instance.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Instance.assoc_type: type = assoc_entity_type %Instance.type [concrete] +// CHECK:STDOUT: %assoc0: %Instance.assoc_type = assoc_entity element0, imports.%Main.import_ref.b4d [concrete] +// CHECK:STDOUT: %G.type.1e1: type = fn_type @G.1 [concrete] +// CHECK:STDOUT: %G.449: %G.type.1e1 = struct_value () [concrete] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.cf8 [symbolic] +// CHECK:STDOUT: %NonInstance.type: type = facet_type <@NonInstance> [concrete] +// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%Main.import_ref.373) [concrete] +// CHECK:STDOUT: %Instance.facet: %Instance.type = facet_value %struct_type.i, %impl_witness [concrete] +// CHECK:STDOUT: %.6d8: type = fn_type_with_self_type %G.type.1e1, %Instance.facet [concrete] +// CHECK:STDOUT: %G.type.0c0: type = fn_type @G.2 [concrete] +// CHECK:STDOUT: %G.484: %G.type.0c0 = struct_value () [concrete] +// CHECK:STDOUT: %ptr: type = ptr_type %struct_type.i [concrete] +// CHECK:STDOUT: %InstanceCallIndirectImport.type: type = fn_type @InstanceCallIndirectImport [concrete] +// CHECK:STDOUT: %InstanceCallIndirectImport: %InstanceCallIndirectImport.type = struct_value () [concrete] +// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] +// CHECK:STDOUT: %struct: %struct_type.i = struct_value (%empty_tuple) [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Main.NonInstance = import_ref Main//lib, NonInstance, unloaded +// CHECK:STDOUT: %Main.Instance: type = import_ref Main//lib, Instance, loaded [concrete = constants.%Instance.type] +// CHECK:STDOUT: %Main.import_ref.dcd = import_ref Main//lib, inst39 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.7cb: %Instance.assoc_type = import_ref Main//lib, loc12_21, loaded [concrete = constants.%assoc0] +// CHECK:STDOUT: %Main.G: %G.type.1e1 = import_ref Main//lib, G, loaded [concrete = constants.%G.449] +// CHECK:STDOUT: %Main.import_ref.0d8: %Instance.type = import_ref Main//lib, inst39 [no loc], loaded [symbolic = constants.%Self.cf8] +// CHECK:STDOUT: %Main.import_ref.c55 = import_ref Main//lib, inst15 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.93f = import_ref Main//lib, loc4_9, unloaded +// CHECK:STDOUT: %Main.F = import_ref Main//lib, F, unloaded +// CHECK:STDOUT: %Main.import_ref.112 = import_ref Main//lib, loc7_30, unloaded +// CHECK:STDOUT: %Main.import_ref.ded207.1: type = import_ref Main//lib, loc7_13, loaded [concrete = constants.%struct_type.i] +// CHECK:STDOUT: %Main.import_ref.ef5: type = import_ref Main//lib, loc7_18, loaded [concrete = constants.%NonInstance.type] +// CHECK:STDOUT: %Main.import_ref.97c: = import_ref Main//lib, loc15_27, loaded [concrete = constants.%impl_witness] +// CHECK:STDOUT: %Main.import_ref.ded207.2: type = import_ref Main//lib, loc15_13, loaded [concrete = constants.%struct_type.i] +// CHECK:STDOUT: %Main.import_ref.b49: type = import_ref Main//lib, loc15_18, loaded [concrete = constants.%Instance.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .NonInstance = imports.%Main.NonInstance +// CHECK:STDOUT: .Instance = imports.%Main.Instance +// CHECK:STDOUT: .InstanceCallImport = %InstanceCallImport.decl +// CHECK:STDOUT: .InstanceCallIndirectImport = %InstanceCallIndirectImport.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %default.import = import +// CHECK:STDOUT: %InstanceCallImport.decl: %InstanceCallImport.type = fn_decl @InstanceCallImport [concrete = constants.%InstanceCallImport] { +// CHECK:STDOUT: %n.patt: %struct_type.i = binding_pattern n +// CHECK:STDOUT: %n.param_patt: %struct_type.i = value_param_pattern %n.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %n.param: %struct_type.i = value_param runtime_param0 +// CHECK:STDOUT: %.loc5_33: type = splice_block %struct_type.i [concrete = constants.%struct_type.i] { +// CHECK:STDOUT: %.loc5_32.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc5_32.2: type = converted %.loc5_32.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %struct_type.i: type = struct_type {.i: %empty_tuple.type} [concrete = constants.%struct_type.i] +// CHECK:STDOUT: } +// CHECK:STDOUT: %n: %struct_type.i = bind_name n, %n.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %InstanceCallIndirectImport.decl: %InstanceCallIndirectImport.type = fn_decl @InstanceCallIndirectImport [concrete = constants.%InstanceCallIndirectImport] { +// CHECK:STDOUT: %p.patt: %ptr = binding_pattern p +// CHECK:STDOUT: %p.param_patt: %ptr = value_param_pattern %p.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %p.param: %ptr = value_param runtime_param0 +// CHECK:STDOUT: %.loc9_42: type = splice_block %ptr [concrete = constants.%ptr] { +// CHECK:STDOUT: %.loc9_40.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc9_40.2: type = converted %.loc9_40.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %struct_type.i: type = struct_type {.i: %empty_tuple.type} [concrete = constants.%struct_type.i] +// CHECK:STDOUT: %ptr: type = ptr_type %struct_type.i [concrete = constants.%ptr] +// CHECK:STDOUT: } +// CHECK:STDOUT: %p: %ptr = bind_name p, %p.param +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @Instance [from "lib.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%Main.import_ref.dcd +// CHECK:STDOUT: .G = imports.%Main.import_ref.7cb +// CHECK:STDOUT: witness = (imports.%Main.G) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @NonInstance [from "lib.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%Main.import_ref.c55 +// CHECK:STDOUT: .F = imports.%Main.import_ref.93f +// CHECK:STDOUT: witness = (imports.%Main.F) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.c58: imports.%Main.import_ref.ded207.1 as imports.%Main.import_ref.ef5 [from "lib.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%Main.import_ref.112 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.477: imports.%Main.import_ref.ded207.2 as imports.%Main.import_ref.b49 [from "lib.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%Main.import_ref.97c +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @InstanceCallImport(%n.param_patt: %struct_type.i) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %n.ref: %struct_type.i = name_ref n, %n +// CHECK:STDOUT: %Instance.ref: type = name_ref Instance, imports.%Main.Instance [concrete = constants.%Instance.type] +// CHECK:STDOUT: %G.ref: %Instance.assoc_type = name_ref G, imports.%Main.import_ref.7cb [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0: %.6d8 = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%G.484] +// CHECK:STDOUT: %bound_method: = bound_method %n.ref, %impl.elem0 +// CHECK:STDOUT: %G.call: init %empty_tuple.type = call %bound_method(%n.ref) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @G.1(imports.%Main.import_ref.0d8: %Instance.type) [from "lib.carbon"] { +// CHECK:STDOUT: %Self: %Instance.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.cf8)] +// 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: @G.1.%Self.as_type (%Self.as_type)](); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @G.2[%self.param_patt: %struct_type.i]() [from "lib.carbon"]; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @InstanceCallIndirectImport(%p.param_patt: %ptr) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %p.ref: %ptr = name_ref p, %p +// CHECK:STDOUT: %Instance.ref: type = name_ref Instance, imports.%Main.Instance [concrete = constants.%Instance.type] +// CHECK:STDOUT: %G.ref: %Instance.assoc_type = name_ref G, imports.%Main.import_ref.7cb [concrete = constants.%assoc0] +// CHECK:STDOUT: %.loc10_4.1: ref %struct_type.i = deref %p.ref +// CHECK:STDOUT: %impl.elem0: %.6d8 = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%G.484] +// CHECK:STDOUT: %bound_method: = bound_method %.loc10_4.1, %impl.elem0 +// CHECK:STDOUT: %.loc10_4.2: ref %empty_tuple.type = struct_access %.loc10_4.1, element0 +// CHECK:STDOUT: %tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc10_4.3: %empty_tuple.type = converted %.loc10_4.2, %tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %struct: %struct_type.i = struct_value (%.loc10_4.3) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc10_4.4: %struct_type.i = converted %.loc10_4.1, %struct [concrete = constants.%struct] +// CHECK:STDOUT: %G.call: init %empty_tuple.type = call %bound_method(%.loc10_4.4) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @G.1(constants.%Self.cf8) { +// CHECK:STDOUT: %Self => constants.%Self.cf8 +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_import_instance.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %InstanceCallImportFail.type: type = fn_type @InstanceCallImportFail [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %InstanceCallImportFail: %InstanceCallImportFail.type = struct_value () [concrete] +// CHECK:STDOUT: %struct_type.i: type = struct_type {.i: %empty_tuple.type} [concrete] +// CHECK:STDOUT: %Instance.type: type = facet_type <@Instance> [concrete] +// CHECK:STDOUT: %Self.cf8: %Instance.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Instance.assoc_type: type = assoc_entity_type %Instance.type [concrete] +// CHECK:STDOUT: %assoc0: %Instance.assoc_type = assoc_entity element0, imports.%Main.import_ref.19f [concrete] +// CHECK:STDOUT: %G.type: type = fn_type @G [concrete] +// CHECK:STDOUT: %G: %G.type = struct_value () [concrete] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.cf8 [symbolic] +// CHECK:STDOUT: %NonInstance.type: type = facet_type <@NonInstance> [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Main.NonInstance = import_ref Main//lib, NonInstance, unloaded +// CHECK:STDOUT: %Main.Instance: type = import_ref Main//lib, Instance, loaded [concrete = constants.%Instance.type] +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: import Core//default +// CHECK:STDOUT: } +// CHECK:STDOUT: %Main.import_ref.dcd = import_ref Main//lib, inst39 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.7cb: %Instance.assoc_type = import_ref Main//lib, loc12_21, loaded [concrete = constants.%assoc0] +// CHECK:STDOUT: %Main.G: %G.type = import_ref Main//lib, G, loaded [concrete = constants.%G] +// CHECK:STDOUT: %Main.import_ref.0d8: %Instance.type = import_ref Main//lib, inst39 [no loc], loaded [symbolic = constants.%Self.cf8] +// CHECK:STDOUT: %Main.import_ref.c55 = import_ref Main//lib, inst15 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.93f = import_ref Main//lib, loc4_9, unloaded +// CHECK:STDOUT: %Main.F = import_ref Main//lib, F, unloaded +// CHECK:STDOUT: %Main.import_ref.112 = import_ref Main//lib, loc7_30, unloaded +// CHECK:STDOUT: %Main.import_ref.ded207.1: type = import_ref Main//lib, loc7_13, loaded [concrete = constants.%struct_type.i] +// CHECK:STDOUT: %Main.import_ref.ef5: type = import_ref Main//lib, loc7_18, loaded [concrete = constants.%NonInstance.type] +// CHECK:STDOUT: %Main.import_ref.ab2 = import_ref Main//lib, loc15_27, unloaded +// CHECK:STDOUT: %Main.import_ref.ded207.2: type = import_ref Main//lib, loc15_13, loaded [concrete = constants.%struct_type.i] +// CHECK:STDOUT: %Main.import_ref.b49: type = import_ref Main//lib, loc15_18, loaded [concrete = constants.%Instance.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .NonInstance = imports.%Main.NonInstance +// CHECK:STDOUT: .Instance = imports.%Main.Instance +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .InstanceCallImportFail = %InstanceCallImportFail.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %default.import = import +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %InstanceCallImportFail.decl: %InstanceCallImportFail.type = fn_decl @InstanceCallImportFail [concrete = constants.%InstanceCallImportFail] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @Instance [from "lib.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%Main.import_ref.dcd +// CHECK:STDOUT: .G = imports.%Main.import_ref.7cb +// CHECK:STDOUT: witness = (imports.%Main.G) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @NonInstance [from "lib.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%Main.import_ref.c55 +// CHECK:STDOUT: .F = imports.%Main.import_ref.93f +// CHECK:STDOUT: witness = (imports.%Main.F) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.c58: imports.%Main.import_ref.ded207.1 as imports.%Main.import_ref.ef5 [from "lib.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%Main.import_ref.112 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.477: imports.%Main.import_ref.ded207.2 as imports.%Main.import_ref.b49 [from "lib.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%Main.import_ref.ab2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @InstanceCallImportFail() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc11_9.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc11_9.2: type = converted %.loc11_9.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %struct_type.i: type = struct_type {.i: %empty_tuple.type} [concrete = constants.%struct_type.i] +// CHECK:STDOUT: %Instance.ref: type = name_ref Instance, imports.%Main.Instance [concrete = constants.%Instance.type] +// CHECK:STDOUT: %G.ref: %Instance.assoc_type = name_ref G, imports.%Main.import_ref.7cb [concrete = constants.%assoc0] +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @G(imports.%Main.import_ref.0d8: %Instance.type) [from "lib.carbon"] { +// CHECK:STDOUT: %Self: %Instance.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.cf8)] +// 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: @G.%Self.as_type (%Self.as_type)](); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @G(constants.%Self.cf8) { +// CHECK:STDOUT: %Self => constants.%Self.cf8 +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/no_prelude/import_use_generic.carbon b/toolchain/check/testdata/impl/no_prelude/import_use_generic.carbon index d694438786634..647c280b24f2e 100644 --- a/toolchain/check/testdata/impl/no_prelude/import_use_generic.carbon +++ b/toolchain/check/testdata/impl/no_prelude/import_use_generic.carbon @@ -31,14 +31,23 @@ import library "import_generic"; var c: C({}) = {}; // We're just checking that this doesn't crash. It's not expected to compile. // CHECK:STDERR: fail_use_in_fn_decl.carbon:[[@LINE+8]]:11: error: `Core.ImplicitAs` implicitly referenced here, but package `Core` not found [CoreNotFound] -// CHECK:STDERR: fn F() -> c.(I.F)() {} -// CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: fn G() -> c.(I.F)() {} +// CHECK:STDERR: ^~~~~~~ // CHECK:STDERR: // CHECK:STDERR: fail_use_in_fn_decl.carbon:[[@LINE+4]]:22: error: missing `return` at end of function with declared return type [MissingReturnStatement] -// CHECK:STDERR: fn F() -> c.(I.F)() {} +// CHECK:STDERR: fn G() -> c.(I.F)() {} // CHECK:STDERR: ^ // CHECK:STDERR: -fn F() -> c.(I.F)() {} +fn G() -> c.(I.F)() {} +// CHECK:STDERR: fail_use_in_fn_decl.carbon:[[@LINE+8]]:11: error: `Core.ImplicitAs` implicitly referenced here, but package `Core` not found [CoreNotFound] +// CHECK:STDERR: fn H() -> C({}).(I.F)() {} +// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: +// CHECK:STDERR: fail_use_in_fn_decl.carbon:[[@LINE+4]]:26: error: missing `return` at end of function with declared return type [MissingReturnStatement] +// CHECK:STDERR: fn H() -> C({}).(I.F)() {} +// CHECK:STDERR: ^ +// CHECK:STDERR: +fn H() -> C({}).(I.F)() {} // CHECK:STDOUT: --- import_generic.carbon // CHECK:STDOUT: @@ -189,20 +198,23 @@ fn F() -> c.(I.F)() {} // 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, imports.%Main.import_ref.e03 [concrete] +// CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, imports.%Main.import_ref.777 [concrete] +// CHECK:STDOUT: %F.type.cf0: type = fn_type @F.1 [concrete] +// CHECK:STDOUT: %F.bc6: %F.type.cf0 = struct_value () [concrete] +// CHECK:STDOUT: %G.type: type = fn_type @G [concrete] +// CHECK:STDOUT: %G: %G.type = struct_value () [concrete] // CHECK:STDOUT: %impl_witness.681: = impl_witness (imports.%Main.import_ref.e2c), @impl(%T) [symbolic] -// CHECK:STDOUT: %F.type.40c: type = fn_type @F.1, @impl(%T) [symbolic] +// CHECK:STDOUT: %F.type.40c: type = fn_type @F.2, @impl(%T) [symbolic] // CHECK:STDOUT: %F.071: %F.type.40c = struct_value () [symbolic] // CHECK:STDOUT: %impl_witness.02b: = impl_witness (imports.%Main.import_ref.e2c), @impl(%empty_struct_type) [concrete] // CHECK:STDOUT: %impl_witness.bbe: = impl_witness (imports.%Main.import_ref.c57), @impl(%T) [symbolic] -// CHECK:STDOUT: %F.type.4a4: type = fn_type @F.1, @impl(%empty_struct_type) [concrete] +// CHECK:STDOUT: %F.type.4a4: type = fn_type @F.2, @impl(%empty_struct_type) [concrete] // CHECK:STDOUT: %F.9e6: %F.type.4a4 = struct_value () [concrete] -// CHECK:STDOUT: %F.type.cf0: type = fn_type @F.2 [concrete] // CHECK:STDOUT: %I.facet: %I.type = facet_value %C.7a7, %impl_witness.02b [concrete] // CHECK:STDOUT: %.c06: type = fn_type_with_self_type %F.type.cf0, %I.facet [concrete] -// CHECK:STDOUT: %F.specific_fn: = specific_function %F.9e6, @F.1(%empty_struct_type) [concrete] -// CHECK:STDOUT: %F.type.b25: type = fn_type @F.3 [concrete] -// CHECK:STDOUT: %F.c41: %F.type.b25 = struct_value () [concrete] +// CHECK:STDOUT: %F.specific_fn: = specific_function %F.9e6, @F.2(%empty_struct_type) [concrete] +// CHECK:STDOUT: %H.type: type = fn_type @H [concrete] +// CHECK:STDOUT: %H: %H.type = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -213,14 +225,14 @@ fn F() -> c.(I.F)() {} // CHECK:STDOUT: %Main.import_ref.4c0 = import_ref Main//import_generic, inst25 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.e5d = import_ref Main//import_generic, inst31 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.bcb: %I.assoc_type = import_ref Main//import_generic, loc7_9, loaded [concrete = constants.%assoc0] -// CHECK:STDOUT: %Main.F = import_ref Main//import_generic, F, unloaded +// CHECK:STDOUT: %Main.F: %F.type.cf0 = import_ref Main//import_generic, F, loaded [concrete = constants.%F.bc6] +// CHECK:STDOUT: %Main.import_ref.5dd: %I.type = import_ref Main//import_generic, inst31 [no loc], loaded [symbolic = constants.%Self] // CHECK:STDOUT: %Main.import_ref.d91: = import_ref Main//import_generic, loc10_34, loaded [symbolic = @impl.%impl_witness (constants.%impl_witness.bbe)] // CHECK:STDOUT: %Main.import_ref.f6b058.2: type = import_ref Main//import_generic, loc10_14, loaded [symbolic = @impl.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.499: type = import_ref Main//import_generic, loc10_27, loaded [symbolic = @impl.%C (constants.%C.f2e)] // CHECK:STDOUT: %Main.import_ref.301: type = import_ref Main//import_generic, loc10_32, loaded [concrete = constants.%I.type] // CHECK:STDOUT: %Main.import_ref.e2c: @impl.%F.type (%F.type.40c) = import_ref Main//import_generic, loc11_10, loaded [symbolic = @impl.%F (constants.%F.071)] // CHECK:STDOUT: %Main.import_ref.f6b058.3: type = import_ref Main//import_generic, loc10_14, loaded [symbolic = @impl.%T (constants.%T)] -// CHECK:STDOUT: %Main.import_ref.5dd: %I.type = import_ref Main//import_generic, inst31 [no loc], loaded [symbolic = constants.%Self] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -228,7 +240,8 @@ fn F() -> c.(I.F)() {} // CHECK:STDOUT: .C = imports.%Main.C // CHECK:STDOUT: .I = imports.%Main.I // CHECK:STDOUT: .c = %c -// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: .H = %H.decl // CHECK:STDOUT: } // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: name_binding_decl { @@ -243,19 +256,36 @@ fn F() -> c.(I.F)() {} // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%empty_struct_type) [concrete = constants.%C.7a7] // CHECK:STDOUT: } // CHECK:STDOUT: %c: ref %C.7a7 = bind_name c, %c.var -// CHECK:STDOUT: %F.decl: %F.type.b25 = fn_decl @F.3 [concrete = constants.%F.c41] { +// CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] { // CHECK:STDOUT: %return.patt: = return_slot_pattern // CHECK:STDOUT: %return.param_patt: = out_param_pattern %return.patt, runtime_param0 // CHECK:STDOUT: } { // CHECK:STDOUT: %c.ref: ref %C.7a7 = name_ref c, file.%c // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] // CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, imports.%Main.import_ref.bcb [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0: %.c06 = impl_witness_access constants.%impl_witness.02b, element0 [concrete = constants.%F.9e6] -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @F.1(constants.%empty_struct_type) [concrete = constants.%F.specific_fn] +// CHECK:STDOUT: %.loc16: %I.type = converted %c.ref, [concrete = ] +// CHECK:STDOUT: %return.param: ref = out_param runtime_param0 +// CHECK:STDOUT: %return: ref = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %H.decl: %H.type = fn_decl @H [concrete = constants.%H] { +// CHECK:STDOUT: %return.patt: = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%Main.C [concrete = constants.%C.generic] +// CHECK:STDOUT: %.loc25_14: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc25_15: type = converted %.loc25_14, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %C: type = class_type @C, @C(constants.%empty_struct_type) [concrete = constants.%C.7a7] +// CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] +// CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, imports.%Main.import_ref.bcb [concrete = constants.%assoc0] +// CHECK:STDOUT: %I.facet: %I.type = facet_value constants.%C.7a7, constants.%impl_witness.02b [concrete = constants.%I.facet] +// CHECK:STDOUT: %.loc25_16: %I.type = converted %C, %I.facet [concrete = constants.%I.facet] +// CHECK:STDOUT: %as_wit: = facet_access_witness %.loc25_16 [concrete = constants.%impl_witness.02b] +// CHECK:STDOUT: %impl.elem0: %.c06 = impl_witness_access %as_wit, element0 [concrete = constants.%F.9e6] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @F.2(constants.%empty_struct_type) [concrete = constants.%F.specific_fn] // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %specific_fn() -// CHECK:STDOUT: %.loc16_19.1: ref %empty_tuple.type = temporary_storage -// CHECK:STDOUT: %.loc16_19.2: ref %empty_tuple.type = temporary %.loc16_19.1, %F.call -// CHECK:STDOUT: %.loc16_19.3: type = converted %F.call, [concrete = ] +// CHECK:STDOUT: %.loc25_23.1: ref %empty_tuple.type = temporary_storage +// CHECK:STDOUT: %.loc25_23.2: ref %empty_tuple.type = temporary %.loc25_23.1, %F.call +// CHECK:STDOUT: %.loc25_23.3: type = converted %F.call, [concrete = ] // CHECK:STDOUT: %return.param: ref = out_param runtime_param0 // CHECK:STDOUT: %return: ref = return_slot %return.param // CHECK:STDOUT: } @@ -275,7 +305,7 @@ fn F() -> c.(I.F)() {} // CHECK:STDOUT: %impl_witness: = impl_witness (imports.%Main.import_ref.e2c), @impl(%T) [symbolic = %impl_witness (constants.%impl_witness.681)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %F.type: type = fn_type @F.1, @impl(%T) [symbolic = %F.type (constants.%F.type.40c)] +// CHECK:STDOUT: %F.type: type = fn_type @F.2, @impl(%T) [symbolic = %F.type (constants.%F.type.40c)] // CHECK:STDOUT: %F: @impl.%F.type (%F.type.40c) = struct_value () [symbolic = %F (constants.%F.071)] // CHECK:STDOUT: // CHECK:STDOUT: impl: imports.%Main.import_ref.499 as imports.%Main.import_ref.301 { @@ -298,17 +328,21 @@ fn F() -> c.(I.F)() {} // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F.1(imports.%Main.import_ref.f6b058.3: type) [from "import_generic.carbon"] { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @F.1(imports.%Main.import_ref.5dd: %I.type) [from "import_generic.carbon"] { // CHECK:STDOUT: fn(); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F.2(imports.%Main.import_ref.5dd: %I.type) [from "import_generic.carbon"] { +// CHECK:STDOUT: fn @G() -> { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @F.2(imports.%Main.import_ref.f6b058.3: type) [from "import_generic.carbon"] { +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: // CHECK:STDOUT: fn(); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.3() -> { +// CHECK:STDOUT: fn @H() -> { // CHECK:STDOUT: !entry: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -333,6 +367,8 @@ fn F() -> c.(I.F)() {} // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: specific @F.1(constants.%Self) {} +// CHECK:STDOUT: // CHECK:STDOUT: specific @impl(constants.%T) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: %T.patt => constants.%T @@ -348,7 +384,7 @@ fn F() -> c.(I.F)() {} // CHECK:STDOUT: // CHECK:STDOUT: specific @impl(%T) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%T) {} +// CHECK:STDOUT: specific @F.2(constants.%T) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @impl(constants.%empty_struct_type) { // CHECK:STDOUT: %T => constants.%empty_struct_type @@ -361,9 +397,7 @@ fn F() -> c.(I.F)() {} // CHECK:STDOUT: %F => constants.%F.9e6 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.2(constants.%Self) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%empty_struct_type) { +// CHECK:STDOUT: specific @F.2(constants.%empty_struct_type) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/no_prelude/interface_args.carbon b/toolchain/check/testdata/impl/no_prelude/interface_args.carbon index be3a3ab959638..8b09cb2afbba2 100644 --- a/toolchain/check/testdata/impl/no_prelude/interface_args.carbon +++ b/toolchain/check/testdata/impl/no_prelude/interface_args.carbon @@ -13,7 +13,7 @@ library "[[@TEST_NAME]]"; interface Action(T:! type) { - fn Op(); + fn Op[self: Self](); } class A {} @@ -21,7 +21,7 @@ class B {} class C {} impl A as Action(B) { - fn Op() {} + fn Op[self: Self]() {} } fn F(a: A) { a.(Action(B).Op)(); } @@ -47,7 +47,10 @@ fn G(a: A) { a.(Action(C).Op)(); } library "[[@TEST_NAME]]"; interface Factory(T:! type) { + // Non-instance class function fn Make() -> T; + // Instance method + fn Method[self: Self]() -> T; } class A {} @@ -55,28 +58,52 @@ class B {} impl A as Factory(B) { fn Make() -> B; + fn Method[self: Self]() -> B; } // --- factory.impl.carbon impl library "[[@TEST_NAME]]"; -fn MakeB(a: A) -> B { - return a.(Factory(B).Make)(); +fn MakeB() -> B { + return A.(Factory(B).Make)(); +} +fn InstanceB(a: A) -> B { + return a.(Factory(B).Method)(); +} + +// --- core.carbon +package Core; + +interface ImplicitAs(Dest:! type) { + fn Convert[self: Self]() -> Dest; } // --- fail_factory.impl.carbon impl library "[[@TEST_NAME]]"; +import Core; + class C {} -fn MakeC(a: A) -> C { - // CHECK:STDERR: fail_factory.impl.carbon:[[@LINE+4]]:10: error: cannot access member of interface `Factory(C)` in type `A` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: return a.(Factory(C).Make)(); +fn MakeC() -> C { + // CHECK:STDERR: fail_factory.impl.carbon:[[@LINE+7]]:10: error: cannot implicitly convert from `type` to `Factory(C)` [ImplicitAsConversionFailure] + // CHECK:STDERR: return A.(Factory(C).Make)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_factory.impl.carbon:[[@LINE+4]]:10: note: type `type` does not implement interface `Core.ImplicitAs(Factory(C))` [MissingImplInMemberAccessNote] + // CHECK:STDERR: return A.(Factory(C).Make)(); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + return A.(Factory(C).Make)(); +} + +fn InstanceC(a: A) -> C { + // CHECK:STDERR: fail_factory.impl.carbon:[[@LINE+4]]:10: error: cannot access member of interface `Factory(C)` in type `A` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: return a.(Factory(C).Method)(); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: - return a.(Factory(C).Make)(); + return a.(Factory(C).Method)(); } // CHECK:STDOUT: --- action.carbon @@ -89,6 +116,7 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %Action.generic: %Action.type.29c = struct_value () [concrete] // CHECK:STDOUT: %Action.type.cca: type = facet_type <@Action, @Action(%T)> [symbolic] // CHECK:STDOUT: %Self: %Action.type.cca = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] // CHECK:STDOUT: %Op.type.036: type = fn_type @Op.1, @Action(%T) [symbolic] // CHECK:STDOUT: %Op.6ed: %Op.type.036 = struct_value () [symbolic] // CHECK:STDOUT: %Action.assoc_type.8f9: type = assoc_entity_type %Action.type.cca [symbolic] @@ -157,22 +185,41 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %Op.type: type = fn_type @Op.1, @Action(%T.loc4_18.2) [symbolic = %Op.type (constants.%Op.type.036)] // CHECK:STDOUT: %Op: @Action.%Op.type (%Op.type.036) = struct_value () [symbolic = %Op (constants.%Op.6ed)] // CHECK:STDOUT: %Action.assoc_type: type = assoc_entity_type @Action.%Action.type (%Action.type.cca) [symbolic = %Action.assoc_type (constants.%Action.assoc_type.8f9)] -// CHECK:STDOUT: %assoc0.loc5_10.2: @Action.%Action.assoc_type (%Action.assoc_type.8f9) = assoc_entity element0, %Op.decl [symbolic = %assoc0.loc5_10.2 (constants.%assoc0.69b)] +// CHECK:STDOUT: %assoc0.loc5_22.2: @Action.%Action.assoc_type (%Action.assoc_type.8f9) = assoc_entity element0, %Op.decl [symbolic = %assoc0.loc5_22.2 (constants.%assoc0.69b)] // CHECK:STDOUT: // CHECK:STDOUT: interface { // CHECK:STDOUT: %Self.1: @Action.%Action.type (%Action.type.cca) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %Op.decl: @Action.%Op.type (%Op.type.036) = fn_decl @Op.1 [symbolic = @Action.%Op (constants.%Op.6ed)] {} {} -// CHECK:STDOUT: %assoc0.loc5_10.1: @Action.%Action.assoc_type (%Action.assoc_type.8f9) = assoc_entity element0, %Op.decl [symbolic = %assoc0.loc5_10.2 (constants.%assoc0.69b)] +// CHECK:STDOUT: %Op.decl: @Action.%Op.type (%Op.type.036) = fn_decl @Op.1 [symbolic = @Action.%Op (constants.%Op.6ed)] { +// CHECK:STDOUT: %self.patt: @Op.1.%Self.as_type.loc5_15.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Op.1.%Self.as_type.loc5_15.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @Op.1.%Self.as_type.loc5_15.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc5_15.1: type = splice_block %.loc5_15.3 [symbolic = %Self.as_type.loc5_15.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %.loc5_15.2: @Op.1.%Action.type (%Action.type.cca) = specific_constant @Action.%Self.1, @Action(constants.%T) [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.ref: @Op.1.%Action.type (%Action.type.cca) = name_ref Self, %.loc5_15.2 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc5_15.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_15.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc5_15.3: type = converted %Self.ref, %Self.as_type.loc5_15.2 [symbolic = %Self.as_type.loc5_15.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Op.1.%Self.as_type.loc5_15.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc5_22.1: @Action.%Action.assoc_type (%Action.assoc_type.8f9) = assoc_entity element0, %Op.decl [symbolic = %assoc0.loc5_22.2 (constants.%assoc0.69b)] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .Op = %assoc0.loc5_10.1 +// CHECK:STDOUT: .Op = %assoc0.loc5_22.1 // CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: %A.ref as %Action.type { -// CHECK:STDOUT: %Op.decl: %Op.type.4b4 = fn_decl @Op.2 [concrete = constants.%Op.40d] {} {} +// CHECK:STDOUT: %Op.decl: %Op.type.4b4 = fn_decl @Op.2 [concrete = constants.%Op.40d] { +// CHECK:STDOUT: %self.patt: %A = binding_pattern self +// CHECK:STDOUT: %self.param_patt: %A = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: %A = value_param runtime_param0 +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%A.ref [concrete = constants.%A] +// CHECK:STDOUT: %self: %A = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Op = %Op.decl @@ -204,10 +251,15 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @Op.1(@Action.%T.loc4_18.1: type, @Action.%Self.1: @Action.%Action.type (%Action.type.cca)) { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(%T)> [symbolic = %Action.type (constants.%Action.type.cca)] +// CHECK:STDOUT: %Self: %Action.type.cca = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc5_15.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_15.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Op.1.%Self.as_type.loc5_15.1 (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.2() { +// CHECK:STDOUT: fn @Op.2[%self.param_patt: %A]() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -218,10 +270,11 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %Action.ref: %Action.type.29c = name_ref Action, file.%Action.decl [concrete = constants.%Action.generic] // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B] // CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(constants.%B)> [concrete = constants.%Action.type.cb0] -// CHECK:STDOUT: %.loc16: %Action.assoc_type.827 = specific_constant @Action.%assoc0.loc5_10.1, @Action(constants.%B) [concrete = constants.%assoc0.035] +// CHECK:STDOUT: %.loc16: %Action.assoc_type.827 = specific_constant @Action.%assoc0.loc5_22.1, @Action(constants.%B) [concrete = constants.%assoc0.035] // CHECK:STDOUT: %Op.ref: %Action.assoc_type.827 = name_ref Op, %.loc16 [concrete = constants.%assoc0.035] // CHECK:STDOUT: %impl.elem0: %.920 = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%Op.40d] -// CHECK:STDOUT: %Op.call: init %empty_tuple.type = call %impl.elem0() +// CHECK:STDOUT: %bound_method: = bound_method %a.ref, %impl.elem0 +// CHECK:STDOUT: %Op.call: init %empty_tuple.type = call %bound_method(%a.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -230,7 +283,14 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %T.patt.loc4_18.2 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Op.1(constants.%T, constants.%Self) {} +// CHECK:STDOUT: specific @Op.1(constants.%T, constants.%Self) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %Action.type => constants.%Action.type.cca +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type.loc5_15.1 => constants.%Self.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Action(@Op.1.%T) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Action(%T.loc4_18.2) {} // CHECK:STDOUT: @@ -244,10 +304,15 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %Op.type => constants.%Op.type.54d // CHECK:STDOUT: %Op => constants.%Op.dba // CHECK:STDOUT: %Action.assoc_type => constants.%Action.assoc_type.827 -// CHECK:STDOUT: %assoc0.loc5_10.2 => constants.%assoc0.035 +// CHECK:STDOUT: %assoc0.loc5_22.2 => constants.%assoc0.035 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Op.1(constants.%B, constants.%Action.facet) {} +// CHECK:STDOUT: specific @Op.1(constants.%B, constants.%Action.facet) { +// CHECK:STDOUT: %T => constants.%B +// CHECK:STDOUT: %Action.type => constants.%Action.type.cb0 +// CHECK:STDOUT: %Self => constants.%Action.facet +// CHECK:STDOUT: %Self.as_type.loc5_15.1 => constants.%A +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- action.impl.carbon // CHECK:STDOUT: @@ -266,6 +331,7 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %A: type = class_type @A [concrete] // CHECK:STDOUT: %Op.type.036: type = fn_type @Op.1, @Action(%T) [symbolic] // CHECK:STDOUT: %Op.6ed: %Op.type.036 = struct_value () [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] // CHECK:STDOUT: %Action.assoc_type.8f9: type = assoc_entity_type %Action.type.cca [symbolic] // CHECK:STDOUT: %assoc0.905ab9.1: %Action.assoc_type.8f9 = assoc_entity element0, imports.%Main.import_ref.0e3753.1 [symbolic] // CHECK:STDOUT: %Op.type.54d: type = fn_type @Op.1, @Action(%B) [concrete] @@ -289,20 +355,20 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %Main.C = import_ref Main//action, C, unloaded // CHECK:STDOUT: %Main.F = import_ref Main//action, F, unloaded // CHECK:STDOUT: %Main.import_ref.8f24d3.1: = import_ref Main//action, loc9_10, loaded [concrete = constants.%complete_type] -// CHECK:STDOUT: %Main.import_ref.54a = import_ref Main//action, inst46 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.54a = import_ref Main//action, inst60 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.f6b058.1: type = import_ref Main//action, loc4_18, loaded [symbolic = @Action.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.ddc = import_ref Main//action, inst26 [no loc], unloaded -// CHECK:STDOUT: %Main.import_ref.318: @Action.%Action.assoc_type (%Action.assoc_type.8f9) = import_ref Main//action, loc5_10, loaded [symbolic = @Action.%assoc0 (constants.%assoc0.905ab9.2)] -// CHECK:STDOUT: %Main.Op = import_ref Main//action, Op, unloaded +// CHECK:STDOUT: %Main.import_ref.318: @Action.%Action.assoc_type (%Action.assoc_type.8f9) = import_ref Main//action, loc5_22, loaded [symbolic = @Action.%assoc0 (constants.%assoc0.905ab9.2)] +// CHECK:STDOUT: %Main.Op: @Action.%Op.type (%Op.type.036) = import_ref Main//action, Op, loaded [symbolic = @Action.%Op (constants.%Op.6ed)] // CHECK:STDOUT: %Main.import_ref.71c: = import_ref Main//action, loc12_21, loaded [concrete = constants.%impl_witness] // CHECK:STDOUT: %Main.import_ref.8f24d3.2: = import_ref Main//action, loc8_10, loaded [concrete = constants.%complete_type] -// CHECK:STDOUT: %Main.import_ref.da3 = import_ref Main//action, inst41 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.da3 = import_ref Main//action, inst55 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.984: type = import_ref Main//action, loc12_6, loaded [concrete = constants.%A] // CHECK:STDOUT: %Main.import_ref.bb2: type = import_ref Main//action, loc12_19, loaded [concrete = constants.%Action.type.cb0] -// CHECK:STDOUT: %Main.import_ref.7b5 = import_ref Main//action, loc13_11, unloaded +// CHECK:STDOUT: %Main.import_ref.7b5 = import_ref Main//action, loc13_23, unloaded // CHECK:STDOUT: %Main.import_ref.f6b058.2: type = import_ref Main//action, loc4_18, loaded [symbolic = @Action.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.835: @Action.%Action.type (%Action.type.cca) = import_ref Main//action, inst26 [no loc], loaded [symbolic = @Action.%Self (constants.%Self)] -// CHECK:STDOUT: %Main.import_ref.0e3753.1 = import_ref Main//action, loc5_10, unloaded +// CHECK:STDOUT: %Main.import_ref.0e3753.1 = import_ref Main//action, loc5_22, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -367,7 +433,12 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @Op.1(imports.%Main.import_ref.f6b058.2: type, imports.%Main.import_ref.835: @Action.%Action.type (%Action.type.cca)) [from "action.carbon"] { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(%T)> [symbolic = %Action.type (constants.%Action.type.cca)] +// CHECK:STDOUT: %Self: %Action.type.cca = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] +// 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: @Op.1.%Self.as_type (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G(%a.param_patt: %A) { @@ -379,11 +450,12 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %.loc4: %Action.assoc_type.827 = specific_constant imports.%Main.import_ref.318, @Action(constants.%B) [concrete = constants.%assoc0.4cc] // CHECK:STDOUT: %Op.ref: %Action.assoc_type.827 = name_ref Op, %.loc4 [concrete = constants.%assoc0.4cc] // CHECK:STDOUT: %impl.elem0: %.ae7 = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%Op.40d] -// CHECK:STDOUT: %Op.call: init %empty_tuple.type = call %impl.elem0() +// CHECK:STDOUT: %bound_method: = bound_method %a.ref, %impl.elem0 +// CHECK:STDOUT: %Op.call: init %empty_tuple.type = call %bound_method(%a.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.2() [from "action.carbon"]; +// CHECK:STDOUT: fn @Op.2[%self.param_patt: %A]() [from "action.carbon"]; // CHECK:STDOUT: // CHECK:STDOUT: specific @Action(constants.%T) { // CHECK:STDOUT: %T => constants.%T @@ -405,7 +477,14 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: // CHECK:STDOUT: specific @Action(%T) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Op.1(constants.%T, constants.%Self) {} +// CHECK:STDOUT: specific @Action(@Op.1.%T) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Op.1(constants.%T, constants.%Self) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %Action.type => constants.%Action.type.cca +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_action.impl.carbon // CHECK:STDOUT: @@ -423,6 +502,7 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %A: type = class_type @A [concrete] // CHECK:STDOUT: %Op.type.036: type = fn_type @Op, @Action(%T) [symbolic] // CHECK:STDOUT: %Op.6ed: %Op.type.036 = struct_value () [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] // CHECK:STDOUT: %Action.assoc_type.8f9: type = assoc_entity_type %Action.type.cca [symbolic] // CHECK:STDOUT: %assoc0.905ab9.1: %Action.assoc_type.8f9 = assoc_entity element0, imports.%Main.import_ref.0e3753.1 [symbolic] // CHECK:STDOUT: %Op.type.54d: type = fn_type @Op, @Action(%B) [concrete] @@ -447,22 +527,22 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %Main.C: type = import_ref Main//action, C, loaded [concrete = constants.%C] // CHECK:STDOUT: %Main.F = import_ref Main//action, F, unloaded // CHECK:STDOUT: %Main.import_ref.8f24d3.1: = import_ref Main//action, loc9_10, loaded [concrete = constants.%complete_type] -// CHECK:STDOUT: %Main.import_ref.54a = import_ref Main//action, inst46 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.54a = import_ref Main//action, inst60 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.f6b058.1: type = import_ref Main//action, loc4_18, loaded [symbolic = @Action.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.ddc = import_ref Main//action, inst26 [no loc], unloaded -// CHECK:STDOUT: %Main.import_ref.318: @Action.%Action.assoc_type (%Action.assoc_type.8f9) = import_ref Main//action, loc5_10, loaded [symbolic = @Action.%assoc0 (constants.%assoc0.905ab9.2)] -// CHECK:STDOUT: %Main.Op = import_ref Main//action, Op, unloaded +// CHECK:STDOUT: %Main.import_ref.318: @Action.%Action.assoc_type (%Action.assoc_type.8f9) = import_ref Main//action, loc5_22, loaded [symbolic = @Action.%assoc0 (constants.%assoc0.905ab9.2)] +// CHECK:STDOUT: %Main.Op: @Action.%Op.type (%Op.type.036) = import_ref Main//action, Op, loaded [symbolic = @Action.%Op (constants.%Op.6ed)] // CHECK:STDOUT: %Main.import_ref.7a1 = import_ref Main//action, loc12_21, unloaded // CHECK:STDOUT: %Main.import_ref.8f24d3.2: = import_ref Main//action, loc8_10, loaded [concrete = constants.%complete_type] -// CHECK:STDOUT: %Main.import_ref.da3 = import_ref Main//action, inst41 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.da3 = import_ref Main//action, inst55 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.984: type = import_ref Main//action, loc12_6, loaded [concrete = constants.%A] // CHECK:STDOUT: %Main.import_ref.bb2: type = import_ref Main//action, loc12_19, loaded [concrete = constants.%Action.type.cb0] -// CHECK:STDOUT: %Main.import_ref.7b5 = import_ref Main//action, loc13_11, unloaded +// CHECK:STDOUT: %Main.import_ref.7b5 = import_ref Main//action, loc13_23, unloaded // CHECK:STDOUT: %Main.import_ref.f6b058.2: type = import_ref Main//action, loc4_18, loaded [symbolic = @Action.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.835: @Action.%Action.type (%Action.type.cca) = import_ref Main//action, inst26 [no loc], loaded [symbolic = @Action.%Self (constants.%Self)] -// CHECK:STDOUT: %Main.import_ref.0e3753.1 = import_ref Main//action, loc5_10, unloaded +// CHECK:STDOUT: %Main.import_ref.0e3753.1 = import_ref Main//action, loc5_22, unloaded // CHECK:STDOUT: %Main.import_ref.8f24d3.3: = import_ref Main//action, loc10_10, loaded [concrete = constants.%complete_type] -// CHECK:STDOUT: %Main.import_ref.2c4 = import_ref Main//action, inst49 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.2c4 = import_ref Main//action, inst63 [no loc], unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -534,7 +614,12 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @Op(imports.%Main.import_ref.f6b058.2: type, imports.%Main.import_ref.835: @Action.%Action.type (%Action.type.cca)) [from "action.carbon"] { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(%T)> [symbolic = %Action.type (constants.%Action.type.cca)] +// CHECK:STDOUT: %Self: %Action.type.cca = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] +// 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: @Op.%Self.as_type (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G(%a.param_patt: %A) { @@ -568,7 +653,14 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: // CHECK:STDOUT: specific @Action(%T) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Op(constants.%T, constants.%Self) {} +// CHECK:STDOUT: specific @Action(@Op.%T) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Op(constants.%T, constants.%Self) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %Action.type => constants.%Action.type.cca +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Action(constants.%C) { // CHECK:STDOUT: %T => constants.%C @@ -596,6 +688,10 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %Make.737: %Make.type.598 = struct_value () [symbolic] // CHECK:STDOUT: %Factory.assoc_type.ca7: type = assoc_entity_type %Factory.type.c96 [symbolic] // CHECK:STDOUT: %assoc0.d7a: %Factory.assoc_type.ca7 = assoc_entity element0, @Factory.%Make.decl [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] +// CHECK:STDOUT: %Method.type.7ee: type = fn_type @Method.1, @Factory(%T) [symbolic] +// CHECK:STDOUT: %Method.a71: %Method.type.7ee = struct_value () [symbolic] +// CHECK:STDOUT: %assoc1.157: %Factory.assoc_type.ca7 = assoc_entity element1, @Factory.%Method.decl [symbolic] // CHECK:STDOUT: %A: type = class_type @A [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] @@ -605,9 +701,14 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %Make.efe: %Make.type.c59 = struct_value () [concrete] // CHECK:STDOUT: %Factory.assoc_type.668: type = assoc_entity_type %Factory.type.a5d [concrete] // CHECK:STDOUT: %assoc0.40c: %Factory.assoc_type.668 = assoc_entity element0, @Factory.%Make.decl [concrete] -// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%Make.decl) [concrete] +// CHECK:STDOUT: %Method.type.117: type = fn_type @Method.1, @Factory(%B) [concrete] +// CHECK:STDOUT: %Method.ea9: %Method.type.117 = struct_value () [concrete] +// CHECK:STDOUT: %assoc1.523: %Factory.assoc_type.668 = assoc_entity element1, @Factory.%Method.decl [concrete] +// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%Make.decl, @impl.%Method.decl) [concrete] // CHECK:STDOUT: %Make.type.ec4: type = fn_type @Make.2 [concrete] // CHECK:STDOUT: %Make.377: %Make.type.ec4 = struct_value () [concrete] +// CHECK:STDOUT: %Method.type.af5: type = fn_type @Method.2 [concrete] +// CHECK:STDOUT: %Method.3d4: %Method.type.af5 = struct_value () [concrete] // CHECK:STDOUT: %Factory.facet: %Factory.type.a5d = facet_value %A, %impl_witness [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -632,7 +733,7 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B] // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%B)> [concrete = constants.%Factory.type.a5d] // CHECK:STDOUT: } -// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%Make.decl) [concrete = constants.%impl_witness] +// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%Make.decl, @impl.%Method.decl) [concrete = constants.%impl_witness] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic interface @Factory(%T.loc4_19.1: type) { @@ -645,7 +746,10 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %Make.type: type = fn_type @Make.1, @Factory(%T.loc4_19.2) [symbolic = %Make.type (constants.%Make.type.598)] // CHECK:STDOUT: %Make: @Factory.%Make.type (%Make.type.598) = struct_value () [symbolic = %Make (constants.%Make.737)] // CHECK:STDOUT: %Factory.assoc_type: type = assoc_entity_type @Factory.%Factory.type (%Factory.type.c96) [symbolic = %Factory.assoc_type (constants.%Factory.assoc_type.ca7)] -// CHECK:STDOUT: %assoc0.loc5_17.2: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = assoc_entity element0, %Make.decl [symbolic = %assoc0.loc5_17.2 (constants.%assoc0.d7a)] +// CHECK:STDOUT: %assoc0.loc6_17.2: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = assoc_entity element0, %Make.decl [symbolic = %assoc0.loc6_17.2 (constants.%assoc0.d7a)] +// CHECK:STDOUT: %Method.type: type = fn_type @Method.1, @Factory(%T.loc4_19.2) [symbolic = %Method.type (constants.%Method.type.7ee)] +// CHECK:STDOUT: %Method: @Factory.%Method.type (%Method.type.7ee) = struct_value () [symbolic = %Method (constants.%Method.a71)] +// CHECK:STDOUT: %assoc1.loc8_31.2: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = assoc_entity element1, %Method.decl [symbolic = %assoc1.loc8_31.2 (constants.%assoc1.157)] // CHECK:STDOUT: // CHECK:STDOUT: interface { // CHECK:STDOUT: %Self.1: @Factory.%Factory.type (%Factory.type.c96) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] @@ -657,13 +761,33 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %return.param: ref @Make.1.%T (%T) = out_param runtime_param0 // CHECK:STDOUT: %return: ref @Make.1.%T (%T) = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %assoc0.loc5_17.1: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = assoc_entity element0, %Make.decl [symbolic = %assoc0.loc5_17.2 (constants.%assoc0.d7a)] +// CHECK:STDOUT: %assoc0.loc6_17.1: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = assoc_entity element0, %Make.decl [symbolic = %assoc0.loc6_17.2 (constants.%assoc0.d7a)] +// CHECK:STDOUT: %Method.decl: @Factory.%Method.type (%Method.type.7ee) = fn_decl @Method.1 [symbolic = @Factory.%Method (constants.%Method.a71)] { +// CHECK:STDOUT: %self.patt: @Method.1.%Self.as_type.loc8_19.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Method.1.%Self.as_type.loc8_19.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: @Method.1.%T (%T) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Method.1.%T (%T) = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %T.ref: type = name_ref T, @Factory.%T.loc4_19.1 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %self.param: @Method.1.%Self.as_type.loc8_19.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc8_19.1: type = splice_block %.loc8_19.3 [symbolic = %Self.as_type.loc8_19.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %.loc8_19.2: @Method.1.%Factory.type (%Factory.type.c96) = specific_constant @Factory.%Self.1, @Factory(constants.%T) [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.ref: @Method.1.%Factory.type (%Factory.type.c96) = name_ref Self, %.loc8_19.2 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc8_19.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc8_19.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc8_19.3: type = converted %Self.ref, %Self.as_type.loc8_19.2 [symbolic = %Self.as_type.loc8_19.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Method.1.%Self.as_type.loc8_19.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Method.1.%T (%T) = out_param runtime_param1 +// CHECK:STDOUT: %return: ref @Method.1.%T (%T) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc1.loc8_31.1: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = assoc_entity element1, %Method.decl [symbolic = %assoc1.loc8_31.2 (constants.%assoc1.157)] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self.1 // CHECK:STDOUT: .T = -// CHECK:STDOUT: .Make = %assoc0.loc5_17.1 -// CHECK:STDOUT: witness = (%Make.decl) +// CHECK:STDOUT: .Make = %assoc0.loc6_17.1 +// CHECK:STDOUT: .Method = %assoc1.loc8_31.1 +// CHECK:STDOUT: witness = (%Make.decl, %Method.decl) // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -676,10 +800,24 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %return.param: ref %B = out_param runtime_param0 // CHECK:STDOUT: %return: ref %B = return_slot %return.param // CHECK:STDOUT: } +// CHECK:STDOUT: %Method.decl: %Method.type.af5 = fn_decl @Method.2 [concrete = constants.%Method.3d4] { +// CHECK:STDOUT: %self.patt: %A = binding_pattern self +// CHECK:STDOUT: %self.param_patt: %A = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: %B = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %B = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B] +// CHECK:STDOUT: %self.param: %A = value_param runtime_param0 +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%A.ref [concrete = constants.%A] +// CHECK:STDOUT: %self: %A = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref %B = out_param runtime_param1 +// CHECK:STDOUT: %return: ref %B = return_slot %return.param +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .B = // CHECK:STDOUT: .Make = %Make.decl +// CHECK:STDOUT: .Method = %Method.decl // CHECK:STDOUT: witness = file.%impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: @@ -705,8 +843,19 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: fn() -> @Make.1.%T (%T); // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Method.1(@Factory.%T.loc4_19.1: type, @Factory.%Self.1: @Factory.%Factory.type (%Factory.type.c96)) { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(%T)> [symbolic = %Factory.type (constants.%Factory.type.c96)] +// CHECK:STDOUT: %Self: %Factory.type.c96 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc8_19.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc8_19.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Method.1.%Self.as_type.loc8_19.1 (%Self.as_type)]() -> @Method.1.%T (%T); +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: fn @Make.2() -> %B; // CHECK:STDOUT: +// CHECK:STDOUT: fn @Method.2[%self.param_patt: %A]() -> %B; +// CHECK:STDOUT: // CHECK:STDOUT: specific @Factory(constants.%T) { // CHECK:STDOUT: %T.loc4_19.2 => constants.%T // CHECK:STDOUT: %T.patt.loc4_19.2 => constants.%T @@ -716,6 +865,15 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: specific @Method.1(constants.%T, constants.%Self) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %Factory.type => constants.%Factory.type.c96 +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type.loc8_19.1 => constants.%Self.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Factory(@Method.1.%T) {} +// CHECK:STDOUT: // CHECK:STDOUT: specific @Factory(%T.loc4_19.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Factory(constants.%B) { @@ -728,13 +886,23 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %Make.type => constants.%Make.type.c59 // CHECK:STDOUT: %Make => constants.%Make.efe // CHECK:STDOUT: %Factory.assoc_type => constants.%Factory.assoc_type.668 -// CHECK:STDOUT: %assoc0.loc5_17.2 => constants.%assoc0.40c +// CHECK:STDOUT: %assoc0.loc6_17.2 => constants.%assoc0.40c +// CHECK:STDOUT: %Method.type => constants.%Method.type.117 +// CHECK:STDOUT: %Method => constants.%Method.ea9 +// CHECK:STDOUT: %assoc1.loc8_31.2 => constants.%assoc1.523 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Make.1(constants.%B, constants.%Factory.facet) { // CHECK:STDOUT: %T => constants.%B // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: specific @Method.1(constants.%B, constants.%Factory.facet) { +// CHECK:STDOUT: %T => constants.%B +// CHECK:STDOUT: %Factory.type => constants.%Factory.type.a5d +// CHECK:STDOUT: %Self => constants.%Factory.facet +// CHECK:STDOUT: %Self.as_type.loc8_19.1 => constants.%A +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: --- factory.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -753,39 +921,58 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %Make.737: %Make.type.598 = struct_value () [symbolic] // CHECK:STDOUT: %Factory.assoc_type.ca7: type = assoc_entity_type %Factory.type.c96 [symbolic] // CHECK:STDOUT: %assoc0.35472f.1: %Factory.assoc_type.ca7 = assoc_entity element0, imports.%Main.import_ref.21018a.1 [symbolic] +// CHECK:STDOUT: %Method.type.7ee: type = fn_type @Method.1, @Factory(%T) [symbolic] +// CHECK:STDOUT: %Method.a71: %Method.type.7ee = struct_value () [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] +// CHECK:STDOUT: %assoc1.1fdf32.1: %Factory.assoc_type.ca7 = assoc_entity element1, imports.%Main.import_ref.46fc3c.1 [symbolic] // CHECK:STDOUT: %Make.type.c59: type = fn_type @Make.1, @Factory(%B) [concrete] // CHECK:STDOUT: %Make.efe: %Make.type.c59 = struct_value () [concrete] // CHECK:STDOUT: %Factory.assoc_type.668: type = assoc_entity_type %Factory.type.a5d [concrete] -// CHECK:STDOUT: %assoc0.503: %Factory.assoc_type.668 = assoc_entity element0, imports.%Main.import_ref.1aa [concrete] +// CHECK:STDOUT: %assoc0.228: %Factory.assoc_type.668 = assoc_entity element0, imports.%Main.import_ref.21018a.2 [concrete] +// CHECK:STDOUT: %Method.type.117: type = fn_type @Method.1, @Factory(%B) [concrete] +// CHECK:STDOUT: %Method.ea9: %Method.type.117 = struct_value () [concrete] +// CHECK:STDOUT: %assoc1.51f: %Factory.assoc_type.668 = assoc_entity element1, imports.%Main.import_ref.5be [concrete] // CHECK:STDOUT: %MakeB.type: type = fn_type @MakeB [concrete] // CHECK:STDOUT: %MakeB: %MakeB.type = struct_value () [concrete] -// CHECK:STDOUT: %assoc0.35472f.2: %Factory.assoc_type.ca7 = assoc_entity element0, imports.%Main.import_ref.21018a.2 [symbolic] -// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%Main.import_ref.9ec) [concrete] +// CHECK:STDOUT: %assoc0.35472f.2: %Factory.assoc_type.ca7 = assoc_entity element0, imports.%Main.import_ref.21018a.3 [symbolic] +// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%Main.import_ref.9ec, imports.%Main.import_ref.7dd) [concrete] // CHECK:STDOUT: %Factory.facet: %Factory.type.a5d = facet_value %A, %impl_witness [concrete] -// CHECK:STDOUT: %.357: type = fn_type_with_self_type %Make.type.c59, %Factory.facet [concrete] +// CHECK:STDOUT: %.161: type = fn_type_with_self_type %Make.type.c59, %Factory.facet [concrete] // CHECK:STDOUT: %Make.type.ec4: type = fn_type @Make.2 [concrete] // CHECK:STDOUT: %Make.377: %Make.type.ec4 = struct_value () [concrete] +// CHECK:STDOUT: %InstanceB.type: type = fn_type @InstanceB [concrete] +// CHECK:STDOUT: %InstanceB: %InstanceB.type = struct_value () [concrete] +// CHECK:STDOUT: %assoc1.1fdf32.2: %Factory.assoc_type.ca7 = assoc_entity element1, imports.%Main.import_ref.46fc3c.2 [symbolic] +// CHECK:STDOUT: %.478: type = fn_type_with_self_type %Method.type.117, %Factory.facet [concrete] +// CHECK:STDOUT: %Method.type.af5: type = fn_type @Method.2 [concrete] +// CHECK:STDOUT: %Method.3d4: %Method.type.af5 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Main.Factory: %Factory.type.1a8 = import_ref Main//factory, Factory, loaded [concrete = constants.%Factory.generic] // CHECK:STDOUT: %Main.A: type = import_ref Main//factory, A, loaded [concrete = constants.%A] // CHECK:STDOUT: %Main.B: type = import_ref Main//factory, B, loaded [concrete = constants.%B] -// CHECK:STDOUT: %Main.import_ref.8f24d3.1: = import_ref Main//factory, loc9_10, loaded [concrete = constants.%complete_type] -// CHECK:STDOUT: %Main.import_ref.54a = import_ref Main//factory, inst52 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.8f24d3.1: = import_ref Main//factory, loc12_10, loaded [concrete = constants.%complete_type] +// CHECK:STDOUT: %Main.import_ref.54a = import_ref Main//factory, inst79 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.f6b058.1: type = import_ref Main//factory, loc4_19, loaded [symbolic = @Factory.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.fbb = import_ref Main//factory, inst26 [no loc], unloaded -// CHECK:STDOUT: %Main.import_ref.8d5: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = import_ref Main//factory, loc5_17, loaded [symbolic = @Factory.%assoc0 (constants.%assoc0.35472f.2)] -// CHECK:STDOUT: %Main.Make = import_ref Main//factory, Make, unloaded -// CHECK:STDOUT: %Main.import_ref.72b: = import_ref Main//factory, loc11_22, loaded [concrete = constants.%impl_witness] -// CHECK:STDOUT: %Main.import_ref.8f24d3.2: = import_ref Main//factory, loc8_10, loaded [concrete = constants.%complete_type] -// CHECK:STDOUT: %Main.import_ref.da3 = import_ref Main//factory, inst47 [no loc], unloaded -// CHECK:STDOUT: %Main.import_ref.984: type = import_ref Main//factory, loc11_6, loaded [concrete = constants.%A] -// CHECK:STDOUT: %Main.import_ref.bd2: type = import_ref Main//factory, loc11_20, loaded [concrete = constants.%Factory.type.a5d] -// CHECK:STDOUT: %Main.import_ref.a27 = import_ref Main//factory, loc12_17, unloaded +// CHECK:STDOUT: %Main.import_ref.8d5: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = import_ref Main//factory, loc6_17, loaded [symbolic = @Factory.%assoc0 (constants.%assoc0.35472f.2)] +// CHECK:STDOUT: %Main.import_ref.ff7: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = import_ref Main//factory, loc8_31, loaded [symbolic = @Factory.%assoc1 (constants.%assoc1.1fdf32.2)] +// CHECK:STDOUT: %Main.Make: @Factory.%Make.type (%Make.type.598) = import_ref Main//factory, Make, loaded [symbolic = @Factory.%Make (constants.%Make.737)] +// CHECK:STDOUT: %Main.Method: @Factory.%Method.type (%Method.type.7ee) = import_ref Main//factory, Method, loaded [symbolic = @Factory.%Method (constants.%Method.a71)] +// CHECK:STDOUT: %Main.import_ref.f8d: = import_ref Main//factory, loc14_22, loaded [concrete = constants.%impl_witness] +// CHECK:STDOUT: %Main.import_ref.8f24d3.2: = import_ref Main//factory, loc11_10, loaded [concrete = constants.%complete_type] +// CHECK:STDOUT: %Main.import_ref.da3 = import_ref Main//factory, inst74 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.984: type = import_ref Main//factory, loc14_6, loaded [concrete = constants.%A] +// CHECK:STDOUT: %Main.import_ref.bd2: type = import_ref Main//factory, loc14_20, loaded [concrete = constants.%Factory.type.a5d] +// CHECK:STDOUT: %Main.import_ref.a27 = import_ref Main//factory, loc15_17, unloaded +// CHECK:STDOUT: %Main.import_ref.163 = import_ref Main//factory, loc16_31, unloaded // CHECK:STDOUT: %Main.import_ref.f6b058.2: type = import_ref Main//factory, loc4_19, loaded [symbolic = @Factory.%T (constants.%T)] -// CHECK:STDOUT: %Main.import_ref.91b: @Factory.%Factory.type (%Factory.type.c96) = import_ref Main//factory, inst26 [no loc], loaded [symbolic = @Factory.%Self (constants.%Self)] -// CHECK:STDOUT: %Main.import_ref.21018a.1 = import_ref Main//factory, loc5_17, unloaded +// CHECK:STDOUT: %Main.import_ref.91b53a.1: @Factory.%Factory.type (%Factory.type.c96) = import_ref Main//factory, inst26 [no loc], loaded [symbolic = @Factory.%Self (constants.%Self)] +// CHECK:STDOUT: %Main.import_ref.21018a.1 = import_ref Main//factory, loc6_17, unloaded +// CHECK:STDOUT: %Main.import_ref.f6b058.3: type = import_ref Main//factory, loc4_19, loaded [symbolic = @Factory.%T (constants.%T)] +// CHECK:STDOUT: %Main.import_ref.91b53a.2: @Factory.%Factory.type (%Factory.type.c96) = import_ref Main//factory, inst26 [no loc], loaded [symbolic = @Factory.%Self (constants.%Self)] +// CHECK:STDOUT: %Main.import_ref.46fc3c.1 = import_ref Main//factory, loc8_31, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -794,16 +981,25 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: .A = imports.%Main.A // CHECK:STDOUT: .B = imports.%Main.B // CHECK:STDOUT: .MakeB = %MakeB.decl +// CHECK:STDOUT: .InstanceB = %InstanceB.decl // CHECK:STDOUT: } // CHECK:STDOUT: %default.import.loc2_6.1 = import // CHECK:STDOUT: %default.import.loc2_6.2 = import // CHECK:STDOUT: %MakeB.decl: %MakeB.type = fn_decl @MakeB [concrete = constants.%MakeB] { +// CHECK:STDOUT: %return.patt: %B = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %B = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %B.ref.loc4: type = name_ref B, imports.%Main.B [concrete = constants.%B] +// CHECK:STDOUT: %return.param: ref %B = out_param runtime_param0 +// CHECK:STDOUT: %return: ref %B = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %InstanceB.decl: %InstanceB.type = fn_decl @InstanceB [concrete = constants.%InstanceB] { // CHECK:STDOUT: %a.patt: %A = binding_pattern a // CHECK:STDOUT: %a.param_patt: %A = value_param_pattern %a.patt, runtime_param0 // CHECK:STDOUT: %return.patt: %B = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %B = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %B.ref.loc4: type = name_ref B, imports.%Main.B [concrete = constants.%B] +// CHECK:STDOUT: %B.ref.loc7: type = name_ref B, imports.%Main.B [concrete = constants.%B] // CHECK:STDOUT: %a.param: %A = value_param runtime_param0 // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A] // CHECK:STDOUT: %a: %A = bind_name a, %a.param @@ -823,19 +1019,24 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %Make: @Factory.%Make.type (%Make.type.598) = struct_value () [symbolic = %Make (constants.%Make.737)] // CHECK:STDOUT: %Factory.assoc_type: type = assoc_entity_type @Factory.%Factory.type (%Factory.type.c96) [symbolic = %Factory.assoc_type (constants.%Factory.assoc_type.ca7)] // CHECK:STDOUT: %assoc0: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = assoc_entity element0, imports.%Main.import_ref.21018a.1 [symbolic = %assoc0 (constants.%assoc0.35472f.1)] +// CHECK:STDOUT: %Method.type: type = fn_type @Method.1, @Factory(%T) [symbolic = %Method.type (constants.%Method.type.7ee)] +// CHECK:STDOUT: %Method: @Factory.%Method.type (%Method.type.7ee) = struct_value () [symbolic = %Method (constants.%Method.a71)] +// CHECK:STDOUT: %assoc1: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = assoc_entity element1, imports.%Main.import_ref.46fc3c.1 [symbolic = %assoc1 (constants.%assoc1.1fdf32.1)] // CHECK:STDOUT: // CHECK:STDOUT: interface { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = imports.%Main.import_ref.fbb // CHECK:STDOUT: .Make = imports.%Main.import_ref.8d5 -// CHECK:STDOUT: witness = (imports.%Main.Make) +// CHECK:STDOUT: .Method = imports.%Main.import_ref.ff7 +// CHECK:STDOUT: witness = (imports.%Main.Make, imports.%Main.Method) // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: imports.%Main.import_ref.984 as imports.%Main.import_ref.bd2 [from "factory.carbon"] { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Make = imports.%Main.import_ref.a27 -// CHECK:STDOUT: witness = imports.%Main.import_ref.72b +// CHECK:STDOUT: .Method = imports.%Main.import_ref.163 +// CHECK:STDOUT: witness = imports.%Main.import_ref.f8d // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B [from "factory.carbon"] { @@ -852,21 +1053,33 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: .Self = imports.%Main.import_ref.da3 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Make.1(imports.%Main.import_ref.f6b058.2: type, imports.%Main.import_ref.91b: @Factory.%Factory.type (%Factory.type.c96)) [from "factory.carbon"] { +// CHECK:STDOUT: generic fn @Make.1(imports.%Main.import_ref.f6b058.2: type, imports.%Main.import_ref.91b53a.1: @Factory.%Factory.type (%Factory.type.c96)) [from "factory.carbon"] { // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] // CHECK:STDOUT: // CHECK:STDOUT: fn() -> @Make.1.%T (%T); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @MakeB(%a.param_patt: %A) -> %return.param_patt: %B { +// CHECK:STDOUT: generic fn @Method.1(imports.%Main.import_ref.f6b058.3: type, imports.%Main.import_ref.91b53a.2: @Factory.%Factory.type (%Factory.type.c96)) [from "factory.carbon"] { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(%T)> [symbolic = %Factory.type (constants.%Factory.type.c96)] +// CHECK:STDOUT: %Self: %Factory.type.c96 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] +// 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: @Method.1.%Self.as_type (%Self.as_type)]() -> @Method.1.%T (%T); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @MakeB() -> %return.param_patt: %B { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %a.ref: %A = name_ref a, %a +// CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A] // CHECK:STDOUT: %Factory.ref: %Factory.type.1a8 = name_ref Factory, imports.%Main.Factory [concrete = constants.%Factory.generic] // CHECK:STDOUT: %B.ref.loc5: type = name_ref B, imports.%Main.B [concrete = constants.%B] // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%B)> [concrete = constants.%Factory.type.a5d] -// CHECK:STDOUT: %.loc5: %Factory.assoc_type.668 = specific_constant imports.%Main.import_ref.8d5, @Factory(constants.%B) [concrete = constants.%assoc0.503] -// CHECK:STDOUT: %Make.ref: %Factory.assoc_type.668 = name_ref Make, %.loc5 [concrete = constants.%assoc0.503] -// CHECK:STDOUT: %impl.elem0: %.357 = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%Make.377] +// CHECK:STDOUT: %.loc5_23: %Factory.assoc_type.668 = specific_constant imports.%Main.import_ref.8d5, @Factory(constants.%B) [concrete = constants.%assoc0.228] +// CHECK:STDOUT: %Make.ref: %Factory.assoc_type.668 = name_ref Make, %.loc5_23 [concrete = constants.%assoc0.228] +// CHECK:STDOUT: %Factory.facet: %Factory.type.a5d = facet_value constants.%A, constants.%impl_witness [concrete = constants.%Factory.facet] +// CHECK:STDOUT: %.loc5_11: %Factory.type.a5d = converted %A.ref, %Factory.facet [concrete = constants.%Factory.facet] +// CHECK:STDOUT: %as_wit: = facet_access_witness %.loc5_11 [concrete = constants.%impl_witness] +// CHECK:STDOUT: %impl.elem0: %.161 = impl_witness_access %as_wit, element0 [concrete = constants.%Make.377] // CHECK:STDOUT: %.loc4: ref %B = splice_block %return {} // CHECK:STDOUT: %Make.call: init %B = call %impl.elem0() to %.loc4 // CHECK:STDOUT: return %Make.call to %return @@ -874,6 +1087,23 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: // CHECK:STDOUT: fn @Make.2() -> %B [from "factory.carbon"]; // CHECK:STDOUT: +// CHECK:STDOUT: fn @InstanceB(%a.param_patt: %A) -> %return.param_patt: %B { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %a.ref: %A = name_ref a, %a +// CHECK:STDOUT: %Factory.ref: %Factory.type.1a8 = name_ref Factory, imports.%Main.Factory [concrete = constants.%Factory.generic] +// CHECK:STDOUT: %B.ref.loc8: type = name_ref B, imports.%Main.B [concrete = constants.%B] +// CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%B)> [concrete = constants.%Factory.type.a5d] +// CHECK:STDOUT: %.loc8: %Factory.assoc_type.668 = specific_constant imports.%Main.import_ref.ff7, @Factory(constants.%B) [concrete = constants.%assoc1.51f] +// CHECK:STDOUT: %Method.ref: %Factory.assoc_type.668 = name_ref Method, %.loc8 [concrete = constants.%assoc1.51f] +// CHECK:STDOUT: %impl.elem1: %.478 = impl_witness_access constants.%impl_witness, element1 [concrete = constants.%Method.3d4] +// CHECK:STDOUT: %bound_method: = bound_method %a.ref, %impl.elem1 +// CHECK:STDOUT: %.loc7: ref %B = splice_block %return {} +// CHECK:STDOUT: %Method.call: init %B = call %bound_method(%a.ref) to %.loc7 +// CHECK:STDOUT: return %Method.call to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Method.2[%self.param_patt: %A]() -> %B [from "factory.carbon"]; +// CHECK:STDOUT: // CHECK:STDOUT: specific @Factory(constants.%T) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: %T.patt => constants.%T @@ -889,7 +1119,10 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %Make.type => constants.%Make.type.c59 // CHECK:STDOUT: %Make => constants.%Make.efe // CHECK:STDOUT: %Factory.assoc_type => constants.%Factory.assoc_type.668 -// CHECK:STDOUT: %assoc0 => constants.%assoc0.503 +// CHECK:STDOUT: %assoc0 => constants.%assoc0.228 +// CHECK:STDOUT: %Method.type => constants.%Method.type.117 +// CHECK:STDOUT: %Method => constants.%Method.ea9 +// CHECK:STDOUT: %assoc1 => constants.%assoc1.51f // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Factory(%T) {} @@ -898,6 +1131,111 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: specific @Factory(@Method.1.%T) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Method.1(constants.%T, constants.%Self) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %Factory.type => constants.%Factory.type.c96 +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// 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.loc3_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: %Dest.param_patt: type = value_param_pattern %Dest.patt.loc3_22.1, runtime_param [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.param: type = value_param runtime_param +// CHECK:STDOUT: %Dest.loc3_22.1: type = bind_symbolic_name Dest, 0, %Dest.param [symbolic = %Dest.loc3_22.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc3_22.1: type) { +// CHECK:STDOUT: %Dest.loc3_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc3_22.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc3_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc3_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.loc3_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.loc4_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc4_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.loc4_20.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: @Convert.%Dest (%Dest) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Convert.%Dest (%Dest) = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc3_22.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc4_20.1: type = splice_block %.loc4_20.3 [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %.loc4_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, %.loc4_20.2 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc4_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc4_20.3: type = converted %Self.ref, %Self.as_type.loc4_20.2 [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.%Dest (%Dest) = out_param runtime_param1 +// CHECK:STDOUT: %return: ref @Convert.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc4_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc4_35.2 (constants.%assoc0)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc4_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert(@ImplicitAs.%Dest.loc3_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.loc4_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type)]() -> @Convert.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc3_22.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc3_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.loc4_20.1 => constants.%Self.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(%Dest.loc3_22.2) {} +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_factory.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -908,7 +1246,7 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %Factory.generic: %Factory.type.1a8 = struct_value () [concrete] // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %Factory.type.c96: type = facet_type <@Factory, @Factory(%T)> [symbolic] -// CHECK:STDOUT: %Self: %Factory.type.c96 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Self.9ba: %Factory.type.c96 = bind_symbolic_name Self, 1 [symbolic] // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic] // CHECK:STDOUT: %Factory.type.a5d: type = facet_type <@Factory, @Factory(%B)> [concrete] // CHECK:STDOUT: %A: type = class_type @A [concrete] @@ -916,10 +1254,17 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %Make.737: %Make.type.598 = struct_value () [symbolic] // CHECK:STDOUT: %Factory.assoc_type.ca7: type = assoc_entity_type %Factory.type.c96 [symbolic] // CHECK:STDOUT: %assoc0.35472f.1: %Factory.assoc_type.ca7 = assoc_entity element0, imports.%Main.import_ref.21018a.1 [symbolic] +// CHECK:STDOUT: %Method.type.7ee: type = fn_type @Method, @Factory(%T) [symbolic] +// CHECK:STDOUT: %Method.a71: %Method.type.7ee = struct_value () [symbolic] +// CHECK:STDOUT: %Self.as_type.56c: type = facet_access_type %Self.9ba [symbolic] +// CHECK:STDOUT: %assoc1.1fdf32.1: %Factory.assoc_type.ca7 = assoc_entity element1, imports.%Main.import_ref.46fc3c.1 [symbolic] // CHECK:STDOUT: %Make.type.c59: type = fn_type @Make, @Factory(%B) [concrete] // CHECK:STDOUT: %Make.efe: %Make.type.c59 = struct_value () [concrete] // CHECK:STDOUT: %Factory.assoc_type.668: type = assoc_entity_type %Factory.type.a5d [concrete] // CHECK:STDOUT: %assoc0.228: %Factory.assoc_type.668 = assoc_entity element0, imports.%Main.import_ref.21018a.2 [concrete] +// CHECK:STDOUT: %Method.type.117: type = fn_type @Method, @Factory(%B) [concrete] +// CHECK:STDOUT: %Method.ea9: %Method.type.117 = struct_value () [concrete] +// CHECK:STDOUT: %assoc1.7a1: %Factory.assoc_type.668 = assoc_entity element1, imports.%Main.import_ref.46fc3c.2 [concrete] // CHECK:STDOUT: %C: type = class_type @C [concrete] // CHECK:STDOUT: %MakeC.type: type = fn_type @MakeC [concrete] // CHECK:STDOUT: %MakeC: %MakeC.type = struct_value () [concrete] @@ -928,28 +1273,66 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %Make.8ba: %Make.type.0de = struct_value () [concrete] // CHECK:STDOUT: %Factory.assoc_type.709: type = assoc_entity_type %Factory.type.5c5 [concrete] // CHECK:STDOUT: %assoc0.ef9: %Factory.assoc_type.709 = assoc_entity element0, imports.%Main.import_ref.21018a.1 [concrete] +// CHECK:STDOUT: %Method.type.d46: type = fn_type @Method, @Factory(%C) [concrete] +// CHECK:STDOUT: %Method.f9e: %Method.type.d46 = struct_value () [concrete] +// CHECK:STDOUT: %assoc1.ae5: %Factory.assoc_type.709 = assoc_entity element1, imports.%Main.import_ref.46fc3c.1 [concrete] // CHECK:STDOUT: %assoc0.35472f.2: %Factory.assoc_type.ca7 = assoc_entity element0, imports.%Main.import_ref.21018a.3 [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.43db8b.1: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.1 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.d43: type = facet_type <@ImplicitAs, @ImplicitAs(%Factory.type.5c5)> [concrete] +// CHECK:STDOUT: %Convert.type.9b5: type = fn_type @Convert, @ImplicitAs(%Factory.type.5c5) [concrete] +// CHECK:STDOUT: %Convert.8cc: %Convert.type.9b5 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.assoc_type.0f8: type = assoc_entity_type %ImplicitAs.type.d43 [concrete] +// CHECK:STDOUT: %assoc0.ae3: %ImplicitAs.assoc_type.0f8 = assoc_entity element0, imports.%Core.import_ref.207961.1 [concrete] +// CHECK:STDOUT: %assoc0.43db8b.2: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.2 [symbolic] +// CHECK:STDOUT: %InstanceC.type: type = fn_type @InstanceC [concrete] +// CHECK:STDOUT: %InstanceC: %InstanceC.type = struct_value () [concrete] +// CHECK:STDOUT: %assoc1.1fdf32.2: %Factory.assoc_type.ca7 = assoc_entity element1, imports.%Main.import_ref.46fc3c.3 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Main.Factory: %Factory.type.1a8 = import_ref Main//factory, Factory, loaded [concrete = constants.%Factory.generic] // CHECK:STDOUT: %Main.A: type = import_ref Main//factory, A, loaded [concrete = constants.%A] // CHECK:STDOUT: %Main.B = import_ref Main//factory, B, unloaded -// CHECK:STDOUT: %Main.import_ref.8f24d3.1: = import_ref Main//factory, loc9_10, loaded [concrete = constants.%complete_type] -// CHECK:STDOUT: %Main.import_ref.54a = import_ref Main//factory, inst52 [no loc], unloaded +// 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.8f24d3.1: = import_ref Main//factory, loc12_10, loaded [concrete = constants.%complete_type] +// CHECK:STDOUT: %Main.import_ref.54a = import_ref Main//factory, inst79 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.f6b058.1: type = import_ref Main//factory, loc4_19, loaded [symbolic = @Factory.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.fbb = import_ref Main//factory, inst26 [no loc], unloaded -// CHECK:STDOUT: %Main.import_ref.8d5: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = import_ref Main//factory, loc5_17, loaded [symbolic = @Factory.%assoc0 (constants.%assoc0.35472f.2)] -// CHECK:STDOUT: %Main.Make = import_ref Main//factory, Make, unloaded -// CHECK:STDOUT: %Main.import_ref.3e9 = import_ref Main//factory, loc11_22, unloaded -// CHECK:STDOUT: %Main.import_ref.8f24d3.2: = import_ref Main//factory, loc8_10, loaded [concrete = constants.%complete_type] -// CHECK:STDOUT: %Main.import_ref.da3 = import_ref Main//factory, inst47 [no loc], unloaded -// CHECK:STDOUT: %Main.import_ref.984: type = import_ref Main//factory, loc11_6, loaded [concrete = constants.%A] -// CHECK:STDOUT: %Main.import_ref.bd2: type = import_ref Main//factory, loc11_20, loaded [concrete = constants.%Factory.type.a5d] -// CHECK:STDOUT: %Main.import_ref.a27 = import_ref Main//factory, loc12_17, unloaded +// CHECK:STDOUT: %Main.import_ref.8d5: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = import_ref Main//factory, loc6_17, loaded [symbolic = @Factory.%assoc0 (constants.%assoc0.35472f.2)] +// CHECK:STDOUT: %Main.import_ref.ff7: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = import_ref Main//factory, loc8_31, loaded [symbolic = @Factory.%assoc1 (constants.%assoc1.1fdf32.2)] +// CHECK:STDOUT: %Main.Make: @Factory.%Make.type (%Make.type.598) = import_ref Main//factory, Make, loaded [symbolic = @Factory.%Make (constants.%Make.737)] +// CHECK:STDOUT: %Main.Method: @Factory.%Method.type (%Method.type.7ee) = import_ref Main//factory, Method, loaded [symbolic = @Factory.%Method (constants.%Method.a71)] +// CHECK:STDOUT: %Main.import_ref.e41 = import_ref Main//factory, loc14_22, unloaded +// CHECK:STDOUT: %Main.import_ref.8f24d3.2: = import_ref Main//factory, loc11_10, loaded [concrete = constants.%complete_type] +// CHECK:STDOUT: %Main.import_ref.da3 = import_ref Main//factory, inst74 [no loc], unloaded +// CHECK:STDOUT: %Main.import_ref.984: type = import_ref Main//factory, loc14_6, loaded [concrete = constants.%A] +// CHECK:STDOUT: %Main.import_ref.bd2: type = import_ref Main//factory, loc14_20, loaded [concrete = constants.%Factory.type.a5d] +// CHECK:STDOUT: %Main.import_ref.a27 = import_ref Main//factory, loc15_17, unloaded +// CHECK:STDOUT: %Main.import_ref.163 = import_ref Main//factory, loc16_31, unloaded // CHECK:STDOUT: %Main.import_ref.f6b058.2: type = import_ref Main//factory, loc4_19, loaded [symbolic = @Factory.%T (constants.%T)] -// CHECK:STDOUT: %Main.import_ref.91b: @Factory.%Factory.type (%Factory.type.c96) = import_ref Main//factory, inst26 [no loc], loaded [symbolic = @Factory.%Self (constants.%Self)] -// CHECK:STDOUT: %Main.import_ref.21018a.1 = import_ref Main//factory, loc5_17, unloaded +// CHECK:STDOUT: %Main.import_ref.91b53a.1: @Factory.%Factory.type (%Factory.type.c96) = import_ref Main//factory, inst26 [no loc], loaded [symbolic = @Factory.%Self (constants.%Self.9ba)] +// CHECK:STDOUT: %Main.import_ref.21018a.1 = import_ref Main//factory, loc6_17, unloaded +// CHECK:STDOUT: %Main.import_ref.f6b058.3: type = import_ref Main//factory, loc4_19, loaded [symbolic = @Factory.%T (constants.%T)] +// CHECK:STDOUT: %Main.import_ref.91b53a.2: @Factory.%Factory.type (%Factory.type.c96) = import_ref Main//factory, inst26 [no loc], loaded [symbolic = @Factory.%Self (constants.%Self.9ba)] +// CHECK:STDOUT: %Main.import_ref.46fc3c.1 = import_ref Main//factory, loc8_31, unloaded +// CHECK:STDOUT: %Core.import_ref.ffd566.1: type = import_ref Core//default, loc3_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst26 [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.43db8b.2)] +// CHECK:STDOUT: %Core.Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, Convert, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] +// CHECK:STDOUT: %Core.import_ref.ffd566.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, inst26 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] +// CHECK:STDOUT: %Core.import_ref.207961.1 = import_ref Core//default, loc4_35, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -957,19 +1340,30 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: .Factory = imports.%Main.Factory // CHECK:STDOUT: .A = imports.%Main.A // CHECK:STDOUT: .B = imports.%Main.B +// CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .MakeC = %MakeC.decl +// CHECK:STDOUT: .InstanceC = %InstanceC.decl // CHECK:STDOUT: } // CHECK:STDOUT: %default.import.loc2_6.1 = import // CHECK:STDOUT: %default.import.loc2_6.2 = import +// CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {} // CHECK:STDOUT: %MakeC.decl: %MakeC.type = fn_decl @MakeC [concrete = constants.%MakeC] { +// CHECK:STDOUT: %return.patt: %C = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %C = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %C.ref.loc8: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %return.param: ref %C = out_param runtime_param0 +// CHECK:STDOUT: %return: ref %C = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %InstanceC.decl: %InstanceC.type = fn_decl @InstanceC [concrete = constants.%InstanceC] { // CHECK:STDOUT: %a.patt: %A = binding_pattern a // CHECK:STDOUT: %a.param_patt: %A = value_param_pattern %a.patt, runtime_param0 // CHECK:STDOUT: %return.patt: %C = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %C = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %C.ref.loc6: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc19: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %a.param: %A = value_param runtime_param0 // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A] // CHECK:STDOUT: %a: %A = bind_name a, %a.param @@ -984,24 +1378,49 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(%T)> [symbolic = %Factory.type (constants.%Factory.type.c96)] -// CHECK:STDOUT: %Self: %Factory.type.c96 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self: %Factory.type.c96 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.9ba)] // CHECK:STDOUT: %Make.type: type = fn_type @Make, @Factory(%T) [symbolic = %Make.type (constants.%Make.type.598)] // CHECK:STDOUT: %Make: @Factory.%Make.type (%Make.type.598) = struct_value () [symbolic = %Make (constants.%Make.737)] // CHECK:STDOUT: %Factory.assoc_type: type = assoc_entity_type @Factory.%Factory.type (%Factory.type.c96) [symbolic = %Factory.assoc_type (constants.%Factory.assoc_type.ca7)] // CHECK:STDOUT: %assoc0: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = assoc_entity element0, imports.%Main.import_ref.21018a.1 [symbolic = %assoc0 (constants.%assoc0.35472f.1)] +// CHECK:STDOUT: %Method.type: type = fn_type @Method, @Factory(%T) [symbolic = %Method.type (constants.%Method.type.7ee)] +// CHECK:STDOUT: %Method: @Factory.%Method.type (%Method.type.7ee) = struct_value () [symbolic = %Method (constants.%Method.a71)] +// CHECK:STDOUT: %assoc1: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = assoc_entity element1, imports.%Main.import_ref.46fc3c.1 [symbolic = %assoc1 (constants.%assoc1.1fdf32.1)] // CHECK:STDOUT: // CHECK:STDOUT: interface { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = imports.%Main.import_ref.fbb // CHECK:STDOUT: .Make = imports.%Main.import_ref.8d5 -// CHECK:STDOUT: witness = (imports.%Main.Make) +// CHECK:STDOUT: .Method = imports.%Main.import_ref.ff7 +// CHECK:STDOUT: witness = (imports.%Main.Make, imports.%Main.Method) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.ffd566.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.207961.1 [symbolic = %assoc0 (constants.%assoc0.43db8b.1)] +// 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: impl @impl: imports.%Main.import_ref.984 as imports.%Main.import_ref.bd2 [from "factory.carbon"] { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Make = imports.%Main.import_ref.a27 -// CHECK:STDOUT: witness = imports.%Main.import_ref.3e9 +// CHECK:STDOUT: .Method = imports.%Main.import_ref.163 +// CHECK:STDOUT: witness = imports.%Main.import_ref.e41 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B [from "factory.carbon"] { @@ -1026,20 +1445,50 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Make(imports.%Main.import_ref.f6b058.2: type, imports.%Main.import_ref.91b: @Factory.%Factory.type (%Factory.type.c96)) [from "factory.carbon"] { +// CHECK:STDOUT: generic fn @Make(imports.%Main.import_ref.f6b058.2: type, imports.%Main.import_ref.91b53a.1: @Factory.%Factory.type (%Factory.type.c96)) [from "factory.carbon"] { // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] // CHECK:STDOUT: // CHECK:STDOUT: fn() -> @Make.%T (%T); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @MakeC(%a.param_patt: %A) -> %return.param_patt: %C { +// CHECK:STDOUT: generic fn @Method(imports.%Main.import_ref.f6b058.3: type, imports.%Main.import_ref.91b53a.2: @Factory.%Factory.type (%Factory.type.c96)) [from "factory.carbon"] { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(%T)> [symbolic = %Factory.type (constants.%Factory.type.c96)] +// CHECK:STDOUT: %Self: %Factory.type.c96 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.9ba)] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type.56c)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Method.%Self.as_type (%Self.as_type.56c)]() -> @Method.%T (%T); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @MakeC() -> %return.param_patt: %C { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A] +// CHECK:STDOUT: %Factory.ref: %Factory.type.1a8 = name_ref Factory, imports.%Main.Factory [concrete = constants.%Factory.generic] +// CHECK:STDOUT: %C.ref.loc16: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%C)> [concrete = constants.%Factory.type.5c5] +// CHECK:STDOUT: %.loc16_23: %Factory.assoc_type.709 = specific_constant imports.%Main.import_ref.8d5, @Factory(constants.%C) [concrete = constants.%assoc0.ef9] +// CHECK:STDOUT: %Make.ref: %Factory.assoc_type.709 = name_ref Make, %.loc16_23 [concrete = constants.%assoc0.ef9] +// CHECK:STDOUT: %.loc16_11: %Factory.type.5c5 = converted %A.ref, [concrete = ] +// CHECK:STDOUT: return to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.ffd566.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: fn @InstanceC(%a.param_patt: %A) -> %return.param_patt: %C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: %A = name_ref a, %a // CHECK:STDOUT: %Factory.ref: %Factory.type.1a8 = name_ref Factory, imports.%Main.Factory [concrete = constants.%Factory.generic] -// CHECK:STDOUT: %C.ref.loc11: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc24: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%C)> [concrete = constants.%Factory.type.5c5] -// CHECK:STDOUT: %.loc11: %Factory.assoc_type.709 = specific_constant imports.%Main.import_ref.8d5, @Factory(constants.%C) [concrete = constants.%assoc0.ef9] -// CHECK:STDOUT: %Make.ref: %Factory.assoc_type.709 = name_ref Make, %.loc11 [concrete = constants.%assoc0.ef9] +// CHECK:STDOUT: %.loc24: %Factory.assoc_type.709 = specific_constant imports.%Main.import_ref.ff7, @Factory(constants.%C) [concrete = constants.%assoc1.ae5] +// CHECK:STDOUT: %Method.ref: %Factory.assoc_type.709 = name_ref Method, %.loc24 [concrete = constants.%assoc1.ae5] // CHECK:STDOUT: return to %return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1054,17 +1503,29 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Factory.type => constants.%Factory.type.a5d -// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self => constants.%Self.9ba // CHECK:STDOUT: %Make.type => constants.%Make.type.c59 // CHECK:STDOUT: %Make => constants.%Make.efe // CHECK:STDOUT: %Factory.assoc_type => constants.%Factory.assoc_type.668 // CHECK:STDOUT: %assoc0 => constants.%assoc0.228 +// CHECK:STDOUT: %Method.type => constants.%Method.type.117 +// CHECK:STDOUT: %Method => constants.%Method.ea9 +// CHECK:STDOUT: %assoc1 => constants.%assoc1.7a1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Factory(%T) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Make(constants.%T, constants.%Self) { +// CHECK:STDOUT: specific @Make(constants.%T, constants.%Self.9ba) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Factory(@Method.%T) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Method(constants.%T, constants.%Self.9ba) { // CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %Factory.type => constants.%Factory.type.c96 +// CHECK:STDOUT: %Self => constants.%Self.9ba +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type.56c // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Factory(constants.%C) { @@ -1073,10 +1534,42 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Factory.type => constants.%Factory.type.5c5 -// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self => constants.%Self.9ba // CHECK:STDOUT: %Make.type => constants.%Make.type.0de // CHECK:STDOUT: %Make => constants.%Make.8ba // CHECK:STDOUT: %Factory.assoc_type => constants.%Factory.assoc_type.709 // CHECK:STDOUT: %assoc0 => constants.%assoc0.ef9 +// CHECK:STDOUT: %Method.type => constants.%Method.type.d46 +// CHECK:STDOUT: %Method => constants.%Method.f9e +// CHECK:STDOUT: %assoc1 => constants.%assoc1.ae5 +// 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.%Factory.type.5c5) { +// CHECK:STDOUT: %Dest => constants.%Factory.type.5c5 +// CHECK:STDOUT: %Dest.patt => constants.%Factory.type.5c5 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.d43 +// CHECK:STDOUT: %Self => constants.%Self.519 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.9b5 +// CHECK:STDOUT: %Convert => constants.%Convert.8cc +// CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.0f8 +// CHECK:STDOUT: %assoc0 => constants.%assoc0.ae3 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/no_prelude/compound_member_access.carbon b/toolchain/check/testdata/interface/no_prelude/compound_member_access.carbon new file mode 100644 index 0000000000000..58506a96afe29 --- /dev/null +++ b/toolchain/check/testdata/interface/no_prelude/compound_member_access.carbon @@ -0,0 +1,2122 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/no_prelude/compound_member_access.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/compound_member_access.carbon + +// --- core.carbon +package Core; + +interface As(Dest:! type) { + fn Convert[self: Self]() -> Dest; +} + +interface ImplicitAs(Dest:! type) { + fn Convert[self: Self]() -> Dest; +} + +interface BitAnd { + fn Op[self: Self](other: Self) -> Self; +} + +impl forall [T:! type] T as BitAnd { + fn Op[self: Self](other: Self) -> Self = "type.and"; +} + +// --- associated_constant.carbon +library "[[@TEST_NAME]]"; + +interface J { + let U:! type; +} + +// Simple member access. +fn Simple1(T:! J, S:! T.U) {} + +// This should be equivalent to `Simple1` above, but using compound member access. +fn Compound1(V:! J, W:! V.(J.U)) {} + +// --- non_instance.carbon +library "[[@TEST_NAME]]"; + +interface K1 { + fn Q1(); +} + +// Simple member access. +fn Simple2(T:! K1) { + T.Q1(); +} + +// This should be equivalent to `Simple2` above, but using compound member access. +fn Compound2(V:! K1) { + V.(K1.Q1)(); +} + +// --- fail_caller_instance_interface_not.carbon +library "[[@TEST_NAME]]"; + +import Core; + +interface K2 { + fn Q2(); +} + +// Simple member access allows this. +// TODO: This is not expected to fail. +fn Simple3(T:! K2, x: T) { + // CHECK:STDERR: fail_caller_instance_interface_not.carbon:[[@LINE+4]]:3: error: type `T` does not support qualified expressions [QualifiedExprUnsupported] + // CHECK:STDERR: x.Q2(); + // CHECK:STDERR: ^~~~ + // CHECK:STDERR: + x.Q2(); +} + +// Compound member access does not. It tries to convert `y` to `K2`, but only +// its type `V` can. +fn Compound3(V:! K2, y: V) { + // CHECK:STDERR: fail_caller_instance_interface_not.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `V` to `K2` [ImplicitAsConversionFailure] + // CHECK:STDERR: y.(K2.Q2)(); + // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_caller_instance_interface_not.carbon:[[@LINE+4]]:3: note: type `V` does not implement interface `Core.ImplicitAs(K2)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: y.(K2.Q2)(); + // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: + y.(K2.Q2)(); +} + +// --- fail_todo_instance.carbon +library "[[@TEST_NAME]]"; + +interface L1 { + fn R1[self: Self](); + fn S1[addr self: Self*](); +} + +// Simple member access. +// TODO: This is not expected to fail. +fn Simple4(T:! L1, x: T) { + // CHECK:STDERR: fail_todo_instance.carbon:[[@LINE+4]]:3: error: type `T` does not support qualified expressions [QualifiedExprUnsupported] + // CHECK:STDERR: x.R1(); + // CHECK:STDERR: ^~~~ + // CHECK:STDERR: + x.R1(); + var xcopy: T = x; + // CHECK:STDERR: fail_todo_instance.carbon:[[@LINE+4]]:3: error: type `T` does not support qualified expressions [QualifiedExprUnsupported] + // CHECK:STDERR: xcopy.S1(); + // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: + xcopy.S1(); +} + +// This should be equivalent to `Simple4` above, but using compound member access. +fn Compound4(V:! L1, y: V) { + // CHECK:STDERR: fail_todo_instance.carbon:[[@LINE+4]]:3: error: cannot access member of interface `L1` in type `V` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: y.(L1.R1)(); + // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: + y.(L1.R1)(); + var ycopy: V = y; + // CHECK:STDERR: fail_todo_instance.carbon:[[@LINE+4]]:3: error: cannot access member of interface `L1` in type `V` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ycopy.(L1.S1)(); + // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: + ycopy.(L1.S1)(); +} + +// --- fail_interface_instance_caller_not.carbon + +library "[[@TEST_NAME]]"; + +interface L2 { + fn R2[self: Self](); + fn S2[addr self: Self*](); +} + +// Simple member access. Fails since calling an instance method without an object. +fn Simple5(T:! L2) { + // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE+7]]:3: error: missing object argument in method call [MissingObjectInMethodCall] + // CHECK:STDERR: T.R2(); + // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE-9]]:3: note: calling function declared here [InCallToFunction] + // CHECK:STDERR: fn R2[self: Self](); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + T.R2(); + // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE+7]]:3: error: missing object argument in method call [MissingObjectInMethodCall] + // CHECK:STDERR: T.S2(); + // CHECK:STDERR: ^~~~~~ + // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE-16]]:3: note: calling function declared here [InCallToFunction] + // CHECK:STDERR: fn S2[addr self: Self*](); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + T.S2(); +} + +// TODO: Expected to fail in the same way as `Simple5`. +fn Compound5(V:! L2) { + // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE+4]]:3: error: cannot access member of interface `L2` in type `L2` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: V.(L2.R2)(); + // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: + V.(L2.R2)(); + // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE+4]]:3: error: cannot access member of interface `L2` in type `L2` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: V.(L2.S2)(); + // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: + V.(L2.S2)(); +} + +// --- fail_combine_non_instance.carbon +library "[[@TEST_NAME]]"; + +import Core; + +interface A { + fn G(); +} + +class C {} +impl C as A { + fn G() {} +} + +// Since `A.G` is a non-instance method, compound member access may only be +// used with a type, not an instance. +fn Fails() { + // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `C` to `A` [ImplicitAsConversionFailure] + // CHECK:STDERR: ({} as C).((A & A).G)(); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+4]]:3: note: type `C` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: ({} as C).((A & A).G)(); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + ({} as C).((A & A).G)(); + // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `C` to `A` [ImplicitAsConversionFailure] + // CHECK:STDERR: (({} as C) as (C as (A & A))).((A & A).G)(); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+4]]:3: note: type `C` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: (({} as C) as (C as (A & A))).((A & A).G)(); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + (({} as C) as (C as (A & A))).((A & A).G)(); + // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `C` to `A` [ImplicitAsConversionFailure] + // CHECK:STDERR: (({} as C) as (C as (A & A))).(A.G)(); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+4]]:3: note: type `C` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: (({} as C) as (C as (A & A))).(A.G)(); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + (({} as C) as (C as (A & A))).(A.G)(); +} + +// --- allowed_combine_non_instance.carbon +library "[[@TEST_NAME]]"; + +import Core; + +interface A { + fn G(); +} + +class C {} +impl C as A { + fn G() {} +} + +fn Works() { + C.((A & A).G)(); + (C as (A & A)).((A & A).G)(); + (C as (A & A)).(A.G)(); +} + +// 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: %As.type.b51: type = generic_interface_type @As [concrete] +// CHECK:STDOUT: %As.generic: %As.type.b51 = struct_value () [concrete] +// CHECK:STDOUT: %As.type.8ba: type = facet_type <@As, @As(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.b4e: %As.type.8ba = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Self.as_type.7f0: type = facet_access_type %Self.b4e [symbolic] +// CHECK:STDOUT: %Convert.type.ad1: type = fn_type @Convert.1, @As(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.0ed: %Convert.type.ad1 = struct_value () [symbolic] +// CHECK:STDOUT: %As.assoc_type: type = assoc_entity_type %As.type.8ba [symbolic] +// CHECK:STDOUT: %assoc0.ac5: %As.assoc_type = assoc_entity element0, @As.%Convert.decl [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.0f3: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Self.as_type.419: type = facet_access_type %Self.0f3 [symbolic] +// CHECK:STDOUT: %Convert.type.4cf: type = fn_type @Convert.2, @ImplicitAs(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.147: %Convert.type.4cf = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type %ImplicitAs.type.07f [symbolic] +// CHECK:STDOUT: %assoc0.a50: %ImplicitAs.assoc_type = assoc_entity element0, @ImplicitAs.%Convert.decl [symbolic] +// CHECK:STDOUT: %BitAnd.type: type = facet_type <@BitAnd> [concrete] +// CHECK:STDOUT: %Self.e44: %BitAnd.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.as_type.560: type = facet_access_type %Self.e44 [symbolic] +// CHECK:STDOUT: %Op.type.613: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.d98: %Op.type.613 = struct_value () [concrete] +// CHECK:STDOUT: %BitAnd.assoc_type: type = assoc_entity_type %BitAnd.type [concrete] +// CHECK:STDOUT: %assoc0.121: %BitAnd.assoc_type = assoc_entity element0, @BitAnd.%Op.decl [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%Op.decl), @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.type.28d: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.902: %Op.type.28d = struct_value () [symbolic] +// CHECK:STDOUT: %require_complete: = require_complete_type %T [symbolic] +// CHECK:STDOUT: %BitAnd.facet: %BitAnd.type = facet_value %T, %impl_witness [symbolic] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .As = %As.decl +// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl +// CHECK:STDOUT: .BitAnd = %BitAnd.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %As.decl: %As.type.b51 = interface_decl @As [concrete = constants.%As.generic] { +// CHECK:STDOUT: %Dest.patt.loc3_14.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc3_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: %Dest.param_patt: type = value_param_pattern %Dest.patt.loc3_14.1, runtime_param [symbolic = %Dest.patt.loc3_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.param: type = value_param runtime_param +// CHECK:STDOUT: %Dest.loc3_14.1: type = bind_symbolic_name Dest, 0, %Dest.param [symbolic = %Dest.loc3_14.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { +// CHECK:STDOUT: %Dest.patt.loc7_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc7_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: %Dest.param_patt: type = value_param_pattern %Dest.patt.loc7_22.1, runtime_param [symbolic = %Dest.patt.loc7_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.param: type = value_param runtime_param +// CHECK:STDOUT: %Dest.loc7_22.1: type = bind_symbolic_name Dest, 0, %Dest.param [symbolic = %Dest.loc7_22.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %BitAnd.decl: type = interface_decl @BitAnd [concrete = constants.%BitAnd.type] {} {} +// CHECK:STDOUT: impl_decl @impl [concrete] { +// CHECK:STDOUT: %T.patt.loc15_14.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc15_14.1, runtime_param [symbolic = %T.patt.loc15_14.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc15_14.1 [symbolic = %T.loc15_14.2 (constants.%T)] +// CHECK:STDOUT: %BitAnd.ref: type = name_ref BitAnd, file.%BitAnd.decl [concrete = constants.%BitAnd.type] +// CHECK:STDOUT: %T.param: type = value_param runtime_param +// CHECK:STDOUT: %T.loc15_14.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc15_14.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%Op.decl), @impl(constants.%T) [symbolic = @impl.%impl_witness (constants.%impl_witness)] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(%Dest.loc3_14.1: type) { +// CHECK:STDOUT: %Dest.loc3_14.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc3_14.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc3_14.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc3_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest.loc3_14.2)> [symbolic = %As.type (constants.%As.type.8ba)] +// CHECK:STDOUT: %Self.2: %As.type.8ba = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.b4e)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.1, @As(%Dest.loc3_14.2) [symbolic = %Convert.type (constants.%Convert.type.ad1)] +// CHECK:STDOUT: %Convert: @As.%Convert.type (%Convert.type.ad1) = struct_value () [symbolic = %Convert (constants.%Convert.0ed)] +// CHECK:STDOUT: %As.assoc_type: type = assoc_entity_type @As.%As.type (%As.type.8ba) [symbolic = %As.assoc_type (constants.%As.assoc_type)] +// CHECK:STDOUT: %assoc0.loc4_35.2: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc4_35.2 (constants.%assoc0.ac5)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: %Self.1: @As.%As.type (%As.type.8ba) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.b4e)] +// CHECK:STDOUT: %Convert.decl: @As.%Convert.type (%Convert.type.ad1) = fn_decl @Convert.1 [symbolic = @As.%Convert (constants.%Convert.0ed)] { +// CHECK:STDOUT: %self.patt: @Convert.1.%Self.as_type.loc4_20.1 (%Self.as_type.7f0) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.1.%Self.as_type.loc4_20.1 (%Self.as_type.7f0) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: @Convert.1.%Dest (%Dest) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Convert.1.%Dest (%Dest) = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @As.%Dest.loc3_14.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.1.%Self.as_type.loc4_20.1 (%Self.as_type.7f0) = value_param runtime_param0 +// CHECK:STDOUT: %.loc4_20.1: type = splice_block %.loc4_20.3 [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type.7f0)] { +// CHECK:STDOUT: %.loc4_20.2: @Convert.1.%As.type (%As.type.8ba) = specific_constant @As.%Self.1, @As(constants.%Dest) [symbolic = %Self (constants.%Self.b4e)] +// CHECK:STDOUT: %Self.ref: @Convert.1.%As.type (%As.type.8ba) = name_ref Self, %.loc4_20.2 [symbolic = %Self (constants.%Self.b4e)] +// CHECK:STDOUT: %Self.as_type.loc4_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: %.loc4_20.3: type = converted %Self.ref, %Self.as_type.loc4_20.2 [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.1.%Self.as_type.loc4_20.1 (%Self.as_type.7f0) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.1.%Dest (%Dest) = out_param runtime_param1 +// CHECK:STDOUT: %return: ref @Convert.1.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc4_35.1: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc4_35.2 (constants.%assoc0.ac5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc4_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc7_22.1: type) { +// CHECK:STDOUT: %Dest.loc7_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc7_22.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc7_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc7_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc7_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.0f3)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.2, @ImplicitAs(%Dest.loc7_22.2) [symbolic = %Convert.type (constants.%Convert.type.4cf)] +// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.4cf) = struct_value () [symbolic = %Convert (constants.%Convert.147)] +// 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.loc8_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc8_35.2 (constants.%assoc0.a50)] +// 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.0f3)] +// CHECK:STDOUT: %Convert.decl: @ImplicitAs.%Convert.type (%Convert.type.4cf) = fn_decl @Convert.2 [symbolic = @ImplicitAs.%Convert (constants.%Convert.147)] { +// CHECK:STDOUT: %self.patt: @Convert.2.%Self.as_type.loc8_20.1 (%Self.as_type.419) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.2.%Self.as_type.loc8_20.1 (%Self.as_type.419) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: @Convert.2.%Dest (%Dest) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Convert.2.%Dest (%Dest) = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc7_22.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.2.%Self.as_type.loc8_20.1 (%Self.as_type.419) = value_param runtime_param0 +// CHECK:STDOUT: %.loc8_20.1: type = splice_block %.loc8_20.3 [symbolic = %Self.as_type.loc8_20.1 (constants.%Self.as_type.419)] { +// CHECK:STDOUT: %.loc8_20.2: @Convert.2.%ImplicitAs.type (%ImplicitAs.type.07f) = specific_constant @ImplicitAs.%Self.1, @ImplicitAs(constants.%Dest) [symbolic = %Self (constants.%Self.0f3)] +// CHECK:STDOUT: %Self.ref: @Convert.2.%ImplicitAs.type (%ImplicitAs.type.07f) = name_ref Self, %.loc8_20.2 [symbolic = %Self (constants.%Self.0f3)] +// CHECK:STDOUT: %Self.as_type.loc8_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc8_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: %.loc8_20.3: type = converted %Self.ref, %Self.as_type.loc8_20.2 [symbolic = %Self.as_type.loc8_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.2.%Self.as_type.loc8_20.1 (%Self.as_type.419) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.2.%Dest (%Dest) = out_param runtime_param1 +// CHECK:STDOUT: %return: ref @Convert.2.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc8_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc8_35.2 (constants.%assoc0.a50)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc8_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @BitAnd { +// CHECK:STDOUT: %Self: %BitAnd.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.e44] +// CHECK:STDOUT: %Op.decl: %Op.type.613 = fn_decl @Op.1 [concrete = constants.%Op.d98] { +// CHECK:STDOUT: %self.patt: @Op.1.%Self.as_type.loc12_15.1 (%Self.as_type.560) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Op.1.%Self.as_type.loc12_15.1 (%Self.as_type.560) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: %other.patt: @Op.1.%Self.as_type.loc12_15.1 (%Self.as_type.560) = binding_pattern other +// CHECK:STDOUT: %other.param_patt: @Op.1.%Self.as_type.loc12_15.1 (%Self.as_type.560) = value_param_pattern %other.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: @Op.1.%Self.as_type.loc12_15.1 (%Self.as_type.560) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Op.1.%Self.as_type.loc12_15.1 (%Self.as_type.560) = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Self.ref.loc12_37: %BitAnd.type = name_ref Self, @BitAnd.%Self [symbolic = %Self (constants.%Self.e44)] +// CHECK:STDOUT: %Self.as_type.loc12_37: type = facet_access_type %Self.ref.loc12_37 [symbolic = %Self.as_type.loc12_15.1 (constants.%Self.as_type.560)] +// CHECK:STDOUT: %.loc12_37: type = converted %Self.ref.loc12_37, %Self.as_type.loc12_37 [symbolic = %Self.as_type.loc12_15.1 (constants.%Self.as_type.560)] +// CHECK:STDOUT: %self.param: @Op.1.%Self.as_type.loc12_15.1 (%Self.as_type.560) = value_param runtime_param0 +// CHECK:STDOUT: %.loc12_15.1: type = splice_block %.loc12_15.2 [symbolic = %Self.as_type.loc12_15.1 (constants.%Self.as_type.560)] { +// CHECK:STDOUT: %Self.ref.loc12_15: %BitAnd.type = name_ref Self, @BitAnd.%Self [symbolic = %Self (constants.%Self.e44)] +// CHECK:STDOUT: %Self.as_type.loc12_15.2: type = facet_access_type %Self.ref.loc12_15 [symbolic = %Self.as_type.loc12_15.1 (constants.%Self.as_type.560)] +// CHECK:STDOUT: %.loc12_15.2: type = converted %Self.ref.loc12_15, %Self.as_type.loc12_15.2 [symbolic = %Self.as_type.loc12_15.1 (constants.%Self.as_type.560)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Op.1.%Self.as_type.loc12_15.1 (%Self.as_type.560) = bind_name self, %self.param +// CHECK:STDOUT: %other.param: @Op.1.%Self.as_type.loc12_15.1 (%Self.as_type.560) = value_param runtime_param1 +// CHECK:STDOUT: %.loc12_28.1: type = splice_block %.loc12_28.2 [symbolic = %Self.as_type.loc12_15.1 (constants.%Self.as_type.560)] { +// CHECK:STDOUT: %Self.ref.loc12_28: %BitAnd.type = name_ref Self, @BitAnd.%Self [symbolic = %Self (constants.%Self.e44)] +// CHECK:STDOUT: %Self.as_type.loc12_28: type = facet_access_type %Self.ref.loc12_28 [symbolic = %Self.as_type.loc12_15.1 (constants.%Self.as_type.560)] +// CHECK:STDOUT: %.loc12_28.2: type = converted %Self.ref.loc12_28, %Self.as_type.loc12_28 [symbolic = %Self.as_type.loc12_15.1 (constants.%Self.as_type.560)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %other: @Op.1.%Self.as_type.loc12_15.1 (%Self.as_type.560) = bind_name other, %other.param +// CHECK:STDOUT: %return.param: ref @Op.1.%Self.as_type.loc12_15.1 (%Self.as_type.560) = out_param runtime_param2 +// CHECK:STDOUT: %return: ref @Op.1.%Self.as_type.loc12_15.1 (%Self.as_type.560) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0: %BitAnd.assoc_type = assoc_entity element0, %Op.decl [concrete = constants.%assoc0.121] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: .Op = %assoc0 +// CHECK:STDOUT: witness = (%Op.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl(%T.loc15_14.1: type) { +// CHECK:STDOUT: %T.loc15_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc15_14.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc15_14.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %impl_witness: = impl_witness (%Op.decl), @impl(%T.loc15_14.2) [symbolic = %impl_witness (constants.%impl_witness)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Op.type: type = fn_type @Op.2, @impl(%T.loc15_14.2) [symbolic = %Op.type (constants.%Op.type.28d)] +// CHECK:STDOUT: %Op: @impl.%Op.type (%Op.type.28d) = struct_value () [symbolic = %Op (constants.%Op.902)] +// CHECK:STDOUT: %require_complete: = require_complete_type @impl.%T.loc15_14.2 (%T) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %T.ref as %BitAnd.ref { +// CHECK:STDOUT: %Op.decl: @impl.%Op.type (%Op.type.28d) = fn_decl @Op.2 [symbolic = @impl.%Op (constants.%Op.902)] { +// CHECK:STDOUT: %self.patt: @Op.2.%T (%T) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Op.2.%T (%T) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: %other.patt: @Op.2.%T (%T) = binding_pattern other +// CHECK:STDOUT: %other.param_patt: @Op.2.%T (%T) = value_param_pattern %other.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: @Op.2.%T (%T) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Op.2.%T (%T) = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Self.ref.loc16_37: type = name_ref Self, @impl.%T.ref [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %self.param: @Op.2.%T (%T) = value_param runtime_param0 +// CHECK:STDOUT: %Self.ref.loc16_15: type = name_ref Self, @impl.%T.ref [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %self: @Op.2.%T (%T) = bind_name self, %self.param +// CHECK:STDOUT: %other.param: @Op.2.%T (%T) = value_param runtime_param1 +// CHECK:STDOUT: %Self.ref.loc16_28: type = name_ref Self, @impl.%T.ref [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %other: @Op.2.%T (%T) = bind_name other, %other.param +// CHECK:STDOUT: %return.param: ref @Op.2.%T (%T) = out_param runtime_param2 +// CHECK:STDOUT: %return: ref @Op.2.%T (%T) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Op = %Op.decl +// CHECK:STDOUT: witness = file.%impl_witness +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(@As.%Dest.loc3_14.1: type, @As.%Self.1: @As.%As.type (%As.type.8ba)) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest)> [symbolic = %As.type (constants.%As.type.8ba)] +// CHECK:STDOUT: %Self: %As.type.8ba = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.b4e)] +// CHECK:STDOUT: %Self.as_type.loc4_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self.as_type.loc4_20.1 (%Self.as_type.7f0)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(@ImplicitAs.%Dest.loc7_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.0f3)] +// CHECK:STDOUT: %Self.as_type.loc8_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc8_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.2.%Self.as_type.loc8_20.1 (%Self.as_type.419)]() -> @Convert.2.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Op.1(@BitAnd.%Self: %BitAnd.type) { +// CHECK:STDOUT: %Self: %BitAnd.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.e44)] +// CHECK:STDOUT: %Self.as_type.loc12_15.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc12_15.1 (constants.%Self.as_type.560)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Op.1.%Self.as_type.loc12_15.1 (%Self.as_type.560)](%other.param_patt: @Op.1.%Self.as_type.loc12_15.1 (%Self.as_type.560)) -> @Op.1.%Self.as_type.loc12_15.1 (%Self.as_type.560); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Op.2(@impl.%T.loc15_14.1: type) { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Op.2.%T (%T)](%other.param_patt: @Op.2.%T (%T)) -> @Op.2.%T (%T) = "type.and"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc3_14.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc3_14.2 => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.1(constants.%Dest, constants.%Self.b4e) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %As.type => constants.%As.type.8ba +// CHECK:STDOUT: %Self => constants.%Self.b4e +// CHECK:STDOUT: %Self.as_type.loc4_20.1 => constants.%Self.as_type.7f0 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@Convert.1.%Dest) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(%Dest.loc3_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc7_22.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc7_22.2 => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.2(constants.%Dest, constants.%Self.0f3) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.07f +// CHECK:STDOUT: %Self => constants.%Self.0f3 +// CHECK:STDOUT: %Self.as_type.loc8_20.1 => constants.%Self.as_type.419 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@Convert.2.%Dest) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(%Dest.loc7_22.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Op.1(constants.%Self.e44) { +// CHECK:STDOUT: %Self => constants.%Self.e44 +// CHECK:STDOUT: %Self.as_type.loc12_15.1 => constants.%Self.as_type.560 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl(constants.%T) { +// CHECK:STDOUT: %T.loc15_14.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc15_14.2 => constants.%T +// CHECK:STDOUT: %impl_witness => constants.%impl_witness +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl(%T.loc15_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Op.2(constants.%T) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Op.1(constants.%BitAnd.facet) { +// CHECK:STDOUT: %Self => constants.%BitAnd.facet +// CHECK:STDOUT: %Self.as_type.loc12_15.1 => constants.%T +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- associated_constant.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// 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.%U [concrete] +// CHECK:STDOUT: %T: %J.type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.patt: %J.type = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic] +// CHECK:STDOUT: %T.as_wit: = facet_access_witness %T [symbolic] +// CHECK:STDOUT: %J.facet.70ff88.1: %J.type = facet_value %T.as_type, %T.as_wit [symbolic] +// CHECK:STDOUT: %impl.elem0.f44b07.1: type = impl_witness_access %T.as_wit, element0 [symbolic] +// CHECK:STDOUT: %S: %impl.elem0.f44b07.1 = bind_symbolic_name S, 1 [symbolic] +// CHECK:STDOUT: %S.patt: %impl.elem0.f44b07.1 = symbolic_binding_pattern S, 1 [symbolic] +// CHECK:STDOUT: %Simple1.type: type = fn_type @Simple1 [concrete] +// CHECK:STDOUT: %Simple1: %Simple1.type = struct_value () [concrete] +// CHECK:STDOUT: %V: %J.type = bind_symbolic_name V, 0 [symbolic] +// CHECK:STDOUT: %V.patt: %J.type = symbolic_binding_pattern V, 0 [symbolic] +// CHECK:STDOUT: %V.as_type: type = facet_access_type %V [symbolic] +// CHECK:STDOUT: %V.as_wit: = facet_access_witness %V [symbolic] +// CHECK:STDOUT: %J.facet.70ff88.2: %J.type = facet_value %V.as_type, %V.as_wit [symbolic] +// CHECK:STDOUT: %impl.elem0.f44b07.2: type = impl_witness_access %V.as_wit, element0 [symbolic] +// CHECK:STDOUT: %W: %impl.elem0.f44b07.2 = bind_symbolic_name W, 1 [symbolic] +// CHECK:STDOUT: %W.patt: %impl.elem0.f44b07.2 = symbolic_binding_pattern W, 1 [symbolic] +// CHECK:STDOUT: %Compound1.type: type = fn_type @Compound1 [concrete] +// CHECK:STDOUT: %Compound1: %Compound1.type = struct_value () [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .J = %J.decl +// CHECK:STDOUT: .Simple1 = %Simple1.decl +// CHECK:STDOUT: .Compound1 = %Compound1.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %J.decl: type = interface_decl @J [concrete = constants.%J.type] {} {} +// CHECK:STDOUT: %Simple1.decl: %Simple1.type = fn_decl @Simple1 [concrete = constants.%Simple1] { +// CHECK:STDOUT: %T.patt.loc8_12.1: %J.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_12.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.param_patt: %J.type = value_param_pattern %T.patt.loc8_12.1, runtime_param [symbolic = %T.patt.loc8_12.2 (constants.%T.patt)] +// CHECK:STDOUT: %S.patt.loc8_19.1: @Simple1.%impl.elem0.loc8_24.2 (%impl.elem0.f44b07.1) = symbolic_binding_pattern S, 1 [symbolic = %S.patt.loc8_19.2 (constants.%S.patt)] +// CHECK:STDOUT: %S.param_patt: @Simple1.%impl.elem0.loc8_24.2 (%impl.elem0.f44b07.1) = value_param_pattern %S.patt.loc8_19.1, runtime_param [symbolic = %S.patt.loc8_19.2 (constants.%S.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %T.param: %J.type = value_param runtime_param +// CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] +// CHECK:STDOUT: %T.loc8_12.1: %J.type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc8_12.2 (constants.%T)] +// CHECK:STDOUT: %S.param: @Simple1.%impl.elem0.loc8_24.2 (%impl.elem0.f44b07.1) = value_param runtime_param +// CHECK:STDOUT: %.loc8_24.1: type = splice_block %impl.elem0.loc8_24.1 [symbolic = %impl.elem0.loc8_24.2 (constants.%impl.elem0.f44b07.1)] { +// CHECK:STDOUT: %T.ref: %J.type = name_ref T, %T.loc8_12.1 [symbolic = %T.loc8_12.2 (constants.%T)] +// CHECK:STDOUT: %U.ref: %J.assoc_type = name_ref U, @U.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %T.as_type.loc8_24.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc8_24.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc8_24.2: type = converted %T.ref, %T.as_type.loc8_24.1 [symbolic = %T.as_type.loc8_24.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_wit.loc8_24.1: = facet_access_witness %T.ref [symbolic = %T.as_wit.loc8_24.2 (constants.%T.as_wit)] +// CHECK:STDOUT: %impl.elem0.loc8_24.1: type = impl_witness_access %T.as_wit.loc8_24.1, element0 [symbolic = %impl.elem0.loc8_24.2 (constants.%impl.elem0.f44b07.1)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %S.loc8_19.1: @Simple1.%impl.elem0.loc8_24.2 (%impl.elem0.f44b07.1) = bind_symbolic_name S, 1, %S.param [symbolic = %S.loc8_19.2 (constants.%S)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Compound1.decl: %Compound1.type = fn_decl @Compound1 [concrete = constants.%Compound1] { +// CHECK:STDOUT: %V.patt.loc11_14.1: %J.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc11_14.2 (constants.%V.patt)] +// CHECK:STDOUT: %V.param_patt: %J.type = value_param_pattern %V.patt.loc11_14.1, runtime_param [symbolic = %V.patt.loc11_14.2 (constants.%V.patt)] +// CHECK:STDOUT: %W.patt.loc11_21.1: @Compound1.%impl.elem0.loc11_26.2 (%impl.elem0.f44b07.2) = symbolic_binding_pattern W, 1 [symbolic = %W.patt.loc11_21.2 (constants.%W.patt)] +// CHECK:STDOUT: %W.param_patt: @Compound1.%impl.elem0.loc11_26.2 (%impl.elem0.f44b07.2) = value_param_pattern %W.patt.loc11_21.1, runtime_param [symbolic = %W.patt.loc11_21.2 (constants.%W.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %V.param: %J.type = value_param runtime_param +// CHECK:STDOUT: %J.ref.loc11_18: type = name_ref J, file.%J.decl [concrete = constants.%J.type] +// CHECK:STDOUT: %V.loc11_14.1: %J.type = bind_symbolic_name V, 0, %V.param [symbolic = %V.loc11_14.2 (constants.%V)] +// CHECK:STDOUT: %W.param: @Compound1.%impl.elem0.loc11_26.2 (%impl.elem0.f44b07.2) = value_param runtime_param +// CHECK:STDOUT: %.loc11: type = splice_block %impl.elem0.loc11_26.1 [symbolic = %impl.elem0.loc11_26.2 (constants.%impl.elem0.f44b07.2)] { +// CHECK:STDOUT: %V.ref: %J.type = name_ref V, %V.loc11_14.1 [symbolic = %V.loc11_14.2 (constants.%V)] +// CHECK:STDOUT: %J.ref.loc11_28: type = name_ref J, file.%J.decl [concrete = constants.%J.type] +// CHECK:STDOUT: %U.ref: %J.assoc_type = name_ref U, @U.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %V.as_wit.loc11_26.1: = facet_access_witness %V.ref [symbolic = %V.as_wit.loc11_26.2 (constants.%V.as_wit)] +// CHECK:STDOUT: %impl.elem0.loc11_26.1: type = impl_witness_access %V.as_wit.loc11_26.1, element0 [symbolic = %impl.elem0.loc11_26.2 (constants.%impl.elem0.f44b07.2)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %W.loc11_21.1: @Compound1.%impl.elem0.loc11_26.2 (%impl.elem0.f44b07.2) = bind_symbolic_name W, 1, %W.param [symbolic = %W.loc11_21.2 (constants.%W)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @J { +// CHECK:STDOUT: %Self: %J.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] +// CHECK:STDOUT: %U: type = assoc_const_decl @U [concrete] { +// CHECK:STDOUT: %assoc0: %J.assoc_type = assoc_entity element0, @J.%U [concrete = constants.%assoc0] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: .U = @U.%assoc0 +// CHECK:STDOUT: witness = (%U) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic assoc_const @U(@J.%Self: %J.type) { +// CHECK:STDOUT: assoc_const U:! type; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Simple1(%T.loc8_12.1: %J.type, %S.loc8_19.1: @Simple1.%impl.elem0.loc8_24.2 (%impl.elem0.f44b07.1)) { +// CHECK:STDOUT: %T.loc8_12.2: %J.type = bind_symbolic_name T, 0 [symbolic = %T.loc8_12.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc8_12.2: %J.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_12.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.as_type.loc8_24.2: type = facet_access_type %T.loc8_12.2 [symbolic = %T.as_type.loc8_24.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_wit.loc8_24.2: = facet_access_witness %T.loc8_12.2 [symbolic = %T.as_wit.loc8_24.2 (constants.%T.as_wit)] +// CHECK:STDOUT: %impl.elem0.loc8_24.2: type = impl_witness_access %T.as_wit.loc8_24.2, element0 [symbolic = %impl.elem0.loc8_24.2 (constants.%impl.elem0.f44b07.1)] +// CHECK:STDOUT: %S.loc8_19.2: %impl.elem0.f44b07.1 = bind_symbolic_name S, 1 [symbolic = %S.loc8_19.2 (constants.%S)] +// CHECK:STDOUT: %S.patt.loc8_19.2: %impl.elem0.f44b07.1 = symbolic_binding_pattern S, 1 [symbolic = %S.patt.loc8_19.2 (constants.%S.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%T.param_patt: %J.type, %S.param_patt: @Simple1.%impl.elem0.loc8_24.2 (%impl.elem0.f44b07.1)) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Compound1(%V.loc11_14.1: %J.type, %W.loc11_21.1: @Compound1.%impl.elem0.loc11_26.2 (%impl.elem0.f44b07.2)) { +// CHECK:STDOUT: %V.loc11_14.2: %J.type = bind_symbolic_name V, 0 [symbolic = %V.loc11_14.2 (constants.%V)] +// CHECK:STDOUT: %V.patt.loc11_14.2: %J.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc11_14.2 (constants.%V.patt)] +// CHECK:STDOUT: %V.as_wit.loc11_26.2: = facet_access_witness %V.loc11_14.2 [symbolic = %V.as_wit.loc11_26.2 (constants.%V.as_wit)] +// CHECK:STDOUT: %impl.elem0.loc11_26.2: type = impl_witness_access %V.as_wit.loc11_26.2, element0 [symbolic = %impl.elem0.loc11_26.2 (constants.%impl.elem0.f44b07.2)] +// CHECK:STDOUT: %W.loc11_21.2: %impl.elem0.f44b07.2 = bind_symbolic_name W, 1 [symbolic = %W.loc11_21.2 (constants.%W)] +// CHECK:STDOUT: %W.patt.loc11_21.2: %impl.elem0.f44b07.2 = symbolic_binding_pattern W, 1 [symbolic = %W.patt.loc11_21.2 (constants.%W.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%V.param_patt: %J.type, %W.param_patt: @Compound1.%impl.elem0.loc11_26.2 (%impl.elem0.f44b07.2)) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @U(constants.%Self) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @U(constants.%J.facet.70ff88.1) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Simple1(constants.%T, constants.%S) { +// CHECK:STDOUT: %T.loc8_12.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc8_12.2 => constants.%T +// CHECK:STDOUT: %T.as_type.loc8_24.2 => constants.%T.as_type +// CHECK:STDOUT: %T.as_wit.loc8_24.2 => constants.%T.as_wit +// CHECK:STDOUT: %impl.elem0.loc8_24.2 => constants.%impl.elem0.f44b07.1 +// CHECK:STDOUT: %S.loc8_19.2 => constants.%S +// CHECK:STDOUT: %S.patt.loc8_19.2 => constants.%S +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @U(constants.%J.facet.70ff88.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Compound1(constants.%V, constants.%W) { +// CHECK:STDOUT: %V.loc11_14.2 => constants.%V +// CHECK:STDOUT: %V.patt.loc11_14.2 => constants.%V +// CHECK:STDOUT: %V.as_wit.loc11_26.2 => constants.%V.as_wit +// CHECK:STDOUT: %impl.elem0.loc11_26.2 => constants.%impl.elem0.f44b07.2 +// CHECK:STDOUT: %W.loc11_21.2 => constants.%W +// CHECK:STDOUT: %W.patt.loc11_21.2 => constants.%W +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- non_instance.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %K1.type: type = facet_type <@K1> [concrete] +// CHECK:STDOUT: %Self: %K1.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Q1.type: type = fn_type @Q1 [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %Q1: %Q1.type = struct_value () [concrete] +// CHECK:STDOUT: %K1.assoc_type: type = assoc_entity_type %K1.type [concrete] +// CHECK:STDOUT: %assoc0: %K1.assoc_type = assoc_entity element0, @K1.%Q1.decl [concrete] +// CHECK:STDOUT: %T: %K1.type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.patt: %K1.type = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %Simple2.type: type = fn_type @Simple2 [concrete] +// CHECK:STDOUT: %Simple2: %Simple2.type = struct_value () [concrete] +// CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic] +// CHECK:STDOUT: %T.as_wit: = facet_access_witness %T [symbolic] +// CHECK:STDOUT: %K1.facet.5fb678.1: %K1.type = facet_value %T.as_type, %T.as_wit [symbolic] +// CHECK:STDOUT: %.aaf76c.1: type = fn_type_with_self_type %Q1.type, %K1.facet.5fb678.1 [symbolic] +// CHECK:STDOUT: %impl.elem0.3809cc.1: %.aaf76c.1 = impl_witness_access %T.as_wit, element0 [symbolic] +// CHECK:STDOUT: %specific_fn.bc5944.1: = specific_function %impl.elem0.3809cc.1, @Q1(%K1.facet.5fb678.1) [symbolic] +// CHECK:STDOUT: %V: %K1.type = bind_symbolic_name V, 0 [symbolic] +// CHECK:STDOUT: %V.patt: %K1.type = symbolic_binding_pattern V, 0 [symbolic] +// CHECK:STDOUT: %Compound2.type: type = fn_type @Compound2 [concrete] +// CHECK:STDOUT: %Compound2: %Compound2.type = struct_value () [concrete] +// CHECK:STDOUT: %V.as_type: type = facet_access_type %V [symbolic] +// CHECK:STDOUT: %V.as_wit: = facet_access_witness %V [symbolic] +// CHECK:STDOUT: %K1.facet.5fb678.2: %K1.type = facet_value %V.as_type, %V.as_wit [symbolic] +// CHECK:STDOUT: %.aaf76c.2: type = fn_type_with_self_type %Q1.type, %K1.facet.5fb678.2 [symbolic] +// CHECK:STDOUT: %impl.elem0.3809cc.2: %.aaf76c.2 = impl_witness_access %V.as_wit, element0 [symbolic] +// CHECK:STDOUT: %specific_fn.bc5944.2: = specific_function %impl.elem0.3809cc.2, @Q1(%K1.facet.5fb678.2) [symbolic] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .K1 = %K1.decl +// CHECK:STDOUT: .Simple2 = %Simple2.decl +// CHECK:STDOUT: .Compound2 = %Compound2.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %K1.decl: type = interface_decl @K1 [concrete = constants.%K1.type] {} {} +// CHECK:STDOUT: %Simple2.decl: %Simple2.type = fn_decl @Simple2 [concrete = constants.%Simple2] { +// CHECK:STDOUT: %T.patt.loc8_12.1: %K1.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_12.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.param_patt: %K1.type = value_param_pattern %T.patt.loc8_12.1, runtime_param [symbolic = %T.patt.loc8_12.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %T.param: %K1.type = value_param runtime_param +// CHECK:STDOUT: %K1.ref: type = name_ref K1, file.%K1.decl [concrete = constants.%K1.type] +// CHECK:STDOUT: %T.loc8_12.1: %K1.type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc8_12.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Compound2.decl: %Compound2.type = fn_decl @Compound2 [concrete = constants.%Compound2] { +// CHECK:STDOUT: %V.patt.loc13_14.1: %K1.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc13_14.2 (constants.%V.patt)] +// CHECK:STDOUT: %V.param_patt: %K1.type = value_param_pattern %V.patt.loc13_14.1, runtime_param [symbolic = %V.patt.loc13_14.2 (constants.%V.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %V.param: %K1.type = value_param runtime_param +// CHECK:STDOUT: %K1.ref.loc13: type = name_ref K1, file.%K1.decl [concrete = constants.%K1.type] +// CHECK:STDOUT: %V.loc13_14.1: %K1.type = bind_symbolic_name V, 0, %V.param [symbolic = %V.loc13_14.2 (constants.%V)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @K1 { +// CHECK:STDOUT: %Self: %K1.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] +// CHECK:STDOUT: %Q1.decl: %Q1.type = fn_decl @Q1 [concrete = constants.%Q1] {} {} +// CHECK:STDOUT: %assoc0: %K1.assoc_type = assoc_entity element0, %Q1.decl [concrete = constants.%assoc0] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: .Q1 = %assoc0 +// CHECK:STDOUT: witness = (%Q1.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Q1(@K1.%Self: %K1.type) { +// CHECK:STDOUT: fn(); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Simple2(%T.loc8_12.1: %K1.type) { +// CHECK:STDOUT: %T.loc8_12.2: %K1.type = bind_symbolic_name T, 0 [symbolic = %T.loc8_12.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc8_12.2: %K1.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_12.2 (constants.%T.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %T.as_type.loc9_4.2: type = facet_access_type %T.loc8_12.2 [symbolic = %T.as_type.loc9_4.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_wit.loc9_4.2: = facet_access_witness %T.loc8_12.2 [symbolic = %T.as_wit.loc9_4.2 (constants.%T.as_wit)] +// CHECK:STDOUT: %K1.facet: %K1.type = facet_value %T.as_type.loc9_4.2, %T.as_wit.loc9_4.2 [symbolic = %K1.facet (constants.%K1.facet.5fb678.1)] +// CHECK:STDOUT: %.loc9_4.2: type = fn_type_with_self_type constants.%Q1.type, %K1.facet [symbolic = %.loc9_4.2 (constants.%.aaf76c.1)] +// CHECK:STDOUT: %impl.elem0.loc9_4.2: @Simple2.%.loc9_4.2 (%.aaf76c.1) = impl_witness_access %T.as_wit.loc9_4.2, element0 [symbolic = %impl.elem0.loc9_4.2 (constants.%impl.elem0.3809cc.1)] +// CHECK:STDOUT: %specific_fn.loc9_4.2: = specific_function %impl.elem0.loc9_4.2, @Q1(%K1.facet) [symbolic = %specific_fn.loc9_4.2 (constants.%specific_fn.bc5944.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%T.param_patt: %K1.type) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %T.ref: %K1.type = name_ref T, %T.loc8_12.1 [symbolic = %T.loc8_12.2 (constants.%T)] +// CHECK:STDOUT: %Q1.ref: %K1.assoc_type = name_ref Q1, @K1.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %T.as_type.loc9_4.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc9_4.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc9_4.1: type = converted %T.ref, %T.as_type.loc9_4.1 [symbolic = %T.as_type.loc9_4.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_wit.loc9_4.1: = facet_access_witness %T.ref [symbolic = %T.as_wit.loc9_4.2 (constants.%T.as_wit)] +// CHECK:STDOUT: %impl.elem0.loc9_4.1: @Simple2.%.loc9_4.2 (%.aaf76c.1) = impl_witness_access %T.as_wit.loc9_4.1, element0 [symbolic = %impl.elem0.loc9_4.2 (constants.%impl.elem0.3809cc.1)] +// CHECK:STDOUT: %specific_fn.loc9_4.1: = specific_function %impl.elem0.loc9_4.1, @Q1(constants.%K1.facet.5fb678.1) [symbolic = %specific_fn.loc9_4.2 (constants.%specific_fn.bc5944.1)] +// CHECK:STDOUT: %Q1.call: init %empty_tuple.type = call %specific_fn.loc9_4.1() +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Compound2(%V.loc13_14.1: %K1.type) { +// CHECK:STDOUT: %V.loc13_14.2: %K1.type = bind_symbolic_name V, 0 [symbolic = %V.loc13_14.2 (constants.%V)] +// CHECK:STDOUT: %V.patt.loc13_14.2: %K1.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc13_14.2 (constants.%V.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %V.as_wit.loc14_4.2: = facet_access_witness %V.loc13_14.2 [symbolic = %V.as_wit.loc14_4.2 (constants.%V.as_wit)] +// CHECK:STDOUT: %V.as_type: type = facet_access_type %V.loc13_14.2 [symbolic = %V.as_type (constants.%V.as_type)] +// CHECK:STDOUT: %K1.facet: %K1.type = facet_value %V.as_type, %V.as_wit.loc14_4.2 [symbolic = %K1.facet (constants.%K1.facet.5fb678.2)] +// CHECK:STDOUT: %.loc14: type = fn_type_with_self_type constants.%Q1.type, %K1.facet [symbolic = %.loc14 (constants.%.aaf76c.2)] +// CHECK:STDOUT: %impl.elem0.loc14_4.2: @Compound2.%.loc14 (%.aaf76c.2) = impl_witness_access %V.as_wit.loc14_4.2, element0 [symbolic = %impl.elem0.loc14_4.2 (constants.%impl.elem0.3809cc.2)] +// CHECK:STDOUT: %specific_fn.loc14_4.2: = specific_function %impl.elem0.loc14_4.2, @Q1(%K1.facet) [symbolic = %specific_fn.loc14_4.2 (constants.%specific_fn.bc5944.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%V.param_patt: %K1.type) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %V.ref: %K1.type = name_ref V, %V.loc13_14.1 [symbolic = %V.loc13_14.2 (constants.%V)] +// CHECK:STDOUT: %K1.ref.loc14: type = name_ref K1, file.%K1.decl [concrete = constants.%K1.type] +// CHECK:STDOUT: %Q1.ref: %K1.assoc_type = name_ref Q1, @K1.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %V.as_wit.loc14_4.1: = facet_access_witness %V.ref [symbolic = %V.as_wit.loc14_4.2 (constants.%V.as_wit)] +// CHECK:STDOUT: %impl.elem0.loc14_4.1: @Compound2.%.loc14 (%.aaf76c.2) = impl_witness_access %V.as_wit.loc14_4.1, element0 [symbolic = %impl.elem0.loc14_4.2 (constants.%impl.elem0.3809cc.2)] +// CHECK:STDOUT: %specific_fn.loc14_4.1: = specific_function %impl.elem0.loc14_4.1, @Q1(constants.%K1.facet.5fb678.2) [symbolic = %specific_fn.loc14_4.2 (constants.%specific_fn.bc5944.2)] +// CHECK:STDOUT: %Q1.call: init %empty_tuple.type = call %specific_fn.loc14_4.1() +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Q1(constants.%Self) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Simple2(constants.%T) { +// CHECK:STDOUT: %T.loc8_12.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc8_12.2 => constants.%T +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Q1(constants.%K1.facet.5fb678.1) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Q1(@Simple2.%K1.facet) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Compound2(constants.%V) { +// CHECK:STDOUT: %V.loc13_14.2 => constants.%V +// CHECK:STDOUT: %V.patt.loc13_14.2 => constants.%V +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Q1(constants.%K1.facet.5fb678.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Q1(@Compound2.%K1.facet) {} +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_caller_instance_interface_not.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %K2.type: type = facet_type <@K2> [concrete] +// CHECK:STDOUT: %Self.0ce: %K2.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Q2.type: type = fn_type @Q2 [concrete] +// CHECK:STDOUT: %Q2: %Q2.type = struct_value () [concrete] +// CHECK:STDOUT: %K2.assoc_type: type = assoc_entity_type %K2.type [concrete] +// CHECK:STDOUT: %assoc0.358: %K2.assoc_type = assoc_entity element0, @K2.%Q2.decl [concrete] +// CHECK:STDOUT: %T.0ce: %K2.type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.patt.6d1: %K2.type = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %T.as_type: type = facet_access_type %T.0ce [symbolic] +// CHECK:STDOUT: %Simple3.type: type = fn_type @Simple3 [concrete] +// CHECK:STDOUT: %Simple3: %Simple3.type = struct_value () [concrete] +// CHECK:STDOUT: %require_complete.022e81.1: = require_complete_type %T.as_type [symbolic] +// CHECK:STDOUT: %V: %K2.type = bind_symbolic_name V, 0 [symbolic] +// CHECK:STDOUT: %V.patt: %K2.type = symbolic_binding_pattern V, 0 [symbolic] +// CHECK:STDOUT: %V.as_type: type = facet_access_type %V [symbolic] +// CHECK:STDOUT: %Compound3.type: type = fn_type @Compound3 [concrete] +// CHECK:STDOUT: %Compound3: %Compound3.type = struct_value () [concrete] +// CHECK:STDOUT: %require_complete.022e81.2: = require_complete_type %V.as_type [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: type = facet_access_type %Self.519 [symbolic] +// CHECK:STDOUT: %ImplicitAs.assoc_type.837: type = assoc_entity_type %ImplicitAs.type.d62 [symbolic] +// CHECK:STDOUT: %assoc0.43db8b.1: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.1 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.014: type = facet_type <@ImplicitAs, @ImplicitAs(%K2.type)> [concrete] +// CHECK:STDOUT: %Convert.type.a72: type = fn_type @Convert, @ImplicitAs(%K2.type) [concrete] +// CHECK:STDOUT: %Convert.2ea: %Convert.type.a72 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.assoc_type.053: type = assoc_entity_type %ImplicitAs.type.014 [concrete] +// CHECK:STDOUT: %assoc0.3e2: %ImplicitAs.assoc_type.053 = assoc_entity element0, imports.%Core.import_ref.207961.1 [concrete] +// CHECK:STDOUT: %assoc0.43db8b.2: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.2 [symbolic] +// CHECK:STDOUT: %BitAnd.type: type = facet_type <@BitAnd> [concrete] +// CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.patt.e01: type = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%Core.import_ref.bd4), @impl(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.type: type = fn_type @Op, @impl(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op: %Op.type = struct_value () [symbolic] +// CHECK:STDOUT: %require_complete.4ae: = require_complete_type %T.8b3 [symbolic] +// CHECK:STDOUT: } +// 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.ffd566.1: type = import_ref Core//default, loc7_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst69 [no loc], unloaded +// CHECK:STDOUT: %Core.import_ref.630: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = import_ref Core//default, loc8_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.43db8b.2)] +// CHECK:STDOUT: %Core.Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, Convert, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] +// CHECK:STDOUT: %Core.import_ref.ffd566.2: type = import_ref Core//default, loc7_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) = import_ref Core//default, inst69 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] +// CHECK:STDOUT: %Core.import_ref.207961.1 = import_ref Core//default, loc8_35, unloaded +// CHECK:STDOUT: %Core.import_ref.ad0 = import_ref Core//default, inst104 [no loc], unloaded +// CHECK:STDOUT: %Core.import_ref.3bf = import_ref Core//default, loc12_41, unloaded +// CHECK:STDOUT: %Core.Op = import_ref Core//default, Op, unloaded +// CHECK:STDOUT: %Core.import_ref.f80 = import_ref Core//default, loc15_36, unloaded +// CHECK:STDOUT: %Core.import_ref.f6b058.1: type = import_ref Core//default, loc15_14, loaded [symbolic = @impl.%T (constants.%T.8b3)] +// CHECK:STDOUT: %Core.import_ref.601: type = import_ref Core//default, loc15_24, loaded [symbolic = @impl.%T (constants.%T.8b3)] +// CHECK:STDOUT: %Core.import_ref.9c1: type = import_ref Core//default, loc15_29, loaded [concrete = constants.%BitAnd.type] +// CHECK:STDOUT: %Core.import_ref.bd4 = import_ref Core//default, loc16_42, unloaded +// CHECK:STDOUT: %Core.import_ref.f6b058.2: type = import_ref Core//default, loc15_14, loaded [symbolic = @impl.%T (constants.%T.8b3)] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .K2 = %K2.decl +// CHECK:STDOUT: .Simple3 = %Simple3.decl +// CHECK:STDOUT: .Compound3 = %Compound3.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %K2.decl: type = interface_decl @K2 [concrete = constants.%K2.type] {} {} +// CHECK:STDOUT: %Simple3.decl: %Simple3.type = fn_decl @Simple3 [concrete = constants.%Simple3] { +// CHECK:STDOUT: %T.patt.loc11_12.1: %K2.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_12.2 (constants.%T.patt.6d1)] +// CHECK:STDOUT: %T.param_patt: %K2.type = value_param_pattern %T.patt.loc11_12.1, runtime_param [symbolic = %T.patt.loc11_12.2 (constants.%T.patt.6d1)] +// CHECK:STDOUT: %x.patt: @Simple3.%T.as_type.loc11_23.2 (%T.as_type) = binding_pattern x +// CHECK:STDOUT: %x.param_patt: @Simple3.%T.as_type.loc11_23.2 (%T.as_type) = value_param_pattern %x.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %T.param: %K2.type = value_param runtime_param +// CHECK:STDOUT: %K2.ref: type = name_ref K2, file.%K2.decl [concrete = constants.%K2.type] +// CHECK:STDOUT: %T.loc11_12.1: %K2.type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc11_12.2 (constants.%T.0ce)] +// CHECK:STDOUT: %x.param: @Simple3.%T.as_type.loc11_23.2 (%T.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc11_23.1: type = splice_block %.loc11_23.2 [symbolic = %T.as_type.loc11_23.2 (constants.%T.as_type)] { +// CHECK:STDOUT: %T.ref: %K2.type = name_ref T, %T.loc11_12.1 [symbolic = %T.loc11_12.2 (constants.%T.0ce)] +// CHECK:STDOUT: %T.as_type.loc11_23.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc11_23.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc11_23.2: type = converted %T.ref, %T.as_type.loc11_23.1 [symbolic = %T.as_type.loc11_23.2 (constants.%T.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %x: @Simple3.%T.as_type.loc11_23.2 (%T.as_type) = bind_name x, %x.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Compound3.decl: %Compound3.type = fn_decl @Compound3 [concrete = constants.%Compound3] { +// CHECK:STDOUT: %V.patt.loc21_14.1: %K2.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc21_14.2 (constants.%V.patt)] +// CHECK:STDOUT: %V.param_patt: %K2.type = value_param_pattern %V.patt.loc21_14.1, runtime_param [symbolic = %V.patt.loc21_14.2 (constants.%V.patt)] +// CHECK:STDOUT: %y.patt: @Compound3.%V.as_type.loc21_25.2 (%V.as_type) = binding_pattern y +// CHECK:STDOUT: %y.param_patt: @Compound3.%V.as_type.loc21_25.2 (%V.as_type) = value_param_pattern %y.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %V.param: %K2.type = value_param runtime_param +// CHECK:STDOUT: %K2.ref.loc21: type = name_ref K2, file.%K2.decl [concrete = constants.%K2.type] +// CHECK:STDOUT: %V.loc21_14.1: %K2.type = bind_symbolic_name V, 0, %V.param [symbolic = %V.loc21_14.2 (constants.%V)] +// CHECK:STDOUT: %y.param: @Compound3.%V.as_type.loc21_25.2 (%V.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc21_25.1: type = splice_block %.loc21_25.2 [symbolic = %V.as_type.loc21_25.2 (constants.%V.as_type)] { +// CHECK:STDOUT: %V.ref: %K2.type = name_ref V, %V.loc21_14.1 [symbolic = %V.loc21_14.2 (constants.%V)] +// CHECK:STDOUT: %V.as_type.loc21_25.1: type = facet_access_type %V.ref [symbolic = %V.as_type.loc21_25.2 (constants.%V.as_type)] +// CHECK:STDOUT: %.loc21_25.2: type = converted %V.ref, %V.as_type.loc21_25.1 [symbolic = %V.as_type.loc21_25.2 (constants.%V.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %y: @Compound3.%V.as_type.loc21_25.2 (%V.as_type) = bind_name y, %y.param +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @K2 { +// CHECK:STDOUT: %Self: %K2.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.0ce] +// CHECK:STDOUT: %Q2.decl: %Q2.type = fn_decl @Q2 [concrete = constants.%Q2] {} {} +// CHECK:STDOUT: %assoc0: %K2.assoc_type = assoc_entity element0, %Q2.decl [concrete = constants.%assoc0.358] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: .Q2 = %assoc0 +// CHECK:STDOUT: witness = (%Q2.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.ffd566.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.207961.1 [symbolic = %assoc0 (constants.%assoc0.43db8b.1)] +// 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: interface @BitAnd [from "core.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%Core.import_ref.ad0 +// CHECK:STDOUT: .Op = imports.%Core.import_ref.3bf +// CHECK:STDOUT: witness = (imports.%Core.Op) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl(imports.%Core.import_ref.f6b058.1: type) [from "core.carbon"] { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T.8b3)] +// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt.e01)] +// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%Core.import_ref.bd4), @impl(%T) [symbolic = %impl_witness (constants.%impl_witness)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Op.type: type = fn_type @Op, @impl(%T) [symbolic = %Op.type (constants.%Op.type)] +// CHECK:STDOUT: %Op: @impl.%Op.type (%Op.type) = struct_value () [symbolic = %Op (constants.%Op)] +// CHECK:STDOUT: %require_complete: = require_complete_type @impl.%T (%T.8b3) [symbolic = %require_complete (constants.%require_complete.4ae)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%Core.import_ref.601 as imports.%Core.import_ref.9c1 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%Core.import_ref.f80 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Q2(@K2.%Self: %K2.type) { +// CHECK:STDOUT: fn(); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Simple3(%T.loc11_12.1: %K2.type) { +// CHECK:STDOUT: %T.loc11_12.2: %K2.type = bind_symbolic_name T, 0 [symbolic = %T.loc11_12.2 (constants.%T.0ce)] +// CHECK:STDOUT: %T.patt.loc11_12.2: %K2.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_12.2 (constants.%T.patt.6d1)] +// CHECK:STDOUT: %T.as_type.loc11_23.2: type = facet_access_type %T.loc11_12.2 [symbolic = %T.as_type.loc11_23.2 (constants.%T.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Simple3.%T.as_type.loc11_23.2 (%T.as_type) [symbolic = %require_complete (constants.%require_complete.022e81.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%T.param_patt: %K2.type, %x.param_patt: @Simple3.%T.as_type.loc11_23.2 (%T.as_type)) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %x.ref: @Simple3.%T.as_type.loc11_23.2 (%T.as_type) = name_ref x, %x +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Compound3(%V.loc21_14.1: %K2.type) { +// CHECK:STDOUT: %V.loc21_14.2: %K2.type = bind_symbolic_name V, 0 [symbolic = %V.loc21_14.2 (constants.%V)] +// CHECK:STDOUT: %V.patt.loc21_14.2: %K2.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc21_14.2 (constants.%V.patt)] +// CHECK:STDOUT: %V.as_type.loc21_25.2: type = facet_access_type %V.loc21_14.2 [symbolic = %V.as_type.loc21_25.2 (constants.%V.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Compound3.%V.as_type.loc21_25.2 (%V.as_type) [symbolic = %require_complete (constants.%require_complete.022e81.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%V.param_patt: %K2.type, %y.param_patt: @Compound3.%V.as_type.loc21_25.2 (%V.as_type)) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %y.ref: @Compound3.%V.as_type.loc21_25.2 (%V.as_type) = name_ref y, %y +// CHECK:STDOUT: %K2.ref.loc29: type = name_ref K2, file.%K2.decl [concrete = constants.%K2.type] +// CHECK:STDOUT: %Q2.ref: %K2.assoc_type = name_ref Q2, @K2.%assoc0 [concrete = constants.%assoc0.358] +// CHECK:STDOUT: %.loc29: %K2.type = converted %y.ref, [concrete = ] +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.ffd566.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 @Op(imports.%Core.import_ref.f6b058.2: type) [from "core.carbon"] { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T.8b3)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Op.%T (%T.8b3)](%other.param_patt: @Op.%T (%T.8b3)) -> @Op.%T (%T.8b3) = "type.and"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Q2(constants.%Self.0ce) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Simple3(constants.%T.0ce) { +// CHECK:STDOUT: %T.loc11_12.2 => constants.%T.0ce +// CHECK:STDOUT: %T.patt.loc11_12.2 => constants.%T.0ce +// CHECK:STDOUT: %T.as_type.loc11_23.2 => constants.%T.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Compound3(constants.%V) { +// CHECK:STDOUT: %V.loc21_14.2 => constants.%V +// CHECK:STDOUT: %V.patt.loc21_14.2 => constants.%V +// CHECK:STDOUT: %V.as_type.loc21_25.2 => constants.%V.as_type +// 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 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%K2.type) { +// CHECK:STDOUT: %Dest => constants.%K2.type +// CHECK:STDOUT: %Dest.patt => constants.%K2.type +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.014 +// CHECK:STDOUT: %Self => constants.%Self.519 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.a72 +// CHECK:STDOUT: %Convert => constants.%Convert.2ea +// CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.053 +// CHECK:STDOUT: %assoc0 => constants.%assoc0.3e2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl(constants.%T.8b3) { +// CHECK:STDOUT: %T => constants.%T.8b3 +// CHECK:STDOUT: %T.patt => constants.%T.8b3 +// CHECK:STDOUT: %impl_witness => constants.%impl_witness +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl(%T) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Op(constants.%T.8b3) { +// CHECK:STDOUT: %T => constants.%T.8b3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_todo_instance.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %L1.type: type = facet_type <@L1> [concrete] +// CHECK:STDOUT: %Self: %L1.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] +// CHECK:STDOUT: %R1.type: type = fn_type @R1 [concrete] +// CHECK:STDOUT: %R1: %R1.type = struct_value () [concrete] +// CHECK:STDOUT: %L1.assoc_type: type = assoc_entity_type %L1.type [concrete] +// CHECK:STDOUT: %assoc0: %L1.assoc_type = assoc_entity element0, @L1.%R1.decl [concrete] +// CHECK:STDOUT: %ptr: type = ptr_type %Self.as_type [symbolic] +// CHECK:STDOUT: %S1.type: type = fn_type @S1 [concrete] +// CHECK:STDOUT: %S1: %S1.type = struct_value () [concrete] +// CHECK:STDOUT: %assoc1: %L1.assoc_type = assoc_entity element1, @L1.%S1.decl [concrete] +// CHECK:STDOUT: %T: %L1.type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.patt: %L1.type = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic] +// CHECK:STDOUT: %Simple4.type: type = fn_type @Simple4 [concrete] +// CHECK:STDOUT: %Simple4: %Simple4.type = struct_value () [concrete] +// CHECK:STDOUT: %require_complete.97cd40.1: = require_complete_type %T.as_type [symbolic] +// CHECK:STDOUT: %V: %L1.type = bind_symbolic_name V, 0 [symbolic] +// CHECK:STDOUT: %V.patt: %L1.type = symbolic_binding_pattern V, 0 [symbolic] +// CHECK:STDOUT: %V.as_type: type = facet_access_type %V [symbolic] +// CHECK:STDOUT: %Compound4.type: type = fn_type @Compound4 [concrete] +// CHECK:STDOUT: %Compound4: %Compound4.type = struct_value () [concrete] +// CHECK:STDOUT: %require_complete.97cd40.2: = require_complete_type %V.as_type [symbolic] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .L1 = %L1.decl +// CHECK:STDOUT: .Simple4 = %Simple4.decl +// CHECK:STDOUT: .Compound4 = %Compound4.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %L1.decl: type = interface_decl @L1 [concrete = constants.%L1.type] {} {} +// CHECK:STDOUT: %Simple4.decl: %Simple4.type = fn_decl @Simple4 [concrete = constants.%Simple4] { +// CHECK:STDOUT: %T.patt.loc10_12.1: %L1.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_12.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.param_patt: %L1.type = value_param_pattern %T.patt.loc10_12.1, runtime_param [symbolic = %T.patt.loc10_12.2 (constants.%T.patt)] +// CHECK:STDOUT: %x.patt: @Simple4.%T.as_type.loc10_23.2 (%T.as_type) = binding_pattern x +// CHECK:STDOUT: %x.param_patt: @Simple4.%T.as_type.loc10_23.2 (%T.as_type) = value_param_pattern %x.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %T.param: %L1.type = value_param runtime_param +// CHECK:STDOUT: %L1.ref: type = name_ref L1, file.%L1.decl [concrete = constants.%L1.type] +// CHECK:STDOUT: %T.loc10_12.1: %L1.type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc10_12.2 (constants.%T)] +// CHECK:STDOUT: %x.param: @Simple4.%T.as_type.loc10_23.2 (%T.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc10_23.1: type = splice_block %.loc10_23.2 [symbolic = %T.as_type.loc10_23.2 (constants.%T.as_type)] { +// CHECK:STDOUT: %T.ref.loc10: %L1.type = name_ref T, %T.loc10_12.1 [symbolic = %T.loc10_12.2 (constants.%T)] +// CHECK:STDOUT: %T.as_type.loc10_23.1: type = facet_access_type %T.ref.loc10 [symbolic = %T.as_type.loc10_23.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc10_23.2: type = converted %T.ref.loc10, %T.as_type.loc10_23.1 [symbolic = %T.as_type.loc10_23.2 (constants.%T.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %x: @Simple4.%T.as_type.loc10_23.2 (%T.as_type) = bind_name x, %x.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Compound4.decl: %Compound4.type = fn_decl @Compound4 [concrete = constants.%Compound4] { +// CHECK:STDOUT: %V.patt.loc25_14.1: %L1.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc25_14.2 (constants.%V.patt)] +// CHECK:STDOUT: %V.param_patt: %L1.type = value_param_pattern %V.patt.loc25_14.1, runtime_param [symbolic = %V.patt.loc25_14.2 (constants.%V.patt)] +// CHECK:STDOUT: %y.patt: @Compound4.%V.as_type.loc25_25.2 (%V.as_type) = binding_pattern y +// CHECK:STDOUT: %y.param_patt: @Compound4.%V.as_type.loc25_25.2 (%V.as_type) = value_param_pattern %y.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %V.param: %L1.type = value_param runtime_param +// CHECK:STDOUT: %L1.ref.loc25: type = name_ref L1, file.%L1.decl [concrete = constants.%L1.type] +// CHECK:STDOUT: %V.loc25_14.1: %L1.type = bind_symbolic_name V, 0, %V.param [symbolic = %V.loc25_14.2 (constants.%V)] +// CHECK:STDOUT: %y.param: @Compound4.%V.as_type.loc25_25.2 (%V.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc25_25.1: type = splice_block %.loc25_25.2 [symbolic = %V.as_type.loc25_25.2 (constants.%V.as_type)] { +// CHECK:STDOUT: %V.ref.loc25: %L1.type = name_ref V, %V.loc25_14.1 [symbolic = %V.loc25_14.2 (constants.%V)] +// CHECK:STDOUT: %V.as_type.loc25_25.1: type = facet_access_type %V.ref.loc25 [symbolic = %V.as_type.loc25_25.2 (constants.%V.as_type)] +// CHECK:STDOUT: %.loc25_25.2: type = converted %V.ref.loc25, %V.as_type.loc25_25.1 [symbolic = %V.as_type.loc25_25.2 (constants.%V.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %y: @Compound4.%V.as_type.loc25_25.2 (%V.as_type) = bind_name y, %y.param +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @L1 { +// CHECK:STDOUT: %Self: %L1.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] +// CHECK:STDOUT: %R1.decl: %R1.type = fn_decl @R1 [concrete = constants.%R1] { +// CHECK:STDOUT: %self.patt: @R1.%Self.as_type.loc4_15.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @R1.%Self.as_type.loc4_15.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @R1.%Self.as_type.loc4_15.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc4_15.1: type = splice_block %.loc4_15.2 [symbolic = %Self.as_type.loc4_15.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %Self.ref: %L1.type = name_ref Self, @L1.%Self [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc4_15.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc4_15.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc4_15.2: type = converted %Self.ref, %Self.as_type.loc4_15.2 [symbolic = %Self.as_type.loc4_15.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @R1.%Self.as_type.loc4_15.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0: %L1.assoc_type = assoc_entity element0, %R1.decl [concrete = constants.%assoc0] +// CHECK:STDOUT: %S1.decl: %S1.type = fn_decl @S1 [concrete = constants.%S1] { +// CHECK:STDOUT: %self.patt: @S1.%ptr.loc5_24.1 (%ptr) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @S1.%ptr.loc5_24.1 (%ptr) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: %.loc5_9: auto = addr_pattern %self.param_patt +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @S1.%ptr.loc5_24.1 (%ptr) = value_param runtime_param0 +// CHECK:STDOUT: %.loc5_24.1: type = splice_block %ptr.loc5_24.2 [symbolic = %ptr.loc5_24.1 (constants.%ptr)] { +// CHECK:STDOUT: %Self.ref: %L1.type = name_ref Self, @L1.%Self [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc5_24.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_24.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc5_24.2: type = converted %Self.ref, %Self.as_type.loc5_24.2 [symbolic = %Self.as_type.loc5_24.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %ptr.loc5_24.2: type = ptr_type %Self.as_type [symbolic = %ptr.loc5_24.1 (constants.%ptr)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @S1.%ptr.loc5_24.1 (%ptr) = bind_name self, %self.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc1: %L1.assoc_type = assoc_entity element1, %S1.decl [concrete = constants.%assoc1] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: .R1 = %assoc0 +// CHECK:STDOUT: .S1 = %assoc1 +// CHECK:STDOUT: witness = (%R1.decl, %S1.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @R1(@L1.%Self: %L1.type) { +// CHECK:STDOUT: %Self: %L1.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc4_15.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc4_15.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @R1.%Self.as_type.loc4_15.1 (%Self.as_type)](); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @S1(@L1.%Self: %L1.type) { +// CHECK:STDOUT: %Self: %L1.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc5_24.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_24.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %ptr.loc5_24.1: type = ptr_type @S1.%Self.as_type.loc5_24.1 (%Self.as_type) [symbolic = %ptr.loc5_24.1 (constants.%ptr)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[addr %self.param_patt: @S1.%ptr.loc5_24.1 (%ptr)](); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Simple4(%T.loc10_12.1: %L1.type) { +// CHECK:STDOUT: %T.loc10_12.2: %L1.type = bind_symbolic_name T, 0 [symbolic = %T.loc10_12.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc10_12.2: %L1.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_12.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.as_type.loc10_23.2: type = facet_access_type %T.loc10_12.2 [symbolic = %T.as_type.loc10_23.2 (constants.%T.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Simple4.%T.as_type.loc10_23.2 (%T.as_type) [symbolic = %require_complete (constants.%require_complete.97cd40.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%T.param_patt: %L1.type, %x.param_patt: @Simple4.%T.as_type.loc10_23.2 (%T.as_type)) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %x.ref.loc15: @Simple4.%T.as_type.loc10_23.2 (%T.as_type) = name_ref x, %x +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %xcopy.patt: @Simple4.%T.as_type.loc10_23.2 (%T.as_type) = binding_pattern xcopy +// CHECK:STDOUT: %.loc16_3: @Simple4.%T.as_type.loc10_23.2 (%T.as_type) = var_pattern %xcopy.patt +// CHECK:STDOUT: } +// CHECK:STDOUT: %xcopy.var: ref @Simple4.%T.as_type.loc10_23.2 (%T.as_type) = var xcopy +// CHECK:STDOUT: %x.ref.loc16: @Simple4.%T.as_type.loc10_23.2 (%T.as_type) = name_ref x, %x +// CHECK:STDOUT: assign %xcopy.var, %x.ref.loc16 +// CHECK:STDOUT: %.loc16_14.1: type = splice_block %.loc16_14.2 [symbolic = %T.as_type.loc10_23.2 (constants.%T.as_type)] { +// CHECK:STDOUT: %T.ref.loc16: %L1.type = name_ref T, %T.loc10_12.1 [symbolic = %T.loc10_12.2 (constants.%T)] +// CHECK:STDOUT: %T.as_type.loc16: type = facet_access_type %T.ref.loc16 [symbolic = %T.as_type.loc10_23.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc16_14.2: type = converted %T.ref.loc16, %T.as_type.loc16 [symbolic = %T.as_type.loc10_23.2 (constants.%T.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %xcopy: ref @Simple4.%T.as_type.loc10_23.2 (%T.as_type) = bind_name xcopy, %xcopy.var +// CHECK:STDOUT: %xcopy.ref: ref @Simple4.%T.as_type.loc10_23.2 (%T.as_type) = name_ref xcopy, %xcopy +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Compound4(%V.loc25_14.1: %L1.type) { +// CHECK:STDOUT: %V.loc25_14.2: %L1.type = bind_symbolic_name V, 0 [symbolic = %V.loc25_14.2 (constants.%V)] +// CHECK:STDOUT: %V.patt.loc25_14.2: %L1.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc25_14.2 (constants.%V.patt)] +// CHECK:STDOUT: %V.as_type.loc25_25.2: type = facet_access_type %V.loc25_14.2 [symbolic = %V.as_type.loc25_25.2 (constants.%V.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Compound4.%V.as_type.loc25_25.2 (%V.as_type) [symbolic = %require_complete (constants.%require_complete.97cd40.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%V.param_patt: %L1.type, %y.param_patt: @Compound4.%V.as_type.loc25_25.2 (%V.as_type)) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %y.ref.loc30: @Compound4.%V.as_type.loc25_25.2 (%V.as_type) = name_ref y, %y +// CHECK:STDOUT: %L1.ref.loc30: type = name_ref L1, file.%L1.decl [concrete = constants.%L1.type] +// CHECK:STDOUT: %R1.ref: %L1.assoc_type = name_ref R1, @L1.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %ycopy.patt: @Compound4.%V.as_type.loc25_25.2 (%V.as_type) = binding_pattern ycopy +// CHECK:STDOUT: %.loc31_3: @Compound4.%V.as_type.loc25_25.2 (%V.as_type) = var_pattern %ycopy.patt +// CHECK:STDOUT: } +// CHECK:STDOUT: %ycopy.var: ref @Compound4.%V.as_type.loc25_25.2 (%V.as_type) = var ycopy +// CHECK:STDOUT: %y.ref.loc31: @Compound4.%V.as_type.loc25_25.2 (%V.as_type) = name_ref y, %y +// CHECK:STDOUT: assign %ycopy.var, %y.ref.loc31 +// CHECK:STDOUT: %.loc31_14.1: type = splice_block %.loc31_14.2 [symbolic = %V.as_type.loc25_25.2 (constants.%V.as_type)] { +// CHECK:STDOUT: %V.ref.loc31: %L1.type = name_ref V, %V.loc25_14.1 [symbolic = %V.loc25_14.2 (constants.%V)] +// CHECK:STDOUT: %V.as_type.loc31: type = facet_access_type %V.ref.loc31 [symbolic = %V.as_type.loc25_25.2 (constants.%V.as_type)] +// CHECK:STDOUT: %.loc31_14.2: type = converted %V.ref.loc31, %V.as_type.loc31 [symbolic = %V.as_type.loc25_25.2 (constants.%V.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %ycopy: ref @Compound4.%V.as_type.loc25_25.2 (%V.as_type) = bind_name ycopy, %ycopy.var +// CHECK:STDOUT: %ycopy.ref: ref @Compound4.%V.as_type.loc25_25.2 (%V.as_type) = name_ref ycopy, %ycopy +// CHECK:STDOUT: %L1.ref.loc36: type = name_ref L1, file.%L1.decl [concrete = constants.%L1.type] +// CHECK:STDOUT: %S1.ref: %L1.assoc_type = name_ref S1, @L1.%assoc1 [concrete = constants.%assoc1] +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @R1(constants.%Self) { +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type.loc4_15.1 => constants.%Self.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @S1(constants.%Self) { +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type.loc5_24.1 => constants.%Self.as_type +// CHECK:STDOUT: %ptr.loc5_24.1 => constants.%ptr +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Simple4(constants.%T) { +// CHECK:STDOUT: %T.loc10_12.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc10_12.2 => constants.%T +// CHECK:STDOUT: %T.as_type.loc10_23.2 => constants.%T.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Compound4(constants.%V) { +// CHECK:STDOUT: %V.loc25_14.2 => constants.%V +// CHECK:STDOUT: %V.patt.loc25_14.2 => constants.%V +// CHECK:STDOUT: %V.as_type.loc25_25.2 => constants.%V.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_interface_instance_caller_not.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %L2.type: type = facet_type <@L2> [concrete] +// CHECK:STDOUT: %Self: %L2.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] +// CHECK:STDOUT: %R2.type: type = fn_type @R2 [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %R2: %R2.type = struct_value () [concrete] +// CHECK:STDOUT: %L2.assoc_type: type = assoc_entity_type %L2.type [concrete] +// CHECK:STDOUT: %assoc0: %L2.assoc_type = assoc_entity element0, @L2.%R2.decl [concrete] +// CHECK:STDOUT: %ptr.f3e54b.1: type = ptr_type %Self.as_type [symbolic] +// CHECK:STDOUT: %S2.type: type = fn_type @S2 [concrete] +// CHECK:STDOUT: %S2: %S2.type = struct_value () [concrete] +// CHECK:STDOUT: %assoc1: %L2.assoc_type = assoc_entity element1, @L2.%S2.decl [concrete] +// CHECK:STDOUT: %T: %L2.type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.patt: %L2.type = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %Simple5.type: type = fn_type @Simple5 [concrete] +// CHECK:STDOUT: %Simple5: %Simple5.type = struct_value () [concrete] +// CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic] +// CHECK:STDOUT: %T.as_wit: = facet_access_witness %T [symbolic] +// CHECK:STDOUT: %L2.facet: %L2.type = facet_value %T.as_type, %T.as_wit [symbolic] +// CHECK:STDOUT: %.973: type = fn_type_with_self_type %R2.type, %L2.facet [symbolic] +// CHECK:STDOUT: %impl.elem0: %.973 = impl_witness_access %T.as_wit, element0 [symbolic] +// CHECK:STDOUT: %specific_fn.e11: = specific_function %impl.elem0, @R2(%L2.facet) [symbolic] +// CHECK:STDOUT: %.3ca: type = fn_type_with_self_type %S2.type, %L2.facet [symbolic] +// CHECK:STDOUT: %impl.elem1: %.3ca = impl_witness_access %T.as_wit, element1 [symbolic] +// CHECK:STDOUT: %ptr.f3e54b.2: type = ptr_type %T.as_type [symbolic] +// CHECK:STDOUT: %specific_fn.cf2: = specific_function %impl.elem1, @S2(%L2.facet) [symbolic] +// CHECK:STDOUT: %V: %L2.type = bind_symbolic_name V, 0 [symbolic] +// CHECK:STDOUT: %V.patt: %L2.type = symbolic_binding_pattern V, 0 [symbolic] +// CHECK:STDOUT: %Compound5.type: type = fn_type @Compound5 [concrete] +// CHECK:STDOUT: %Compound5: %Compound5.type = struct_value () [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .L2 = %L2.decl +// CHECK:STDOUT: .Simple5 = %Simple5.decl +// CHECK:STDOUT: .Compound5 = %Compound5.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %L2.decl: type = interface_decl @L2 [concrete = constants.%L2.type] {} {} +// CHECK:STDOUT: %Simple5.decl: %Simple5.type = fn_decl @Simple5 [concrete = constants.%Simple5] { +// CHECK:STDOUT: %T.patt.loc10_12.1: %L2.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_12.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.param_patt: %L2.type = value_param_pattern %T.patt.loc10_12.1, runtime_param [symbolic = %T.patt.loc10_12.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %T.param: %L2.type = value_param runtime_param +// CHECK:STDOUT: %L2.ref: type = name_ref L2, file.%L2.decl [concrete = constants.%L2.type] +// CHECK:STDOUT: %T.loc10_12.1: %L2.type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc10_12.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Compound5.decl: %Compound5.type = fn_decl @Compound5 [concrete = constants.%Compound5] { +// CHECK:STDOUT: %V.patt.loc30_14.1: %L2.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc30_14.2 (constants.%V.patt)] +// CHECK:STDOUT: %V.param_patt: %L2.type = value_param_pattern %V.patt.loc30_14.1, runtime_param [symbolic = %V.patt.loc30_14.2 (constants.%V.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %V.param: %L2.type = value_param runtime_param +// CHECK:STDOUT: %L2.ref.loc30: type = name_ref L2, file.%L2.decl [concrete = constants.%L2.type] +// CHECK:STDOUT: %V.loc30_14.1: %L2.type = bind_symbolic_name V, 0, %V.param [symbolic = %V.loc30_14.2 (constants.%V)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @L2 { +// CHECK:STDOUT: %Self: %L2.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] +// CHECK:STDOUT: %R2.decl: %R2.type = fn_decl @R2 [concrete = constants.%R2] { +// CHECK:STDOUT: %self.patt: @R2.%Self.as_type.loc5_15.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @R2.%Self.as_type.loc5_15.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @R2.%Self.as_type.loc5_15.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc5_15.1: type = splice_block %.loc5_15.2 [symbolic = %Self.as_type.loc5_15.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %Self.ref: %L2.type = name_ref Self, @L2.%Self [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc5_15.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_15.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc5_15.2: type = converted %Self.ref, %Self.as_type.loc5_15.2 [symbolic = %Self.as_type.loc5_15.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @R2.%Self.as_type.loc5_15.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0: %L2.assoc_type = assoc_entity element0, %R2.decl [concrete = constants.%assoc0] +// CHECK:STDOUT: %S2.decl: %S2.type = fn_decl @S2 [concrete = constants.%S2] { +// CHECK:STDOUT: %self.patt: @S2.%ptr.loc6_24.1 (%ptr.f3e54b.1) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @S2.%ptr.loc6_24.1 (%ptr.f3e54b.1) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: %.loc6_9: auto = addr_pattern %self.param_patt +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @S2.%ptr.loc6_24.1 (%ptr.f3e54b.1) = value_param runtime_param0 +// CHECK:STDOUT: %.loc6_24.1: type = splice_block %ptr.loc6_24.2 [symbolic = %ptr.loc6_24.1 (constants.%ptr.f3e54b.1)] { +// CHECK:STDOUT: %Self.ref: %L2.type = name_ref Self, @L2.%Self [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc6_24.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc6_24.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc6_24.2: type = converted %Self.ref, %Self.as_type.loc6_24.2 [symbolic = %Self.as_type.loc6_24.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %ptr.loc6_24.2: type = ptr_type %Self.as_type [symbolic = %ptr.loc6_24.1 (constants.%ptr.f3e54b.1)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @S2.%ptr.loc6_24.1 (%ptr.f3e54b.1) = bind_name self, %self.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc1: %L2.assoc_type = assoc_entity element1, %S2.decl [concrete = constants.%assoc1] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: .R2 = %assoc0 +// CHECK:STDOUT: .S2 = %assoc1 +// CHECK:STDOUT: witness = (%R2.decl, %S2.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @R2(@L2.%Self: %L2.type) { +// CHECK:STDOUT: %Self: %L2.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc5_15.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_15.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @R2.%Self.as_type.loc5_15.1 (%Self.as_type)](); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @S2(@L2.%Self: %L2.type) { +// CHECK:STDOUT: %Self: %L2.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc6_24.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc6_24.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %ptr.loc6_24.1: type = ptr_type @S2.%Self.as_type.loc6_24.1 (%Self.as_type) [symbolic = %ptr.loc6_24.1 (constants.%ptr.f3e54b.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[addr %self.param_patt: @S2.%ptr.loc6_24.1 (%ptr.f3e54b.1)](); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Simple5(%T.loc10_12.1: %L2.type) { +// CHECK:STDOUT: %T.loc10_12.2: %L2.type = bind_symbolic_name T, 0 [symbolic = %T.loc10_12.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc10_12.2: %L2.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_12.2 (constants.%T.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %T.as_type.loc18_4.2: type = facet_access_type %T.loc10_12.2 [symbolic = %T.as_type.loc18_4.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_wit.loc18_4.2: = facet_access_witness %T.loc10_12.2 [symbolic = %T.as_wit.loc18_4.2 (constants.%T.as_wit)] +// CHECK:STDOUT: %L2.facet: %L2.type = facet_value %T.as_type.loc18_4.2, %T.as_wit.loc18_4.2 [symbolic = %L2.facet (constants.%L2.facet)] +// CHECK:STDOUT: %.loc18_4.2: type = fn_type_with_self_type constants.%R2.type, %L2.facet [symbolic = %.loc18_4.2 (constants.%.973)] +// CHECK:STDOUT: %impl.elem0.loc18_4.2: @Simple5.%.loc18_4.2 (%.973) = impl_witness_access %T.as_wit.loc18_4.2, element0 [symbolic = %impl.elem0.loc18_4.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %specific_fn.loc18_4.2: = specific_function %impl.elem0.loc18_4.2, @R2(%L2.facet) [symbolic = %specific_fn.loc18_4.2 (constants.%specific_fn.e11)] +// CHECK:STDOUT: %.loc26_4.2: type = fn_type_with_self_type constants.%S2.type, %L2.facet [symbolic = %.loc26_4.2 (constants.%.3ca)] +// CHECK:STDOUT: %impl.elem1.loc26_4.2: @Simple5.%.loc26_4.2 (%.3ca) = impl_witness_access %T.as_wit.loc18_4.2, element1 [symbolic = %impl.elem1.loc26_4.2 (constants.%impl.elem1)] +// CHECK:STDOUT: %specific_fn.loc26_4.2: = specific_function %impl.elem1.loc26_4.2, @S2(%L2.facet) [symbolic = %specific_fn.loc26_4.2 (constants.%specific_fn.cf2)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%T.param_patt: %L2.type) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %T.ref.loc18: %L2.type = name_ref T, %T.loc10_12.1 [symbolic = %T.loc10_12.2 (constants.%T)] +// CHECK:STDOUT: %R2.ref: %L2.assoc_type = name_ref R2, @L2.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %T.as_type.loc18_4.1: type = facet_access_type %T.ref.loc18 [symbolic = %T.as_type.loc18_4.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc18_4.1: type = converted %T.ref.loc18, %T.as_type.loc18_4.1 [symbolic = %T.as_type.loc18_4.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_wit.loc18_4.1: = facet_access_witness %T.ref.loc18 [symbolic = %T.as_wit.loc18_4.2 (constants.%T.as_wit)] +// CHECK:STDOUT: %impl.elem0.loc18_4.1: @Simple5.%.loc18_4.2 (%.973) = impl_witness_access %T.as_wit.loc18_4.1, element0 [symbolic = %impl.elem0.loc18_4.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %specific_fn.loc18_4.1: = specific_function %impl.elem0.loc18_4.1, @R2(constants.%L2.facet) [symbolic = %specific_fn.loc18_4.2 (constants.%specific_fn.e11)] +// CHECK:STDOUT: %R2.call: init %empty_tuple.type = call %specific_fn.loc18_4.1() +// CHECK:STDOUT: %T.ref.loc26: %L2.type = name_ref T, %T.loc10_12.1 [symbolic = %T.loc10_12.2 (constants.%T)] +// CHECK:STDOUT: %S2.ref: %L2.assoc_type = name_ref S2, @L2.%assoc1 [concrete = constants.%assoc1] +// CHECK:STDOUT: %T.as_type.loc26: type = facet_access_type %T.ref.loc26 [symbolic = %T.as_type.loc18_4.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc26_4.1: type = converted %T.ref.loc26, %T.as_type.loc26 [symbolic = %T.as_type.loc18_4.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_wit.loc26: = facet_access_witness %T.ref.loc26 [symbolic = %T.as_wit.loc18_4.2 (constants.%T.as_wit)] +// CHECK:STDOUT: %impl.elem1.loc26_4.1: @Simple5.%.loc26_4.2 (%.3ca) = impl_witness_access %T.as_wit.loc26, element1 [symbolic = %impl.elem1.loc26_4.2 (constants.%impl.elem1)] +// CHECK:STDOUT: %specific_fn.loc26_4.1: = specific_function %impl.elem1.loc26_4.1, @S2(constants.%L2.facet) [symbolic = %specific_fn.loc26_4.2 (constants.%specific_fn.cf2)] +// CHECK:STDOUT: %addr: = addr_of [concrete = ] +// CHECK:STDOUT: %S2.call: init %empty_tuple.type = call %specific_fn.loc26_4.1() +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Compound5(%V.loc30_14.1: %L2.type) { +// CHECK:STDOUT: %V.loc30_14.2: %L2.type = bind_symbolic_name V, 0 [symbolic = %V.loc30_14.2 (constants.%V)] +// CHECK:STDOUT: %V.patt.loc30_14.2: %L2.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc30_14.2 (constants.%V.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%V.param_patt: %L2.type) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %V.ref.loc35: %L2.type = name_ref V, %V.loc30_14.1 [symbolic = %V.loc30_14.2 (constants.%V)] +// CHECK:STDOUT: %L2.ref.loc35: type = name_ref L2, file.%L2.decl [concrete = constants.%L2.type] +// CHECK:STDOUT: %R2.ref: %L2.assoc_type = name_ref R2, @L2.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %V.ref.loc40: %L2.type = name_ref V, %V.loc30_14.1 [symbolic = %V.loc30_14.2 (constants.%V)] +// CHECK:STDOUT: %L2.ref.loc40: type = name_ref L2, file.%L2.decl [concrete = constants.%L2.type] +// CHECK:STDOUT: %S2.ref: %L2.assoc_type = name_ref S2, @L2.%assoc1 [concrete = constants.%assoc1] +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @R2(constants.%Self) { +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type.loc5_15.1 => constants.%Self.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @S2(constants.%Self) { +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type.loc6_24.1 => constants.%Self.as_type +// CHECK:STDOUT: %ptr.loc6_24.1 => constants.%ptr.f3e54b.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Simple5(constants.%T) { +// CHECK:STDOUT: %T.loc10_12.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc10_12.2 => constants.%T +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @R2(constants.%L2.facet) { +// CHECK:STDOUT: %Self => constants.%L2.facet +// CHECK:STDOUT: %Self.as_type.loc5_15.1 => constants.%T.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @S2(constants.%L2.facet) { +// CHECK:STDOUT: %Self => constants.%L2.facet +// CHECK:STDOUT: %Self.as_type.loc6_24.1 => constants.%T.as_type +// CHECK:STDOUT: %ptr.loc6_24.1 => constants.%ptr.f3e54b.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @R2(@Simple5.%L2.facet) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @S2(@Simple5.%L2.facet) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Compound5(constants.%V) { +// CHECK:STDOUT: %V.loc30_14.2 => constants.%V +// CHECK:STDOUT: %V.patt.loc30_14.2 => constants.%V +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_combine_non_instance.carbon +// CHECK:STDOUT: +// 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: %G.type.c3a: type = fn_type @G.1 [concrete] +// CHECK:STDOUT: %G.11a: %G.type.c3a = struct_value () [concrete] +// CHECK:STDOUT: %A.assoc_type: type = assoc_entity_type %A.type [concrete] +// CHECK:STDOUT: %assoc0.773: %A.assoc_type = assoc_entity element0, @A.%G.decl [concrete] +// CHECK:STDOUT: %C: type = class_type @C [concrete] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] +// CHECK:STDOUT: %complete_type.357: = complete_type_witness %empty_struct_type [concrete] +// CHECK:STDOUT: %impl_witness.a7a: = impl_witness (@impl.77d.%G.decl) [concrete] +// CHECK:STDOUT: %G.type.486: type = fn_type @G.2 [concrete] +// CHECK:STDOUT: %G.001: %G.type.486 = struct_value () [concrete] +// CHECK:STDOUT: %A.facet: %A.type = facet_value %C, %impl_witness.a7a [concrete] +// CHECK:STDOUT: %Fails.type: type = fn_type @Fails [concrete] +// CHECK:STDOUT: %Fails: %Fails.type = struct_value () [concrete] +// CHECK:STDOUT: %C.val: %C = struct_value () [concrete] +// CHECK:STDOUT: %BitAnd.type: type = facet_type <@BitAnd> [concrete] +// CHECK:STDOUT: %Self.25f: %BitAnd.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %BitAnd.assoc_type: type = assoc_entity_type %BitAnd.type [concrete] +// CHECK:STDOUT: %assoc0.a63: %BitAnd.assoc_type = assoc_entity element0, imports.%Core.import_ref.a93 [concrete] +// CHECK:STDOUT: %Op.type.27a: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.ab9: %Op.type.27a = struct_value () [concrete] +// CHECK:STDOUT: %Self.as_type.19f: type = facet_access_type %Self.25f [symbolic] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %impl_witness.db8: = impl_witness (imports.%Core.import_ref.1e6), @impl.f92(%T) [symbolic] +// CHECK:STDOUT: %Op.type.f99: type = fn_type @Op.2, @impl.f92(%T) [symbolic] +// CHECK:STDOUT: %Op.05a: %Op.type.f99 = struct_value () [symbolic] +// CHECK:STDOUT: %require_complete: = require_complete_type %T [symbolic] +// CHECK:STDOUT: %impl_witness.3ea: = impl_witness (imports.%Core.import_ref.1e6), @impl.f92(type) [concrete] +// CHECK:STDOUT: %impl_witness.b81: = impl_witness (imports.%Core.import_ref.bd4), @impl.f92(%T) [symbolic] +// CHECK:STDOUT: %Op.type.eb8: type = fn_type @Op.2, @impl.f92(type) [concrete] +// CHECK:STDOUT: %Op.444: %Op.type.eb8 = struct_value () [concrete] +// CHECK:STDOUT: %complete_type.473: = complete_type_witness type [concrete] +// CHECK:STDOUT: %BitAnd.facet: %BitAnd.type = facet_value type, %impl_witness.3ea [concrete] +// CHECK:STDOUT: %.d4d: type = fn_type_with_self_type %Op.type.27a, %BitAnd.facet [concrete] +// CHECK:STDOUT: %Op.bound: = bound_method %A.type, %Op.444 [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.bound, @Op.2(type) [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.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.43db8b.1: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.1 [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.6fc: %ImplicitAs.assoc_type.568 = assoc_entity element0, imports.%Core.import_ref.207961.1 [concrete] +// CHECK:STDOUT: %assoc0.43db8b.2: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.2 [symbolic] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .BitAnd = %Core.BitAnd +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: import Core//default +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import_ref.ad0 = import_ref Core//default, inst104 [no loc], unloaded +// CHECK:STDOUT: %Core.import_ref.08d: %BitAnd.assoc_type = import_ref Core//default, loc12_41, loaded [concrete = constants.%assoc0.a63] +// CHECK:STDOUT: %Core.Op: %Op.type.27a = import_ref Core//default, Op, loaded [concrete = constants.%Op.ab9] +// CHECK:STDOUT: %Core.import_ref.040: %BitAnd.type = import_ref Core//default, inst104 [no loc], loaded [symbolic = constants.%Self.25f] +// CHECK:STDOUT: %Core.import_ref.51c: = import_ref Core//default, loc15_36, loaded [symbolic = @impl.f92.%impl_witness (constants.%impl_witness.b81)] +// CHECK:STDOUT: %Core.import_ref.f6b058.1: type = import_ref Core//default, loc15_14, loaded [symbolic = @impl.f92.%T (constants.%T)] +// CHECK:STDOUT: %Core.import_ref.601: type = import_ref Core//default, loc15_24, loaded [symbolic = @impl.f92.%T (constants.%T)] +// CHECK:STDOUT: %Core.import_ref.9c1: type = import_ref Core//default, loc15_29, loaded [concrete = constants.%BitAnd.type] +// CHECK:STDOUT: %Core.import_ref.1e6: @impl.f92.%Op.type (%Op.type.f99) = import_ref Core//default, loc16_42, loaded [symbolic = @impl.f92.%Op (constants.%Op.05a)] +// CHECK:STDOUT: %Core.import_ref.f6b058.2: type = import_ref Core//default, loc15_14, loaded [symbolic = @impl.f92.%T (constants.%T)] +// CHECK:STDOUT: %Core.import_ref.ffd566.1: type = import_ref Core//default, loc7_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst69 [no loc], unloaded +// CHECK:STDOUT: %Core.import_ref.630: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = import_ref Core//default, loc8_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.43db8b.2)] +// CHECK:STDOUT: %Core.Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, Convert, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] +// CHECK:STDOUT: %Core.import_ref.ffd566.2: type = import_ref Core//default, loc7_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) = import_ref Core//default, inst69 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] +// CHECK:STDOUT: %Core.import_ref.207961.1 = import_ref Core//default, loc8_35, unloaded +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .A = %A.decl +// CHECK:STDOUT: .C = %C.decl +// CHECK:STDOUT: .Fails = %Fails.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %A.decl: type = interface_decl @A [concrete = constants.%A.type] {} {} +// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {} +// CHECK:STDOUT: impl_decl @impl.77d [concrete] {} { +// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.77d.%G.decl) [concrete = constants.%impl_witness.a7a] +// CHECK:STDOUT: %Fails.decl: %Fails.type = fn_decl @Fails [concrete = constants.%Fails] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @A { +// CHECK:STDOUT: %Self: %A.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.31d] +// CHECK:STDOUT: %G.decl: %G.type.c3a = fn_decl @G.1 [concrete = constants.%G.11a] {} {} +// CHECK:STDOUT: %assoc0: %A.assoc_type = assoc_entity element0, %G.decl [concrete = constants.%assoc0.773] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: .G = %assoc0 +// CHECK:STDOUT: witness = (%G.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @BitAnd [from "core.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%Core.import_ref.ad0 +// CHECK:STDOUT: .Op = imports.%Core.import_ref.08d +// CHECK:STDOUT: witness = (imports.%Core.Op) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.ffd566.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.207961.1 [symbolic = %assoc0 (constants.%assoc0.43db8b.1)] +// 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: impl @impl.77d: %C.ref as %A.ref { +// CHECK:STDOUT: %G.decl: %G.type.486 = fn_decl @G.2 [concrete = constants.%G.001] {} {} +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: witness = file.%impl_witness +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.f92(imports.%Core.import_ref.f6b058.1: type) [from "core.carbon"] { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)] +// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%Core.import_ref.1e6), @impl.f92(%T) [symbolic = %impl_witness (constants.%impl_witness.db8)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Op.type: type = fn_type @Op.2, @impl.f92(%T) [symbolic = %Op.type (constants.%Op.type.f99)] +// CHECK:STDOUT: %Op: @impl.f92.%Op.type (%Op.type.f99) = struct_value () [symbolic = %Op (constants.%Op.05a)] +// CHECK:STDOUT: %require_complete: = require_complete_type @impl.f92.%T (%T) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%Core.import_ref.601 as imports.%Core.import_ref.9c1 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%Core.import_ref.51c +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: class @C { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357] +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%C +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @G.1(@A.%Self: %A.type) { +// CHECK:STDOUT: fn(); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @G.2() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Fails() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc24_5.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %C.ref.loc24: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc24_5.2: ref %C = temporary_storage +// CHECK:STDOUT: %.loc24_5.3: init %C = class_init (), %.loc24_5.2 [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc24_5.4: ref %C = temporary %.loc24_5.2, %.loc24_5.3 +// CHECK:STDOUT: %.loc24_7: ref %C = converted %.loc24_5.1, %.loc24_5.4 +// CHECK:STDOUT: %A.ref.loc24_15: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %A.ref.loc24_19: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc24: %.d4d = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] +// CHECK:STDOUT: %bound_method.loc24: = bound_method %A.ref.loc24_15, %impl.elem0.loc24 [concrete = constants.%Op.bound] +// CHECK:STDOUT: %specific_fn.loc24: = specific_function %bound_method.loc24, @Op.2(type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %type.and.loc24: init type = call %specific_fn.loc24(%A.ref.loc24_15, %A.ref.loc24_19) [concrete = constants.%A.type] +// CHECK:STDOUT: %G.ref.loc24: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.773] +// CHECK:STDOUT: %.loc24_12: %A.type = converted %.loc24_7, [concrete = ] +// CHECK:STDOUT: %.loc32_6.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %C.ref.loc32_11: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc32_6.2: ref %C = temporary_storage +// CHECK:STDOUT: %.loc32_6.3: init %C = class_init (), %.loc32_6.2 [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc32_6.4: ref %C = temporary %.loc32_6.2, %.loc32_6.3 +// CHECK:STDOUT: %.loc32_8: ref %C = converted %.loc32_6.1, %.loc32_6.4 +// CHECK:STDOUT: %C.ref.loc32_18: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %A.ref.loc32_24: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %A.ref.loc32_28: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc32_26: %.d4d = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] +// CHECK:STDOUT: %bound_method.loc32_26: = bound_method %A.ref.loc32_24, %impl.elem0.loc32_26 [concrete = constants.%Op.bound] +// CHECK:STDOUT: %specific_fn.loc32_26: = specific_function %bound_method.loc32_26, @Op.2(type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %type.and.loc32_26: init type = call %specific_fn.loc32_26(%A.ref.loc32_24, %A.ref.loc32_28) [concrete = constants.%A.type] +// CHECK:STDOUT: %.loc32_29.1: type = value_of_initializer %type.and.loc32_26 [concrete = constants.%A.type] +// CHECK:STDOUT: %.loc32_29.2: type = converted %type.and.loc32_26, %.loc32_29.1 [concrete = constants.%A.type] +// CHECK:STDOUT: %A.facet.loc32: %A.type = facet_value constants.%C, constants.%impl_witness.a7a [concrete = constants.%A.facet] +// CHECK:STDOUT: %.loc32_20: %A.type = converted %C.ref.loc32_18, %A.facet.loc32 [concrete = constants.%A.facet] +// CHECK:STDOUT: %as_type.loc32: type = facet_access_type %.loc32_20 [concrete = constants.%C] +// CHECK:STDOUT: %.loc32_30: type = converted %.loc32_20, %as_type.loc32 [concrete = constants.%C] +// CHECK:STDOUT: %A.ref.loc32_35: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %A.ref.loc32_39: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc32_37: %.d4d = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] +// CHECK:STDOUT: %bound_method.loc32_37: = bound_method %A.ref.loc32_35, %impl.elem0.loc32_37 [concrete = constants.%Op.bound] +// CHECK:STDOUT: %specific_fn.loc32_37: = specific_function %bound_method.loc32_37, @Op.2(type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %type.and.loc32_37: init type = call %specific_fn.loc32_37(%A.ref.loc32_35, %A.ref.loc32_39) [concrete = constants.%A.type] +// CHECK:STDOUT: %G.ref.loc32: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.773] +// CHECK:STDOUT: %.loc32_32: %A.type = converted %.loc32_8, [concrete = ] +// CHECK:STDOUT: %.loc40_6.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %C.ref.loc40_11: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc40_6.2: ref %C = temporary_storage +// CHECK:STDOUT: %.loc40_6.3: init %C = class_init (), %.loc40_6.2 [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc40_6.4: ref %C = temporary %.loc40_6.2, %.loc40_6.3 +// CHECK:STDOUT: %.loc40_8: ref %C = converted %.loc40_6.1, %.loc40_6.4 +// CHECK:STDOUT: %C.ref.loc40_18: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %A.ref.loc40_24: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %A.ref.loc40_28: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc40: %.d4d = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] +// CHECK:STDOUT: %bound_method.loc40: = bound_method %A.ref.loc40_24, %impl.elem0.loc40 [concrete = constants.%Op.bound] +// CHECK:STDOUT: %specific_fn.loc40: = specific_function %bound_method.loc40, @Op.2(type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %type.and.loc40: init type = call %specific_fn.loc40(%A.ref.loc40_24, %A.ref.loc40_28) [concrete = constants.%A.type] +// CHECK:STDOUT: %.loc40_29.1: type = value_of_initializer %type.and.loc40 [concrete = constants.%A.type] +// CHECK:STDOUT: %.loc40_29.2: type = converted %type.and.loc40, %.loc40_29.1 [concrete = constants.%A.type] +// CHECK:STDOUT: %A.facet.loc40: %A.type = facet_value constants.%C, constants.%impl_witness.a7a [concrete = constants.%A.facet] +// CHECK:STDOUT: %.loc40_20: %A.type = converted %C.ref.loc40_18, %A.facet.loc40 [concrete = constants.%A.facet] +// CHECK:STDOUT: %as_type.loc40: type = facet_access_type %.loc40_20 [concrete = constants.%C] +// CHECK:STDOUT: %.loc40_30: type = converted %.loc40_20, %as_type.loc40 [concrete = constants.%C] +// CHECK:STDOUT: %A.ref.loc40_34: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %G.ref.loc40: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.773] +// CHECK:STDOUT: %.loc40_32: %A.type = converted %.loc40_8, [concrete = ] +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Op.1(imports.%Core.import_ref.040: %BitAnd.type) [from "core.carbon"] { +// CHECK:STDOUT: %Self: %BitAnd.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.25f)] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type.19f)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Op.1.%Self.as_type (%Self.as_type.19f)](%other.param_patt: @Op.1.%Self.as_type (%Self.as_type.19f)) -> @Op.1.%Self.as_type (%Self.as_type.19f); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Op.2(imports.%Core.import_ref.f6b058.2: type) [from "core.carbon"] { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Op.2.%T (%T)](%other.param_patt: @Op.2.%T (%T)) -> @Op.2.%T (%T) = "type.and"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.ffd566.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: specific @G.1(constants.%Self.31d) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @G.1(constants.%A.facet) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Op.1(constants.%Self.25f) { +// CHECK:STDOUT: %Self => constants.%Self.25f +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type.19f +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.f92(constants.%T) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %T.patt => constants.%T +// CHECK:STDOUT: %impl_witness => constants.%impl_witness.db8 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.f92(%T) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Op.2(constants.%T) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.f92(type) { +// CHECK:STDOUT: %T => type +// CHECK:STDOUT: %T.patt => type +// CHECK:STDOUT: %impl_witness => constants.%impl_witness.3ea +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Op.type => constants.%Op.type.eb8 +// CHECK:STDOUT: %Op => constants.%Op.444 +// CHECK:STDOUT: %require_complete => constants.%complete_type.473 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Op.2(type) { +// CHECK:STDOUT: %T => type +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// 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.6fc +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- allowed_combine_non_instance.carbon +// CHECK:STDOUT: +// 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: %G.type.c3a: type = fn_type @G.1 [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %G.11a: %G.type.c3a = struct_value () [concrete] +// CHECK:STDOUT: %A.assoc_type: type = assoc_entity_type %A.type [concrete] +// CHECK:STDOUT: %assoc0.773: %A.assoc_type = assoc_entity element0, @A.%G.decl [concrete] +// CHECK:STDOUT: %C: type = class_type @C [concrete] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] +// CHECK:STDOUT: %complete_type.357: = complete_type_witness %empty_struct_type [concrete] +// CHECK:STDOUT: %impl_witness.a7a: = impl_witness (@impl.77d.%G.decl) [concrete] +// CHECK:STDOUT: %G.type.486: type = fn_type @G.2 [concrete] +// CHECK:STDOUT: %G.001: %G.type.486 = struct_value () [concrete] +// CHECK:STDOUT: %A.facet: %A.type = facet_value %C, %impl_witness.a7a [concrete] +// CHECK:STDOUT: %Works.type: type = fn_type @Works [concrete] +// CHECK:STDOUT: %Works: %Works.type = struct_value () [concrete] +// CHECK:STDOUT: %BitAnd.type: type = facet_type <@BitAnd> [concrete] +// CHECK:STDOUT: %Self.25f: %BitAnd.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %BitAnd.assoc_type: type = assoc_entity_type %BitAnd.type [concrete] +// CHECK:STDOUT: %assoc0.a63: %BitAnd.assoc_type = assoc_entity element0, imports.%Core.import_ref.a93 [concrete] +// CHECK:STDOUT: %Op.type.27a: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.ab9: %Op.type.27a = struct_value () [concrete] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.25f [symbolic] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %impl_witness.db8: = impl_witness (imports.%Core.import_ref.1e6), @impl.f92(%T) [symbolic] +// CHECK:STDOUT: %Op.type.f99: type = fn_type @Op.2, @impl.f92(%T) [symbolic] +// CHECK:STDOUT: %Op.05a: %Op.type.f99 = struct_value () [symbolic] +// CHECK:STDOUT: %require_complete: = require_complete_type %T [symbolic] +// CHECK:STDOUT: %impl_witness.3ea: = impl_witness (imports.%Core.import_ref.1e6), @impl.f92(type) [concrete] +// CHECK:STDOUT: %impl_witness.b81: = impl_witness (imports.%Core.import_ref.bd4), @impl.f92(%T) [symbolic] +// CHECK:STDOUT: %Op.type.eb8: type = fn_type @Op.2, @impl.f92(type) [concrete] +// CHECK:STDOUT: %Op.444: %Op.type.eb8 = struct_value () [concrete] +// CHECK:STDOUT: %complete_type.473: = complete_type_witness type [concrete] +// CHECK:STDOUT: %BitAnd.facet: %BitAnd.type = facet_value type, %impl_witness.3ea [concrete] +// CHECK:STDOUT: %.d4d: type = fn_type_with_self_type %Op.type.27a, %BitAnd.facet [concrete] +// CHECK:STDOUT: %Op.bound: = bound_method %A.type, %Op.444 [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.bound, @Op.2(type) [concrete] +// CHECK:STDOUT: %.faa: type = fn_type_with_self_type %G.type.c3a, %A.facet [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .BitAnd = %Core.BitAnd +// CHECK:STDOUT: import Core//default +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import_ref.ad0 = import_ref Core//default, inst104 [no loc], unloaded +// CHECK:STDOUT: %Core.import_ref.08d: %BitAnd.assoc_type = import_ref Core//default, loc12_41, loaded [concrete = constants.%assoc0.a63] +// CHECK:STDOUT: %Core.Op: %Op.type.27a = import_ref Core//default, Op, loaded [concrete = constants.%Op.ab9] +// CHECK:STDOUT: %Core.import_ref.040: %BitAnd.type = import_ref Core//default, inst104 [no loc], loaded [symbolic = constants.%Self.25f] +// CHECK:STDOUT: %Core.import_ref.51c: = import_ref Core//default, loc15_36, loaded [symbolic = @impl.f92.%impl_witness (constants.%impl_witness.b81)] +// CHECK:STDOUT: %Core.import_ref.f6b058.1: type = import_ref Core//default, loc15_14, loaded [symbolic = @impl.f92.%T (constants.%T)] +// CHECK:STDOUT: %Core.import_ref.601: type = import_ref Core//default, loc15_24, loaded [symbolic = @impl.f92.%T (constants.%T)] +// CHECK:STDOUT: %Core.import_ref.9c1: type = import_ref Core//default, loc15_29, loaded [concrete = constants.%BitAnd.type] +// CHECK:STDOUT: %Core.import_ref.1e6: @impl.f92.%Op.type (%Op.type.f99) = import_ref Core//default, loc16_42, loaded [symbolic = @impl.f92.%Op (constants.%Op.05a)] +// CHECK:STDOUT: %Core.import_ref.f6b058.2: type = import_ref Core//default, loc15_14, loaded [symbolic = @impl.f92.%T (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .A = %A.decl +// CHECK:STDOUT: .C = %C.decl +// CHECK:STDOUT: .Works = %Works.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %A.decl: type = interface_decl @A [concrete = constants.%A.type] {} {} +// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {} +// CHECK:STDOUT: impl_decl @impl.77d [concrete] {} { +// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.77d.%G.decl) [concrete = constants.%impl_witness.a7a] +// CHECK:STDOUT: %Works.decl: %Works.type = fn_decl @Works [concrete = constants.%Works] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @A { +// CHECK:STDOUT: %Self: %A.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.31d] +// CHECK:STDOUT: %G.decl: %G.type.c3a = fn_decl @G.1 [concrete = constants.%G.11a] {} {} +// CHECK:STDOUT: %assoc0: %A.assoc_type = assoc_entity element0, %G.decl [concrete = constants.%assoc0.773] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: .G = %assoc0 +// CHECK:STDOUT: witness = (%G.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @BitAnd [from "core.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%Core.import_ref.ad0 +// CHECK:STDOUT: .Op = imports.%Core.import_ref.08d +// CHECK:STDOUT: witness = (imports.%Core.Op) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.77d: %C.ref as %A.ref { +// CHECK:STDOUT: %G.decl: %G.type.486 = fn_decl @G.2 [concrete = constants.%G.001] {} {} +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: witness = file.%impl_witness +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.f92(imports.%Core.import_ref.f6b058.1: type) [from "core.carbon"] { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)] +// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%Core.import_ref.1e6), @impl.f92(%T) [symbolic = %impl_witness (constants.%impl_witness.db8)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Op.type: type = fn_type @Op.2, @impl.f92(%T) [symbolic = %Op.type (constants.%Op.type.f99)] +// CHECK:STDOUT: %Op: @impl.f92.%Op.type (%Op.type.f99) = struct_value () [symbolic = %Op (constants.%Op.05a)] +// CHECK:STDOUT: %require_complete: = require_complete_type @impl.f92.%T (%T) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%Core.import_ref.601 as imports.%Core.import_ref.9c1 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%Core.import_ref.51c +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: class @C { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357] +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%C +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @G.1(@A.%Self: %A.type) { +// CHECK:STDOUT: fn(); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @G.2() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Works() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %C.ref.loc15: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %A.ref.loc15_7: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %A.ref.loc15_11: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc15_9: %.d4d = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] +// CHECK:STDOUT: %bound_method.loc15: = bound_method %A.ref.loc15_7, %impl.elem0.loc15_9 [concrete = constants.%Op.bound] +// CHECK:STDOUT: %specific_fn.loc15: = specific_function %bound_method.loc15, @Op.2(type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %type.and.loc15: init type = call %specific_fn.loc15(%A.ref.loc15_7, %A.ref.loc15_11) [concrete = constants.%A.type] +// CHECK:STDOUT: %G.ref.loc15: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.773] +// CHECK:STDOUT: %A.facet.loc15: %A.type = facet_value constants.%C, constants.%impl_witness.a7a [concrete = constants.%A.facet] +// CHECK:STDOUT: %.loc15: %A.type = converted %C.ref.loc15, %A.facet.loc15 [concrete = constants.%A.facet] +// CHECK:STDOUT: %as_wit.loc15: = facet_access_witness %.loc15 [concrete = constants.%impl_witness.a7a] +// CHECK:STDOUT: %impl.elem0.loc15_4: %.faa = impl_witness_access %as_wit.loc15, element0 [concrete = constants.%G.001] +// CHECK:STDOUT: %G.call.loc15: init %empty_tuple.type = call %impl.elem0.loc15_4() +// CHECK:STDOUT: %C.ref.loc16: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %A.ref.loc16_10: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %A.ref.loc16_14: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc16_12: %.d4d = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] +// CHECK:STDOUT: %bound_method.loc16_12: = bound_method %A.ref.loc16_10, %impl.elem0.loc16_12 [concrete = constants.%Op.bound] +// CHECK:STDOUT: %specific_fn.loc16_12: = specific_function %bound_method.loc16_12, @Op.2(type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %type.and.loc16_12: init type = call %specific_fn.loc16_12(%A.ref.loc16_10, %A.ref.loc16_14) [concrete = constants.%A.type] +// CHECK:STDOUT: %.loc16_15.1: type = value_of_initializer %type.and.loc16_12 [concrete = constants.%A.type] +// CHECK:STDOUT: %.loc16_15.2: type = converted %type.and.loc16_12, %.loc16_15.1 [concrete = constants.%A.type] +// CHECK:STDOUT: %A.facet.loc16: %A.type = facet_value constants.%C, constants.%impl_witness.a7a [concrete = constants.%A.facet] +// CHECK:STDOUT: %.loc16_6: %A.type = converted %C.ref.loc16, %A.facet.loc16 [concrete = constants.%A.facet] +// CHECK:STDOUT: %A.ref.loc16_20: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %A.ref.loc16_24: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc16_22: %.d4d = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] +// CHECK:STDOUT: %bound_method.loc16_22: = bound_method %A.ref.loc16_20, %impl.elem0.loc16_22 [concrete = constants.%Op.bound] +// CHECK:STDOUT: %specific_fn.loc16_22: = specific_function %bound_method.loc16_22, @Op.2(type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %type.and.loc16_22: init type = call %specific_fn.loc16_22(%A.ref.loc16_20, %A.ref.loc16_24) [concrete = constants.%A.type] +// CHECK:STDOUT: %G.ref.loc16: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.773] +// CHECK:STDOUT: %as_wit.loc16: = facet_access_witness %.loc16_6 [concrete = constants.%impl_witness.a7a] +// CHECK:STDOUT: %impl.elem0.loc16_17: %.faa = impl_witness_access %as_wit.loc16, element0 [concrete = constants.%G.001] +// CHECK:STDOUT: %G.call.loc16: init %empty_tuple.type = call %impl.elem0.loc16_17() +// CHECK:STDOUT: %C.ref.loc17: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %A.ref.loc17_10: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %A.ref.loc17_14: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc17_12: %.d4d = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] +// CHECK:STDOUT: %bound_method.loc17: = bound_method %A.ref.loc17_10, %impl.elem0.loc17_12 [concrete = constants.%Op.bound] +// CHECK:STDOUT: %specific_fn.loc17: = specific_function %bound_method.loc17, @Op.2(type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %type.and.loc17: init type = call %specific_fn.loc17(%A.ref.loc17_10, %A.ref.loc17_14) [concrete = constants.%A.type] +// CHECK:STDOUT: %.loc17_15.1: type = value_of_initializer %type.and.loc17 [concrete = constants.%A.type] +// CHECK:STDOUT: %.loc17_15.2: type = converted %type.and.loc17, %.loc17_15.1 [concrete = constants.%A.type] +// CHECK:STDOUT: %A.facet.loc17: %A.type = facet_value constants.%C, constants.%impl_witness.a7a [concrete = constants.%A.facet] +// CHECK:STDOUT: %.loc17_6: %A.type = converted %C.ref.loc17, %A.facet.loc17 [concrete = constants.%A.facet] +// CHECK:STDOUT: %A.ref.loc17_19: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %G.ref.loc17: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.773] +// CHECK:STDOUT: %as_wit.loc17: = facet_access_witness %.loc17_6 [concrete = constants.%impl_witness.a7a] +// CHECK:STDOUT: %impl.elem0.loc17_17: %.faa = impl_witness_access %as_wit.loc17, element0 [concrete = constants.%G.001] +// CHECK:STDOUT: %G.call.loc17: init %empty_tuple.type = call %impl.elem0.loc17_17() +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Op.1(imports.%Core.import_ref.040: %BitAnd.type) [from "core.carbon"] { +// CHECK:STDOUT: %Self: %BitAnd.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.25f)] +// 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: @Op.1.%Self.as_type (%Self.as_type)](%other.param_patt: @Op.1.%Self.as_type (%Self.as_type)) -> @Op.1.%Self.as_type (%Self.as_type); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Op.2(imports.%Core.import_ref.f6b058.2: type) [from "core.carbon"] { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Op.2.%T (%T)](%other.param_patt: @Op.2.%T (%T)) -> @Op.2.%T (%T) = "type.and"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @G.1(constants.%Self.31d) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @G.1(constants.%A.facet) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Op.1(constants.%Self.25f) { +// CHECK:STDOUT: %Self => constants.%Self.25f +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.f92(constants.%T) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %T.patt => constants.%T +// CHECK:STDOUT: %impl_witness => constants.%impl_witness.db8 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.f92(%T) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Op.2(constants.%T) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.f92(type) { +// CHECK:STDOUT: %T => type +// CHECK:STDOUT: %T.patt => type +// CHECK:STDOUT: %impl_witness => constants.%impl_witness.3ea +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Op.type => constants.%Op.type.eb8 +// CHECK:STDOUT: %Op => constants.%Op.444 +// CHECK:STDOUT: %require_complete => constants.%complete_type.473 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Op.2(type) { +// CHECK:STDOUT: %T => type +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/no_prelude/default_fn.carbon b/toolchain/check/testdata/interface/no_prelude/default_fn.carbon index d79fc796f3bb1..8e684eea5499f 100644 --- a/toolchain/check/testdata/interface/no_prelude/default_fn.carbon +++ b/toolchain/check/testdata/interface/no_prelude/default_fn.carbon @@ -11,7 +11,7 @@ class C { interface I { // TODO: Use `default` here. - fn F() { + fn F[self: Self]() { // I and F are both complete here, and the impl below is in scope. var c: C = {}; c.(I.F)(); @@ -19,7 +19,7 @@ class C { } impl C as I { - fn F() {} + fn F[self: Self]() {} } } @@ -29,6 +29,7 @@ class C { // CHECK:STDOUT: %C: type = class_type @C [concrete] // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete] // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] // CHECK:STDOUT: %F.type.0b5: type = fn_type @F.1 [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %F.20c: %F.type.0b5 = struct_value () [concrete] @@ -40,6 +41,7 @@ class C { // CHECK:STDOUT: %I.facet: %I.type = facet_value %C, %impl_witness [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] +// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type [symbolic] // CHECK:STDOUT: %C.val: %C = struct_value () [concrete] // CHECK:STDOUT: %.eab: type = fn_type_with_self_type %F.type.0b5, %I.facet [concrete] // CHECK:STDOUT: } @@ -53,7 +55,18 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F.decl: %F.type.0b5 = fn_decl @F.1 [concrete = constants.%F.20c] {} {} +// CHECK:STDOUT: %F.decl: %F.type.0b5 = fn_decl @F.1 [concrete = constants.%F.20c] { +// CHECK:STDOUT: %self.patt: @F.1.%Self.as_type.loc14_16.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @F.1.%Self.as_type.loc14_16.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @F.1.%Self.as_type.loc14_16.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc14_16.1: type = splice_block %.loc14_16.2 [symbolic = %Self.as_type.loc14_16.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %Self.ref: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc14_16.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc14_16.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc14_16.2: type = converted %Self.ref, %Self.as_type.loc14_16.2 [symbolic = %Self.as_type.loc14_16.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @F.1.%Self.as_type.loc14_16.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -65,7 +78,14 @@ class C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: %C.ref as %I.ref { -// CHECK:STDOUT: %F.decl: %F.type.4a2 = fn_decl @F.2 [concrete = constants.%F.eb2] {} {} +// CHECK:STDOUT: %F.decl: %F.type.4a2 = fn_decl @F.2 [concrete = constants.%F.eb2] { +// CHECK:STDOUT: %self.patt: %C = binding_pattern self +// CHECK:STDOUT: %self.param_patt: %C = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: %C = value_param runtime_param0 +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%C.ref [concrete = constants.%C] +// CHECK:STDOUT: %self: %C = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F.decl @@ -89,9 +109,13 @@ class C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F.1(@I.%Self: %I.type) { +// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc14_16.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc14_16.1 (constants.%Self.as_type)] +// CHECK:STDOUT: // CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @F.1.%Self.as_type.loc14_16.1 (%Self.as_type) [symbolic = %require_complete (constants.%require_complete)] // CHECK:STDOUT: -// CHECK:STDOUT: fn() { +// CHECK:STDOUT: fn[%self.param_patt: @F.1.%Self.as_type.loc14_16.1 (%Self.as_type)]() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %c.patt: %C = binding_pattern c @@ -108,17 +132,25 @@ class C { // CHECK:STDOUT: %I.ref: type = name_ref I, @C.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, @I.%assoc0 [concrete = constants.%assoc0] // CHECK:STDOUT: %impl.elem0: %.eab = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%F.eb2] -// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %impl.elem0() +// CHECK:STDOUT: %bound_method: = bound_method %c.ref, %impl.elem0 +// CHECK:STDOUT: %.loc17: %C = bind_value %c.ref +// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %bound_method(%.loc17) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2() { +// CHECK:STDOUT: fn @F.2[%self.param_patt: %C]() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%Self) {} +// CHECK:STDOUT: specific @F.1(constants.%Self) { +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type.loc14_16.1 => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%I.facet) {} +// CHECK:STDOUT: specific @F.1(constants.%I.facet) { +// CHECK:STDOUT: %Self => constants.%I.facet +// CHECK:STDOUT: %Self.as_type.loc14_16.1 => constants.%C +// CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/no_prelude/fail_member_lookup.carbon b/toolchain/check/testdata/interface/no_prelude/fail_member_lookup.carbon index f16e053acdda9..1180ee7ae189a 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_member_lookup.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_member_lookup.carbon @@ -8,6 +8,18 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/fail_member_lookup.carbon +// --- core.carbon +package Core; + +interface ImplicitAs(Dest:! type) { + fn Convert[self: Self]() -> Dest; +} + +// --- fail_member_lookup.carbon +library "[[@TEST_NAME]]"; + +import Core; + interface Interface { fn F(); @@ -21,7 +33,10 @@ fn F() { // CHECK:STDERR: Interface.F(); - // CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+4]]:10: error: `Core.ImplicitAs` implicitly referenced here, but package `Core` not found [CoreNotFound] + // CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+7]]:10: error: cannot implicitly convert from `` to `type` [ImplicitAsConversionFailure] + // CHECK:STDERR: var v: Interface.T; + // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+4]]:10: note: type `` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] // CHECK:STDERR: var v: Interface.T; // CHECK:STDERR: ^~~~~~~~~~~ // CHECK:STDERR: @@ -30,12 +45,111 @@ fn F() { interface Different {} -// CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+4]]:24: error: cannot access member of interface `Interface` in type `Different` that does not implement that interface [MissingImplInMemberAccess] +// CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+7]]:24: error: cannot implicitly convert from `Different` to `Interface` [ImplicitAsConversionFailure] +// CHECK:STDERR: fn G(U:! Different) -> U.(Interface.T); +// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+4]]:24: note: type `Different` does not implement interface `Core.ImplicitAs(Interface)` [MissingImplInMemberAccessNote] // CHECK:STDERR: fn G(U:! Different) -> U.(Interface.T); // CHECK:STDERR: ^~~~~~~~~~~~~~~ // CHECK:STDERR: fn G(U:! Different) -> U.(Interface.T); +// 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.loc3_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: %Dest.param_patt: type = value_param_pattern %Dest.patt.loc3_22.1, runtime_param [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.param: type = value_param runtime_param +// CHECK:STDOUT: %Dest.loc3_22.1: type = bind_symbolic_name Dest, 0, %Dest.param [symbolic = %Dest.loc3_22.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc3_22.1: type) { +// CHECK:STDOUT: %Dest.loc3_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc3_22.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc3_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc3_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.loc3_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.loc4_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc4_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.loc4_20.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: @Convert.%Dest (%Dest) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Convert.%Dest (%Dest) = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc3_22.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc4_20.1: type = splice_block %.loc4_20.3 [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %.loc4_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, %.loc4_20.2 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc4_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc4_20.3: type = converted %Self.ref, %Self.as_type.loc4_20.2 [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.%Dest (%Dest) = out_param runtime_param1 +// CHECK:STDOUT: %return: ref @Convert.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc4_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc4_35.2 (constants.%assoc0)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc4_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert(@ImplicitAs.%Dest.loc3_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.loc4_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type)]() -> @Convert.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc3_22.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc3_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.loc4_20.1 => constants.%Self.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(%Dest.loc3_22.2) {} +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_member_lookup.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -44,25 +158,61 @@ fn G(U:! Different) -> U.(Interface.T); // CHECK:STDOUT: %F.type.1ad: type = fn_type @F.1 [concrete] // CHECK:STDOUT: %F.5d3: %F.type.1ad = struct_value () [concrete] // CHECK:STDOUT: %Interface.assoc_type: type = assoc_entity_type %Interface.type [concrete] -// CHECK:STDOUT: %assoc0: %Interface.assoc_type = assoc_entity element0, @Interface.%F.decl [concrete] +// CHECK:STDOUT: %assoc0.42d: %Interface.assoc_type = assoc_entity element0, @Interface.%F.decl [concrete] // CHECK:STDOUT: %assoc1: %Interface.assoc_type = assoc_entity element1, @Interface.%T [concrete] // CHECK:STDOUT: %F.type.b25: type = fn_type @F.2 [concrete] // CHECK:STDOUT: %F.c41: %F.type.b25 = struct_value () [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.43db8b.1: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.1 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.dc8: type = facet_type <@ImplicitAs, @ImplicitAs(type)> [concrete] +// CHECK:STDOUT: %Convert.type.30b: type = fn_type @Convert, @ImplicitAs(type) [concrete] +// CHECK:STDOUT: %Convert.732: %Convert.type.30b = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.assoc_type.372: type = assoc_entity_type %ImplicitAs.type.dc8 [concrete] +// CHECK:STDOUT: %assoc0.536: %ImplicitAs.assoc_type.372 = assoc_entity element0, imports.%Core.import_ref.207961.1 [concrete] +// CHECK:STDOUT: %assoc0.43db8b.2: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.2 [symbolic] // CHECK:STDOUT: %Different.type: type = facet_type <@Different> [concrete] // CHECK:STDOUT: %Self.e7f: %Different.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %U: %Different.type = bind_symbolic_name U, 0 [symbolic] // CHECK:STDOUT: %U.patt: %Different.type = symbolic_binding_pattern U, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.55e: type = facet_type <@ImplicitAs, @ImplicitAs(%Interface.type)> [concrete] +// CHECK:STDOUT: %Convert.type.2bc: type = fn_type @Convert, @ImplicitAs(%Interface.type) [concrete] +// CHECK:STDOUT: %Convert.6b1: %Convert.type.2bc = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.assoc_type.62c: type = assoc_entity_type %ImplicitAs.type.55e [concrete] +// CHECK:STDOUT: %assoc0.b1f: %ImplicitAs.assoc_type.62c = assoc_entity element0, imports.%Core.import_ref.207961.1 [concrete] // CHECK:STDOUT: %G.type: type = fn_type @G [concrete] // CHECK:STDOUT: %G: %G.type = struct_value () [concrete] // CHECK:STDOUT: } // 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.ffd566.1: type = import_ref Core//default, loc3_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst26 [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.43db8b.2)] +// CHECK:STDOUT: %Core.Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, Convert, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] +// CHECK:STDOUT: %Core.import_ref.ffd566.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, inst26 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] +// CHECK:STDOUT: %Core.import_ref.207961.1 = import_ref Core//default, loc4_35, unloaded +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .Interface = %Interface.decl // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .Different = %Different.decl // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Interface.decl: type = interface_decl @Interface [concrete = constants.%Interface.type] {} {} // CHECK:STDOUT: %F.decl: %F.type.b25 = fn_decl @F.2 [concrete = constants.%F.c41] {} {} // CHECK:STDOUT: %Different.decl: type = interface_decl @Different [concrete = constants.%Different.type] {} {} @@ -75,6 +225,7 @@ fn G(U:! Different) -> U.(Interface.T); // CHECK:STDOUT: %U.ref: %Different.type = name_ref U, %U.loc37_6.1 [symbolic = %U.loc37_6.2 (constants.%U)] // CHECK:STDOUT: %Interface.ref: type = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.type] // CHECK:STDOUT: %T.ref: %Interface.assoc_type = name_ref T, @T.%assoc1 [concrete = constants.%assoc1] +// CHECK:STDOUT: %.loc37: %Interface.type = converted %U.ref, [concrete = ] // CHECK:STDOUT: %U.param: %Different.type = value_param runtime_param // CHECK:STDOUT: %Different.ref: type = name_ref Different, file.%Different.decl [concrete = constants.%Different.type] // CHECK:STDOUT: %U.loc37_6.1: %Different.type = bind_symbolic_name U, 0, %U.param [symbolic = %U.loc37_6.2 (constants.%U)] @@ -86,7 +237,7 @@ fn G(U:! Different) -> U.(Interface.T); // CHECK:STDOUT: interface @Interface { // CHECK:STDOUT: %Self: %Interface.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.719] // CHECK:STDOUT: %F.decl: %F.type.1ad = fn_decl @F.1 [concrete = constants.%F.5d3] {} {} -// CHECK:STDOUT: %assoc0: %Interface.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0] +// CHECK:STDOUT: %assoc0: %Interface.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0.42d] // CHECK:STDOUT: %T: type = assoc_const_decl @T [concrete] { // CHECK:STDOUT: %assoc1: %Interface.assoc_type = assoc_entity element1, @Interface.%T [concrete = constants.%assoc1] // CHECK:STDOUT: } @@ -98,6 +249,26 @@ fn G(U:! Different) -> U.(Interface.T); // CHECK:STDOUT: witness = (%F.decl, %T) // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.ffd566.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.207961.1 [symbolic = %assoc0 (constants.%assoc0.43db8b.1)] +// 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: interface @Different { // CHECK:STDOUT: %Self: %Different.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.e7f] // CHECK:STDOUT: @@ -116,22 +287,31 @@ fn G(U:! Different) -> U.(Interface.T); // CHECK:STDOUT: // CHECK:STDOUT: fn @F.2() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Interface.ref.loc22: type = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.type] -// CHECK:STDOUT: %F.ref: %Interface.assoc_type = name_ref F, @Interface.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %Interface.ref.loc16: type = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.type] +// CHECK:STDOUT: %F.ref: %Interface.assoc_type = name_ref F, @Interface.%assoc0 [concrete = constants.%assoc0.42d] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %v.patt: = binding_pattern v -// CHECK:STDOUT: %.loc28_3: = var_pattern %v.patt +// CHECK:STDOUT: %.loc25_3: = var_pattern %v.patt // CHECK:STDOUT: } // CHECK:STDOUT: %v.var: ref = var v // CHECK:STDOUT: %.1: = splice_block [concrete = ] { -// CHECK:STDOUT: %Interface.ref.loc28: type = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.type] +// CHECK:STDOUT: %Interface.ref.loc25: type = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.type] // CHECK:STDOUT: %T.ref: %Interface.assoc_type = name_ref T, @T.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: %.loc28_19: type = converted %T.ref, [concrete = ] +// CHECK:STDOUT: %.loc25_19: type = converted %T.ref, [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %v: = bind_name v, // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.ffd566.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 @G(%U.loc37_6.1: %Different.type) { // CHECK:STDOUT: %U.loc37_6.2: %Different.type = bind_symbolic_name U, 0 [symbolic = %U.loc37_6.2 (constants.%U)] // CHECK:STDOUT: %U.patt.loc37_6.2: %Different.type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc37_6.2 (constants.%U.patt)] @@ -143,6 +323,48 @@ fn G(U:! Different) -> U.(Interface.T); // CHECK:STDOUT: // CHECK:STDOUT: specific @T(constants.%Self.719) {} // 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(type) { +// CHECK:STDOUT: %Dest => type +// CHECK:STDOUT: %Dest.patt => type +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.dc8 +// CHECK:STDOUT: %Self => constants.%Self.519 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.30b +// CHECK:STDOUT: %Convert => constants.%Convert.732 +// CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.372 +// CHECK:STDOUT: %assoc0 => constants.%assoc0.536 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Interface.type) { +// CHECK:STDOUT: %Dest => constants.%Interface.type +// CHECK:STDOUT: %Dest.patt => constants.%Interface.type +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.55e +// CHECK:STDOUT: %Self => constants.%Self.519 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.2bc +// CHECK:STDOUT: %Convert => constants.%Convert.6b1 +// CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.62c +// CHECK:STDOUT: %assoc0 => constants.%assoc0.b1f +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: specific @G(constants.%U) { // CHECK:STDOUT: %U.loc37_6.2 => constants.%U // CHECK:STDOUT: %U.patt.loc37_6.2 => constants.%U diff --git a/toolchain/check/testdata/interface/no_prelude/local.carbon b/toolchain/check/testdata/interface/no_prelude/local.carbon index 865772d138e5c..b5e26868019a5 100644 --- a/toolchain/check/testdata/interface/no_prelude/local.carbon +++ b/toolchain/check/testdata/interface/no_prelude/local.carbon @@ -10,10 +10,10 @@ fn F() { interface I { - fn G(); + fn G[self: Self](); } impl () as I { - fn G() {} + fn G[self: Self]() {} } ().(I.G)(); } @@ -26,6 +26,7 @@ fn F() { // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete] // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] // CHECK:STDOUT: %G.type.bff: type = fn_type @G.1 [concrete] // CHECK:STDOUT: %G.f0a: %G.type.bff = struct_value () [concrete] // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type %I.type [concrete] @@ -35,6 +36,7 @@ fn F() { // CHECK:STDOUT: %G.5a2: %G.type.c84 = struct_value () [concrete] // CHECK:STDOUT: %I.facet: %I.type = facet_value %empty_tuple.type, %impl_witness [concrete] // CHECK:STDOUT: %.fbf: type = fn_type_with_self_type %G.type.bff, %I.facet [concrete] +// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -46,7 +48,18 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %G.decl: %G.type.bff = fn_decl @G.1 [concrete = constants.%G.f0a] {} {} +// CHECK:STDOUT: %G.decl: %G.type.bff = fn_decl @G.1 [concrete = constants.%G.f0a] { +// CHECK:STDOUT: %self.patt: @G.1.%Self.as_type.loc13_16.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @G.1.%Self.as_type.loc13_16.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: @G.1.%Self.as_type.loc13_16.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc13_16.1: type = splice_block %.loc13_16.2 [symbolic = %Self.as_type.loc13_16.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %Self.ref: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc13_16.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc13_16.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc13_16.2: type = converted %Self.ref, %Self.as_type.loc13_16.2 [symbolic = %Self.as_type.loc13_16.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @G.1.%Self.as_type.loc13_16.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %G.decl [concrete = constants.%assoc0] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -56,7 +69,14 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: %.loc15_9.2 as %I.ref { -// CHECK:STDOUT: %G.decl: %G.type.c84 = fn_decl @G.2 [concrete = constants.%G.5a2] {} {} +// CHECK:STDOUT: %G.decl: %G.type.c84 = fn_decl @G.2 [concrete = constants.%G.5a2] { +// CHECK:STDOUT: %self.patt: %empty_tuple.type = binding_pattern self +// CHECK:STDOUT: %self.param_patt: %empty_tuple.type = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %self.param: %empty_tuple.type = value_param runtime_param0 +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%.loc15_9.2 [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %self: %empty_tuple.type = bind_name self, %self.param +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .G = %G.decl @@ -72,24 +92,36 @@ fn F() { // CHECK:STDOUT: %I.ref: type = name_ref I, @F.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } // CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%G.decl) [concrete = constants.%impl_witness] -// CHECK:STDOUT: %.loc18: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc18_4.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %I.ref: type = name_ref I, %I.decl [concrete = constants.%I.type] // CHECK:STDOUT: %G.ref: %I.assoc_type = name_ref G, @I.%assoc0 [concrete = constants.%assoc0] // CHECK:STDOUT: %impl.elem0: %.fbf = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%G.5a2] -// CHECK:STDOUT: %G.call: init %empty_tuple.type = call %impl.elem0() +// CHECK:STDOUT: %bound_method: = bound_method %.loc18_4.1, %impl.elem0 +// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc18_4.2: %empty_tuple.type = converted %.loc18_4.1, %empty_tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %G.call: init %empty_tuple.type = call %bound_method(%.loc18_4.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @G.1(@I.%Self: %I.type) { -// CHECK:STDOUT: fn(); +// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc13_16.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc13_16.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @G.1.%Self.as_type.loc13_16.1 (%Self.as_type)](); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @G.2() { +// CHECK:STDOUT: fn @G.2[%self.param_patt: %empty_tuple.type]() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @G.1(constants.%Self) {} +// CHECK:STDOUT: specific @G.1(constants.%Self) { +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type.loc13_16.1 => constants.%Self.as_type +// CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @G.1(constants.%I.facet) {} +// CHECK:STDOUT: specific @G.1(constants.%I.facet) { +// CHECK:STDOUT: %Self => constants.%I.facet +// CHECK:STDOUT: %Self.as_type.loc13_16.1 => constants.%empty_tuple.type +// CHECK:STDOUT: } // CHECK:STDOUT: From 74f26159974c7a75d10a1e3c1b2c0f979be76225 Mon Sep 17 00:00:00 2001 From: Josh L Date: Mon, 3 Mar 2025 16:49:49 +0000 Subject: [PATCH 4/8] Checkpoint progress. --- .../impl/lookup/no_prelude/import.carbon | 67 +- .../lookup/no_prelude/specific_args.carbon | 4 +- .../testdata/impl/lookup/transitive.carbon | 7 +- .../testdata/impl/no_prelude/compound.carbon | 224 +----- .../impl/no_prelude/fail_impl_as_scope.carbon | 34 +- .../impl/no_prelude/import_compound.carbon | 300 ++----- .../impl/no_prelude/import_use_generic.carbon | 65 +- .../impl/no_prelude/interface_args.carbon | 200 ++--- .../no_prelude/compound_member_access.carbon | 753 ++++++------------ .../no_prelude/fail_member_lookup.carbon | 44 +- 10 files changed, 455 insertions(+), 1243 deletions(-) diff --git a/toolchain/check/testdata/impl/lookup/no_prelude/import.carbon b/toolchain/check/testdata/impl/lookup/no_prelude/import.carbon index b329c250680c3..55d232bf1c06f 100644 --- a/toolchain/check/testdata/impl/lookup/no_prelude/import.carbon +++ b/toolchain/check/testdata/impl/lookup/no_prelude/import.carbon @@ -523,10 +523,9 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %Self: %HasF.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %HasF.assoc_type: type = assoc_entity_type %HasF.type [concrete] // CHECK:STDOUT: %assoc0: %HasF.assoc_type = assoc_entity element0, imports.%PackageA.import_ref.ab2 [concrete] +// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%PackageA.import_ref.148) [concrete] // CHECK:STDOUT: %F.type.dbc: type = fn_type @F.1 [concrete] -// CHECK:STDOUT: %F.a2b: %F.type.dbc = struct_value () [concrete] // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] -// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%PackageA.import_ref.148) [concrete] // CHECK:STDOUT: %HasF.facet: %HasF.type = facet_value %C, %impl_witness [concrete] // CHECK:STDOUT: %.e6d: type = fn_type_with_self_type %F.type.dbc, %HasF.facet [concrete] // CHECK:STDOUT: %F.type.4e3: type = fn_type @F.2 [concrete] @@ -545,11 +544,11 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %PackageA.HasF: type = import_ref PackageA//default, HasF, loaded [concrete = constants.%HasF.type] // CHECK:STDOUT: %PackageA.import_ref.28c = import_ref PackageA//default, inst15 [no loc], unloaded // CHECK:STDOUT: %PackageA.import_ref.566: %HasF.assoc_type = import_ref PackageA//default, loc5_21, loaded [concrete = constants.%assoc0] -// CHECK:STDOUT: %PackageA.F: %F.type.dbc = import_ref PackageA//default, F, loaded [concrete = constants.%F.a2b] -// CHECK:STDOUT: %PackageA.import_ref.e73: %HasF.type = import_ref PackageA//default, inst15 [no loc], loaded [symbolic = constants.%Self] +// CHECK:STDOUT: %PackageA.F = import_ref PackageA//default, F, unloaded // CHECK:STDOUT: %PackageA.import_ref.a71: = import_ref PackageA//default, loc11_16, loaded [concrete = constants.%impl_witness] // CHECK:STDOUT: %PackageA.import_ref.29a: type = import_ref PackageA//default, loc11_6, loaded [concrete = constants.%C] // CHECK:STDOUT: %PackageA.import_ref.e8c: type = import_ref PackageA//default, loc11_11, loaded [concrete = constants.%HasF.type] +// CHECK:STDOUT: %PackageA.import_ref.e73: %HasF.type = import_ref PackageA//default, inst15 [no loc], loaded [symbolic = constants.%Self] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -629,12 +628,11 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %Self.cf3: %HasF.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %HasF.assoc_type: type = assoc_entity_type %HasF.type [concrete] // CHECK:STDOUT: %assoc0: %HasF.assoc_type = assoc_entity element0, imports.%PackageA.import_ref.ab2 [concrete] -// CHECK:STDOUT: %F.type.dbc: type = fn_type @F.1 [concrete] -// CHECK:STDOUT: %F.a2b: %F.type.dbc = struct_value () [concrete] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.cf3 [symbolic] // CHECK:STDOUT: %C: type = class_type @C [concrete] // CHECK:STDOUT: %HasG.type: type = facet_type <@HasG> [concrete] // CHECK:STDOUT: %impl_witness: = impl_witness (imports.%PackageB.import_ref.0cd) [concrete] +// CHECK:STDOUT: %F.type.dbc: type = fn_type @F.1 [concrete] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.cf3 [symbolic] // CHECK:STDOUT: %HasF.facet: %HasF.type = facet_value %D, %impl_witness [concrete] // CHECK:STDOUT: %.205: type = fn_type_with_self_type %F.type.dbc, %HasF.facet [concrete] // CHECK:STDOUT: %F.type.394: type = fn_type @F.2 [concrete] @@ -656,8 +654,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %PackageA.HasF: type = import_ref PackageA//default, HasF, loaded [concrete = constants.%HasF.type] // CHECK:STDOUT: %PackageA.import_ref.28c = import_ref PackageA//default, inst15 [no loc], unloaded // CHECK:STDOUT: %PackageA.import_ref.566: %HasF.assoc_type = import_ref PackageA//default, loc5_21, loaded [concrete = constants.%assoc0] -// CHECK:STDOUT: %PackageA.F: %F.type.dbc = import_ref PackageA//default, F, loaded [concrete = constants.%F.a2b] -// CHECK:STDOUT: %PackageA.import_ref.e73: %HasF.type = import_ref PackageA//default, inst15 [no loc], loaded [symbolic = constants.%Self.cf3] +// CHECK:STDOUT: %PackageA.F = import_ref PackageA//default, F, unloaded // CHECK:STDOUT: %PackageA.import_ref.0e8 = import_ref PackageA//default, loc11_16, unloaded // CHECK:STDOUT: %PackageA.import_ref.8f2: = import_ref PackageA//default, loc8_10, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %PackageA.import_ref.2c4 = import_ref PackageA//default, inst36 [no loc], unloaded @@ -675,6 +672,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %PackageB.import_ref.231 = import_ref PackageB//default, loc23_16, unloaded // CHECK:STDOUT: %PackageB.import_ref.aa9f8a.2: type = import_ref PackageB//default, loc23_6, loaded [concrete = constants.%D] // CHECK:STDOUT: %PackageB.import_ref.cee586.2: type = import_ref PackageB//default, loc23_11, loaded [concrete = constants.%HasG.type] +// CHECK:STDOUT: %PackageA.import_ref.e73: %HasF.type = import_ref PackageA//default, inst15 [no loc], loaded [symbolic = constants.%Self.cf3] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -785,12 +783,11 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %Self.fcb: %HasG.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %HasG.assoc_type: type = assoc_entity_type %HasG.type [concrete] // CHECK:STDOUT: %assoc0: %HasG.assoc_type = assoc_entity element0, imports.%PackageB.import_ref.70a [concrete] -// CHECK:STDOUT: %G.type.d9e: type = fn_type @G.1 [concrete] -// CHECK:STDOUT: %G.cd6: %G.type.d9e = struct_value () [concrete] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.fcb [symbolic] // CHECK:STDOUT: %HasF.type: type = facet_type <@HasF> [concrete] // CHECK:STDOUT: %D: type = class_type @D [concrete] // CHECK:STDOUT: %impl_witness: = impl_witness (imports.%PackageB.import_ref.9ec) [concrete] +// CHECK:STDOUT: %G.type.d9e: type = fn_type @G.1 [concrete] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.fcb [symbolic] // CHECK:STDOUT: %HasG.facet: %HasG.type = facet_value %C, %impl_witness [concrete] // CHECK:STDOUT: %.25a: type = fn_type_with_self_type %G.type.d9e, %HasG.facet [concrete] // CHECK:STDOUT: %G.type.18e: type = fn_type @G.2 [concrete] @@ -812,8 +809,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %PackageB.HasG: type = import_ref PackageB//default, HasG, loaded [concrete = constants.%HasG.type] // CHECK:STDOUT: %PackageB.import_ref.5d8 = import_ref PackageB//default, inst17 [no loc], unloaded // CHECK:STDOUT: %PackageB.import_ref.604: %HasG.assoc_type = import_ref PackageB//default, loc7_21, loaded [concrete = constants.%assoc0] -// CHECK:STDOUT: %PackageB.G: %G.type.d9e = import_ref PackageB//default, G, loaded [concrete = constants.%G.cd6] -// CHECK:STDOUT: %PackageB.import_ref.ef5: %HasG.type = import_ref PackageB//default, inst17 [no loc], loaded [symbolic = constants.%Self.fcb] +// CHECK:STDOUT: %PackageB.G = import_ref PackageB//default, G, unloaded // CHECK:STDOUT: %PackageA.import_ref.28c = import_ref PackageA//default, inst15 [no loc], unloaded // CHECK:STDOUT: %PackageA.import_ref.a2a = import_ref PackageA//default, loc5_21, unloaded // CHECK:STDOUT: %PackageA.F = import_ref PackageA//default, F, unloaded @@ -831,6 +827,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %PackageB.import_ref.231 = import_ref PackageB//default, loc23_16, unloaded // CHECK:STDOUT: %PackageB.import_ref.aa9f8a.2: type = import_ref PackageB//default, loc23_6, loaded [concrete = constants.%D] // CHECK:STDOUT: %PackageB.import_ref.cee586.2: type = import_ref PackageB//default, loc23_11, loaded [concrete = constants.%HasG.type] +// CHECK:STDOUT: %PackageB.import_ref.ef5: %HasG.type = import_ref PackageB//default, inst17 [no loc], loaded [symbolic = constants.%Self.fcb] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -941,12 +938,11 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %Self.fcb: %HasG.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %HasG.assoc_type: type = assoc_entity_type %HasG.type [concrete] // CHECK:STDOUT: %assoc0: %HasG.assoc_type = assoc_entity element0, imports.%PackageB.import_ref.70a [concrete] -// CHECK:STDOUT: %G.type.d9e: type = fn_type @G.1 [concrete] -// CHECK:STDOUT: %G.cd6: %G.type.d9e = struct_value () [concrete] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.fcb [symbolic] // CHECK:STDOUT: %C: type = class_type @C [concrete] // CHECK:STDOUT: %HasF.type: type = facet_type <@HasF> [concrete] // CHECK:STDOUT: %impl_witness: = impl_witness (imports.%PackageB.import_ref.b0a) [concrete] +// CHECK:STDOUT: %G.type.d9e: type = fn_type @G.1 [concrete] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.fcb [symbolic] // CHECK:STDOUT: %HasG.facet: %HasG.type = facet_value %D, %impl_witness [concrete] // CHECK:STDOUT: %.b8e: type = fn_type_with_self_type %G.type.d9e, %HasG.facet [concrete] // CHECK:STDOUT: %G.type.405: type = fn_type @G.2 [concrete] @@ -965,8 +961,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %PackageB.HasG: type = import_ref PackageB//default, HasG, loaded [concrete = constants.%HasG.type] // CHECK:STDOUT: %PackageB.import_ref.5d8 = import_ref PackageB//default, inst17 [no loc], unloaded // CHECK:STDOUT: %PackageB.import_ref.604: %HasG.assoc_type = import_ref PackageB//default, loc7_21, loaded [concrete = constants.%assoc0] -// CHECK:STDOUT: %PackageB.G: %G.type.d9e = import_ref PackageB//default, G, loaded [concrete = constants.%G.cd6] -// CHECK:STDOUT: %PackageB.import_ref.ef5: %HasG.type = import_ref PackageB//default, inst17 [no loc], loaded [symbolic = constants.%Self.fcb] +// CHECK:STDOUT: %PackageB.G = import_ref PackageB//default, G, unloaded // CHECK:STDOUT: %PackageB.import_ref.fa0 = import_ref PackageB//default, loc13_25, unloaded // CHECK:STDOUT: %PackageB.import_ref.8db: = import_ref PackageB//default, inst46 [indirect], loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %PackageB.import_ref.6a9 = import_ref PackageB//default, inst47 [indirect], unloaded @@ -981,6 +976,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %PackageB.import_ref.240: = import_ref PackageB//default, loc23_16, loaded [concrete = constants.%impl_witness] // CHECK:STDOUT: %PackageB.import_ref.aa9f8a.2: type = import_ref PackageB//default, loc23_6, loaded [concrete = constants.%D] // CHECK:STDOUT: %PackageB.import_ref.cee586.2: type = import_ref PackageB//default, loc23_11, loaded [concrete = constants.%HasG.type] +// CHECK:STDOUT: %PackageB.import_ref.ef5: %HasG.type = import_ref PackageB//default, inst17 [no loc], loaded [symbolic = constants.%Self.fcb] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -1170,10 +1166,9 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %Z.assoc_type: type = assoc_entity_type %Z.type [concrete] // CHECK:STDOUT: %assoc0: %Z.assoc_type = assoc_entity element0, imports.%PackageAssociatedInterface.import_ref.250 [concrete] +// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%PackageAssociatedInterface.import_ref.6d7) [concrete] // CHECK:STDOUT: %H.type.386: type = fn_type @H.1 [concrete] -// CHECK:STDOUT: %H.246: %H.type.386 = struct_value () [concrete] // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] -// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%PackageAssociatedInterface.import_ref.6d7) [concrete] // CHECK:STDOUT: %Z.facet: %Z.type = facet_value %empty_tuple.type, %impl_witness [concrete] // CHECK:STDOUT: %.a8b: type = fn_type_with_self_type %H.type.386, %Z.facet [concrete] // CHECK:STDOUT: %H.type.ab3: type = fn_type @H.2 [concrete] @@ -1189,11 +1184,11 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %PackageAssociatedInterface.Z: type = import_ref PackageAssociatedInterface//default, Z, loaded [concrete = constants.%Z.type] // CHECK:STDOUT: %PackageAssociatedInterface.import_ref.f88 = import_ref PackageAssociatedInterface//default, inst15 [no loc], unloaded // CHECK:STDOUT: %PackageAssociatedInterface.import_ref.ddc: %Z.assoc_type = import_ref PackageAssociatedInterface//default, loc5_21, loaded [concrete = constants.%assoc0] -// CHECK:STDOUT: %PackageAssociatedInterface.H: %H.type.386 = import_ref PackageAssociatedInterface//default, H, loaded [concrete = constants.%H.246] -// CHECK:STDOUT: %PackageAssociatedInterface.import_ref.d26: %Z.type = import_ref PackageAssociatedInterface//default, inst15 [no loc], loaded [symbolic = constants.%Self] +// CHECK:STDOUT: %PackageAssociatedInterface.H = import_ref PackageAssociatedInterface//default, H, unloaded // CHECK:STDOUT: %PackageAssociatedInterface.import_ref.998: = import_ref PackageAssociatedInterface//default, loc8_14, loaded [concrete = constants.%impl_witness] // CHECK:STDOUT: %PackageAssociatedInterface.import_ref.e5c: type = import_ref PackageAssociatedInterface//default, loc8_7, loaded [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %PackageAssociatedInterface.import_ref.df1: type = import_ref PackageAssociatedInterface//default, loc8_12, loaded [concrete = constants.%Z.type] +// CHECK:STDOUT: %PackageAssociatedInterface.import_ref.d26: %Z.type = import_ref PackageAssociatedInterface//default, inst15 [no loc], loaded [symbolic = constants.%Self] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -1590,11 +1585,10 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %Self.f64: %Y.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %Y.assoc_type: type = assoc_entity_type %Y.type [concrete] // CHECK:STDOUT: %assoc0: %Y.assoc_type = assoc_entity element0, imports.%PackageHasParam.import_ref.ce2 [concrete] +// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%PackageGenericInterface.import_ref.456) [concrete] // CHECK:STDOUT: %K.type.311: type = fn_type @K.1 [concrete] -// CHECK:STDOUT: %K.7a1: %K.type.311 = struct_value () [concrete] // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.f64 [symbolic] // CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type [symbolic] -// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%PackageGenericInterface.import_ref.456) [concrete] // CHECK:STDOUT: %Y.facet: %Y.type = facet_value %AnyParam.861, %impl_witness [concrete] // CHECK:STDOUT: %.0fb: type = fn_type_with_self_type %K.type.311, %Y.facet [concrete] // CHECK:STDOUT: %K.type.7f9: type = fn_type @K.2 [concrete] @@ -1622,11 +1616,11 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %PackageHasParam.Y: type = import_ref PackageHasParam//default, Y, loaded [concrete = constants.%Y.type] // CHECK:STDOUT: %PackageHasParam.import_ref.dc1 = import_ref PackageHasParam//default, inst40 [no loc], unloaded // CHECK:STDOUT: %PackageHasParam.import_ref.5e7: %Y.assoc_type = import_ref PackageHasParam//default, loc7_22, loaded [concrete = constants.%assoc0] -// CHECK:STDOUT: %PackageHasParam.K: %K.type.311 = import_ref PackageHasParam//default, K, loaded [concrete = constants.%K.7a1] -// CHECK:STDOUT: %PackageHasParam.import_ref.292: %Y.type = import_ref PackageHasParam//default, inst40 [no loc], loaded [symbolic = constants.%Self.f64] +// CHECK:STDOUT: %PackageHasParam.K = import_ref PackageHasParam//default, K, unloaded // CHECK:STDOUT: %PackageGenericInterface.import_ref.ca8: = import_ref PackageGenericInterface//default, loc8_70, loaded [concrete = constants.%impl_witness] // CHECK:STDOUT: %PackageGenericInterface.import_ref.321: type = import_ref PackageGenericInterface//default, loc8_47, loaded [concrete = constants.%AnyParam.861] // CHECK:STDOUT: %PackageGenericInterface.import_ref.ca6: type = import_ref PackageGenericInterface//default, loc8_67, loaded [concrete = constants.%Y.type] +// CHECK:STDOUT: %PackageHasParam.import_ref.292: %Y.type = import_ref PackageHasParam//default, inst40 [no loc], loaded [symbolic = constants.%Self.f64] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -2005,12 +1999,8 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %Test.type: type = fn_type @Test [concrete] // CHECK:STDOUT: %Test: %Test.type = struct_value () [concrete] // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete] -// CHECK:STDOUT: %Self.013: %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, imports.%HasExtraInterfaces.import_ref.777 [concrete] -// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] -// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.013 [symbolic] // CHECK:STDOUT: %Extra8.type: type = facet_type <@Extra8> [concrete] // CHECK:STDOUT: %Extra7.type: type = facet_type <@Extra7> [concrete] // CHECK:STDOUT: %Extra6.type: type = facet_type <@Extra6> [concrete] @@ -2036,8 +2026,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: %HasExtraInterfaces.I: type = import_ref HasExtraInterfaces//default, I, loaded [concrete = constants.%I.type] // CHECK:STDOUT: %HasExtraInterfaces.import_ref.e5d = import_ref HasExtraInterfaces//default, inst63 [no loc], unloaded // CHECK:STDOUT: %HasExtraInterfaces.import_ref.9cd: %I.assoc_type = import_ref HasExtraInterfaces//default, loc14_33, loaded [concrete = constants.%assoc0] -// CHECK:STDOUT: %HasExtraInterfaces.F: %F.type = import_ref HasExtraInterfaces//default, F, loaded [concrete = constants.%F] -// CHECK:STDOUT: %HasExtraInterfaces.import_ref.1db: %I.type = import_ref HasExtraInterfaces//default, inst63 [no loc], loaded [symbolic = constants.%Self.013] +// CHECK:STDOUT: %HasExtraInterfaces.F = import_ref HasExtraInterfaces//default, F, unloaded // CHECK:STDOUT: %HasExtraInterfaces.import_ref.1c8 = import_ref HasExtraInterfaces//default, loc16_79, unloaded // CHECK:STDOUT: %HasExtraInterfaces.import_ref.9c8 = import_ref HasExtraInterfaces//default, inst43 [no loc], unloaded // CHECK:STDOUT: %HasExtraInterfaces.import_ref.dfe = import_ref HasExtraInterfaces//default, inst39 [no loc], unloaded @@ -2154,13 +2143,6 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F(imports.%HasExtraInterfaces.import_ref.1db: %I.type) [from "has_extra_interfaces.carbon"] { -// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.013)] -// 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: @F.%Self.as_type (%Self.as_type)](); -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: specific @C(constants.%T) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: %T.patt => constants.%T @@ -2173,11 +2155,6 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F(constants.%Self.013) { -// CHECK:STDOUT: %Self => constants.%Self.013 -// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: specific @C(constants.%tuple.type) { // CHECK:STDOUT: %T => constants.%tuple.type // CHECK:STDOUT: %T.patt => constants.%tuple.type diff --git a/toolchain/check/testdata/impl/lookup/no_prelude/specific_args.carbon b/toolchain/check/testdata/impl/lookup/no_prelude/specific_args.carbon index 13515009d1eb6..9274fcbef88bf 100644 --- a/toolchain/check/testdata/impl/lookup/no_prelude/specific_args.carbon +++ b/toolchain/check/testdata/impl/lookup/no_prelude/specific_args.carbon @@ -391,7 +391,7 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: %Main.import_ref.f6b058.1: type = import_ref Main//types, loc4_13, loaded [symbolic = @I.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.884 = import_ref Main//types, inst26 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.cd3: @I.%I.assoc_type (%I.assoc_type.955) = import_ref Main//types, loc4_43, loaded [symbolic = @I.%assoc0 (constants.%assoc0.249)] -// CHECK:STDOUT: %Main.F: @I.%F.type (%F.type.2ae) = import_ref Main//types, F, loaded [symbolic = @I.%F (constants.%F.bb2)] +// CHECK:STDOUT: %Main.F = import_ref Main//types, F, unloaded // CHECK:STDOUT: %Main.import_ref.f6b058.2: type = import_ref Main//types, loc4_13, loaded [symbolic = @I.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.38e: @I.%I.type (%I.type.325) = import_ref Main//types, inst26 [no loc], loaded [symbolic = @I.%Self (constants.%Self)] // CHECK:STDOUT: %Main.import_ref.e54: @I.%F.type (%F.type.2ae) = import_ref Main//types, loc4_43, loaded [symbolic = @I.%F (constants.%F.bb2)] @@ -760,7 +760,7 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: %Main.import_ref.f6b058.2: type = import_ref Main//types, loc4_13, loaded [symbolic = @I.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.884 = import_ref Main//types, inst26 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.cd3: @I.%I.assoc_type (%I.assoc_type.955) = import_ref Main//types, loc4_43, loaded [symbolic = @I.%assoc0 (constants.%assoc0.249)] -// CHECK:STDOUT: %Main.F: @I.%F.type (%F.type.2ae) = import_ref Main//types, F, loaded [symbolic = @I.%F (constants.%F.bb2)] +// CHECK:STDOUT: %Main.F = import_ref Main//types, F, unloaded // CHECK:STDOUT: %Main.import_ref.f6b058.3: type = import_ref Main//types, loc4_13, loaded [symbolic = @I.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.38e: @I.%I.type (%I.type.325) = import_ref Main//types, inst26 [no loc], loaded [symbolic = @I.%Self (constants.%Self)] // CHECK:STDOUT: %Main.import_ref.e54: @I.%F.type (%F.type.2ae) = import_ref Main//types, loc4_43, loaded [symbolic = @I.%F (constants.%F.bb2)] diff --git a/toolchain/check/testdata/impl/lookup/transitive.carbon b/toolchain/check/testdata/impl/lookup/transitive.carbon index a26f70464b61a..0001f7d641fcf 100644 --- a/toolchain/check/testdata/impl/lookup/transitive.carbon +++ b/toolchain/check/testdata/impl/lookup/transitive.carbon @@ -264,10 +264,9 @@ fn Call() { // 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, imports.%Main.import_ref.e03 [concrete] +// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%Main.import_ref.742) [concrete] // CHECK:STDOUT: %F.type.cf0: type = fn_type @F.1 [concrete] -// CHECK:STDOUT: %F.bc6: %F.type.cf0 = struct_value () [concrete] // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] -// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%Main.import_ref.742) [concrete] // CHECK:STDOUT: %I.facet: %I.type = facet_value %C, %impl_witness [concrete] // CHECK:STDOUT: %.076: type = fn_type_with_self_type %F.type.cf0, %I.facet [concrete] // CHECK:STDOUT: %F.type.5d6: type = fn_type @F.2 [concrete] @@ -285,11 +284,11 @@ fn Call() { // CHECK:STDOUT: %Main.import_ref.6a9 = import_ref Main//get, inst22 [indirect], unloaded // CHECK:STDOUT: %Main.import_ref.e5d = import_ref Main//i, inst17 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.bcb: %I.assoc_type = import_ref Main//i, loc4_33, loaded [concrete = constants.%assoc0] -// CHECK:STDOUT: %Main.F: %F.type.cf0 = import_ref Main//i, F, loaded [concrete = constants.%F.bc6] -// CHECK:STDOUT: %Main.import_ref.5dd: %I.type = import_ref Main//i, inst17 [no loc], loaded [symbolic = constants.%Self] +// CHECK:STDOUT: %Main.F = import_ref Main//i, F, unloaded // CHECK:STDOUT: %Main.import_ref.e53: = import_ref Main//c, loc7_13, loaded [concrete = constants.%impl_witness] // CHECK:STDOUT: %Main.import_ref.29a: type = import_ref Main//c, loc7_6, loaded [concrete = constants.%C] // CHECK:STDOUT: %Main.import_ref.f50: type = import_ref Main//c, loc7_11, loaded [concrete = constants.%I.type] +// CHECK:STDOUT: %Main.import_ref.5dd: %I.type = import_ref Main//i, inst17 [no loc], loaded [symbolic = constants.%Self] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { diff --git a/toolchain/check/testdata/impl/no_prelude/compound.carbon b/toolchain/check/testdata/impl/no_prelude/compound.carbon index 2c43588a95f72..f95fed0273ac7 100644 --- a/toolchain/check/testdata/impl/no_prelude/compound.carbon +++ b/toolchain/check/testdata/impl/no_prelude/compound.carbon @@ -20,6 +20,10 @@ impl {.a: ()} as NonInstance1 { } fn NonInstanceCall1() { + // CHECK:STDERR: non-instance_success.carbon:[[@LINE+4]]:3: error: cannot access member of interface `NonInstance1` in type `type` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: {.a: ()}.(NonInstance1.F1)(); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: {.a: ()}.(NonInstance1.F1)(); } @@ -44,13 +48,6 @@ impl {.b: ()} as NonInstance2 { } fn NonInstanceCall2(n: {.b: ()}) { - // CHECK:STDERR: fail_non-instance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `{.b: ()}` to `NonInstance2` [ImplicitAsConversionFailure] - // CHECK:STDERR: n.(NonInstance2.F2)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_non-instance.carbon:[[@LINE+4]]:3: note: type `{.b: ()}` does not implement interface `Core.ImplicitAs(NonInstance2)` [MissingImplInMemberAccessNote] - // CHECK:STDERR: n.(NonInstance2.F2)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: n.(NonInstance2.F2)(); } @@ -68,13 +65,6 @@ impl {.c: ()} as NonInstance3 { } fn NonInstanceCallIndirect(p: {.c: ()}*) { - // CHECK:STDERR: fail_non-instance_indirect.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `{.c: ()}` to `NonInstance3` [ImplicitAsConversionFailure] - // CHECK:STDERR: p->(NonInstance3.F3)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_non-instance_indirect.carbon:[[@LINE+4]]:3: note: type `{.c: ()}` does not implement interface `Core.ImplicitAs(NonInstance3)` [MissingImplInMemberAccessNote] - // CHECK:STDERR: p->(NonInstance3.F3)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: p->(NonInstance3.F3)(); } @@ -133,7 +123,6 @@ fn InstanceCallFail() { // CHECK:STDOUT: %NonInstance1.facet: %NonInstance1.type = facet_value %struct_type.a, %impl_witness [concrete] // CHECK:STDOUT: %NonInstanceCall1.type: type = fn_type @NonInstanceCall1 [concrete] // CHECK:STDOUT: %NonInstanceCall1: %NonInstanceCall1.type = struct_value () [concrete] -// CHECK:STDOUT: %.a93: type = fn_type_with_self_type %F1.type.163, %NonInstance1.facet [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -182,16 +171,11 @@ fn InstanceCallFail() { // CHECK:STDOUT: // CHECK:STDOUT: fn @NonInstanceCall1() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc12_9.1: %empty_tuple.type = tuple_literal () -// CHECK:STDOUT: %.loc12_9.2: type = converted %.loc12_9.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc16_9.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc16_9.2: type = converted %.loc16_9.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_tuple.type} [concrete = constants.%struct_type.a] // CHECK:STDOUT: %NonInstance1.ref: type = name_ref NonInstance1, file.%NonInstance1.decl [concrete = constants.%NonInstance1.type] // CHECK:STDOUT: %F1.ref: %NonInstance1.assoc_type = name_ref F1, @NonInstance1.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %NonInstance1.facet: %NonInstance1.type = facet_value constants.%struct_type.a, constants.%impl_witness [concrete = constants.%NonInstance1.facet] -// CHECK:STDOUT: %.loc12_11: %NonInstance1.type = converted %struct_type.a, %NonInstance1.facet [concrete = constants.%NonInstance1.facet] -// CHECK:STDOUT: %as_wit: = facet_access_witness %.loc12_11 [concrete = constants.%impl_witness] -// CHECK:STDOUT: %impl.elem0: %.a93 = impl_witness_access %as_wit, element0 [concrete = constants.%F1.c75] -// CHECK:STDOUT: %F1.call: init %empty_tuple.type = call %impl.elem0() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -299,12 +283,12 @@ fn InstanceCallFail() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %NonInstance2.type: type = facet_type <@NonInstance2> [concrete] -// CHECK:STDOUT: %Self.5a9: %NonInstance2.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self: %NonInstance2.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %F2.type.608: type = fn_type @F2.1 [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %F2.86a: %F2.type.608 = struct_value () [concrete] // CHECK:STDOUT: %NonInstance2.assoc_type: type = assoc_entity_type %NonInstance2.type [concrete] -// CHECK:STDOUT: %assoc0.97a: %NonInstance2.assoc_type = assoc_entity element0, @NonInstance2.%F2.decl [concrete] +// CHECK:STDOUT: %assoc0: %NonInstance2.assoc_type = assoc_entity element0, @NonInstance2.%F2.decl [concrete] // CHECK:STDOUT: %struct_type.b: type = struct_type {.b: %empty_tuple.type} [concrete] // CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%F2.decl) [concrete] // CHECK:STDOUT: %F2.type.1ec: type = fn_type @F2.2 [concrete] @@ -312,35 +296,13 @@ fn InstanceCallFail() { // CHECK:STDOUT: %NonInstance2.facet: %NonInstance2.type = facet_value %struct_type.b, %impl_witness [concrete] // CHECK:STDOUT: %NonInstanceCall2.type: type = fn_type @NonInstanceCall2 [concrete] // CHECK:STDOUT: %NonInstanceCall2: %NonInstanceCall2.type = struct_value () [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.43db8b.1: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.1 [symbolic] -// CHECK:STDOUT: %ImplicitAs.type.c38: type = facet_type <@ImplicitAs, @ImplicitAs(%NonInstance2.type)> [concrete] -// CHECK:STDOUT: %Convert.type.d1f: type = fn_type @Convert, @ImplicitAs(%NonInstance2.type) [concrete] -// CHECK:STDOUT: %Convert.079: %Convert.type.d1f = struct_value () [concrete] -// CHECK:STDOUT: %ImplicitAs.assoc_type.5d3: type = assoc_entity_type %ImplicitAs.type.c38 [concrete] -// CHECK:STDOUT: %assoc0.947: %ImplicitAs.assoc_type.5d3 = assoc_entity element0, imports.%Core.import_ref.207961.1 [concrete] -// CHECK:STDOUT: %assoc0.43db8b.2: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.2 [symbolic] +// CHECK:STDOUT: %.3a1: type = fn_type_with_self_type %F2.type.608, %NonInstance2.facet [concrete] // CHECK:STDOUT: } // 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.ffd566.1: type = import_ref Core//default, loc3_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] -// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst26 [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.43db8b.2)] -// CHECK:STDOUT: %Core.Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, Convert, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] -// CHECK:STDOUT: %Core.import_ref.ffd566.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, inst26 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] -// CHECK:STDOUT: %Core.import_ref.207961.1 = import_ref Core//default, loc4_35, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -373,9 +335,9 @@ fn InstanceCallFail() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @NonInstance2 { -// CHECK:STDOUT: %Self: %NonInstance2.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.5a9] +// CHECK:STDOUT: %Self: %NonInstance2.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] // CHECK:STDOUT: %F2.decl: %F2.type.608 = fn_decl @F2.1 [concrete = constants.%F2.86a] {} {} -// CHECK:STDOUT: %assoc0: %NonInstance2.assoc_type = assoc_entity element0, %F2.decl [concrete = constants.%assoc0.97a] +// CHECK:STDOUT: %assoc0: %NonInstance2.assoc_type = assoc_entity element0, %F2.decl [concrete = constants.%assoc0] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self @@ -383,26 +345,6 @@ fn InstanceCallFail() { // CHECK:STDOUT: witness = (%F2.decl) // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.ffd566.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.207961.1 [symbolic = %assoc0 (constants.%assoc0.43db8b.1)] -// 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: impl @impl: %struct_type.b as %NonInstance2.ref { // CHECK:STDOUT: %F2.decl: %F2.type.1ec = fn_decl @F2.2 [concrete = constants.%F2.941] {} {} // CHECK:STDOUT: @@ -424,63 +366,26 @@ fn InstanceCallFail() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.ref: %struct_type.b = name_ref n, %n // CHECK:STDOUT: %NonInstance2.ref: type = name_ref NonInstance2, file.%NonInstance2.decl [concrete = constants.%NonInstance2.type] -// CHECK:STDOUT: %F2.ref: %NonInstance2.assoc_type = name_ref F2, @NonInstance2.%assoc0 [concrete = constants.%assoc0.97a] -// CHECK:STDOUT: %.loc21: %NonInstance2.type = converted %n.ref, [concrete = ] +// CHECK:STDOUT: %F2.ref: %NonInstance2.assoc_type = name_ref F2, @NonInstance2.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0: %.3a1 = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%F2.941] +// CHECK:STDOUT: %F2.call: init %empty_tuple.type = call %impl.elem0() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.ffd566.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: specific @F2.1(constants.%Self.5a9) {} +// CHECK:STDOUT: specific @F2.1(constants.%Self) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @F2.1(constants.%NonInstance2.facet) {} // 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.%NonInstance2.type) { -// CHECK:STDOUT: %Dest => constants.%NonInstance2.type -// CHECK:STDOUT: %Dest.patt => constants.%NonInstance2.type -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.c38 -// CHECK:STDOUT: %Self => constants.%Self.519 -// CHECK:STDOUT: %Convert.type => constants.%Convert.type.d1f -// CHECK:STDOUT: %Convert => constants.%Convert.079 -// CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.5d3 -// CHECK:STDOUT: %assoc0 => constants.%assoc0.947 -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: --- fail_non-instance_indirect.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %NonInstance3.type: type = facet_type <@NonInstance3> [concrete] -// CHECK:STDOUT: %Self.dd1: %NonInstance3.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self: %NonInstance3.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %F3.type.ee4: type = fn_type @F3.1 [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %F3.752: %F3.type.ee4 = struct_value () [concrete] // CHECK:STDOUT: %NonInstance3.assoc_type: type = assoc_entity_type %NonInstance3.type [concrete] -// CHECK:STDOUT: %assoc0.140: %NonInstance3.assoc_type = assoc_entity element0, @NonInstance3.%F3.decl [concrete] +// CHECK:STDOUT: %assoc0: %NonInstance3.assoc_type = assoc_entity element0, @NonInstance3.%F3.decl [concrete] // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %empty_tuple.type} [concrete] // CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%F3.decl) [concrete] // CHECK:STDOUT: %F3.type.1c2: type = fn_type @F3.2 [concrete] @@ -489,35 +394,13 @@ fn InstanceCallFail() { // CHECK:STDOUT: %ptr: type = ptr_type %struct_type.c [concrete] // CHECK:STDOUT: %NonInstanceCallIndirect.type: type = fn_type @NonInstanceCallIndirect [concrete] // CHECK:STDOUT: %NonInstanceCallIndirect: %NonInstanceCallIndirect.type = struct_value () [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.43db8b.1: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.1 [symbolic] -// CHECK:STDOUT: %ImplicitAs.type.c69: type = facet_type <@ImplicitAs, @ImplicitAs(%NonInstance3.type)> [concrete] -// CHECK:STDOUT: %Convert.type.0f1: type = fn_type @Convert, @ImplicitAs(%NonInstance3.type) [concrete] -// CHECK:STDOUT: %Convert.bb3: %Convert.type.0f1 = struct_value () [concrete] -// CHECK:STDOUT: %ImplicitAs.assoc_type.43b: type = assoc_entity_type %ImplicitAs.type.c69 [concrete] -// CHECK:STDOUT: %assoc0.f5b: %ImplicitAs.assoc_type.43b = assoc_entity element0, imports.%Core.import_ref.207961.1 [concrete] -// CHECK:STDOUT: %assoc0.43db8b.2: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.2 [symbolic] +// CHECK:STDOUT: %.f98: type = fn_type_with_self_type %F3.type.ee4, %NonInstance3.facet [concrete] // CHECK:STDOUT: } // 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.ffd566.1: type = import_ref Core//default, loc3_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] -// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst26 [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.43db8b.2)] -// CHECK:STDOUT: %Core.Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, Convert, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] -// CHECK:STDOUT: %Core.import_ref.ffd566.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, inst26 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] -// CHECK:STDOUT: %Core.import_ref.207961.1 = import_ref Core//default, loc4_35, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -551,9 +434,9 @@ fn InstanceCallFail() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @NonInstance3 { -// CHECK:STDOUT: %Self: %NonInstance3.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.dd1] +// CHECK:STDOUT: %Self: %NonInstance3.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] // CHECK:STDOUT: %F3.decl: %F3.type.ee4 = fn_decl @F3.1 [concrete = constants.%F3.752] {} {} -// CHECK:STDOUT: %assoc0: %NonInstance3.assoc_type = assoc_entity element0, %F3.decl [concrete = constants.%assoc0.140] +// CHECK:STDOUT: %assoc0: %NonInstance3.assoc_type = assoc_entity element0, %F3.decl [concrete = constants.%assoc0] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self @@ -561,26 +444,6 @@ fn InstanceCallFail() { // CHECK:STDOUT: witness = (%F3.decl) // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.ffd566.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.207961.1 [symbolic = %assoc0 (constants.%assoc0.43db8b.1)] -// 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: impl @impl: %struct_type.c as %NonInstance3.ref { // CHECK:STDOUT: %F3.decl: %F3.type.1c2 = fn_decl @F3.2 [concrete = constants.%F3.1d3] {} {} // CHECK:STDOUT: @@ -602,54 +465,17 @@ fn InstanceCallFail() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: %ptr = name_ref p, %p // CHECK:STDOUT: %NonInstance3.ref: type = name_ref NonInstance3, file.%NonInstance3.decl [concrete = constants.%NonInstance3.type] -// CHECK:STDOUT: %F3.ref: %NonInstance3.assoc_type = name_ref F3, @NonInstance3.%assoc0 [concrete = constants.%assoc0.140] -// CHECK:STDOUT: %.loc21_4.1: ref %struct_type.c = deref %p.ref -// CHECK:STDOUT: %.loc21_4.2: %NonInstance3.type = converted %.loc21_4.1, [concrete = ] +// CHECK:STDOUT: %F3.ref: %NonInstance3.assoc_type = name_ref F3, @NonInstance3.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %.loc14: ref %struct_type.c = deref %p.ref +// CHECK:STDOUT: %impl.elem0: %.f98 = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%F3.1d3] +// CHECK:STDOUT: %F3.call: init %empty_tuple.type = call %impl.elem0() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.ffd566.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: specific @F3.1(constants.%Self.dd1) {} +// CHECK:STDOUT: specific @F3.1(constants.%Self) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @F3.1(constants.%NonInstance3.facet) {} // 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.%NonInstance3.type) { -// CHECK:STDOUT: %Dest => constants.%NonInstance3.type -// CHECK:STDOUT: %Dest.patt => constants.%NonInstance3.type -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.c69 -// CHECK:STDOUT: %Self => constants.%Self.519 -// CHECK:STDOUT: %Convert.type => constants.%Convert.type.0f1 -// CHECK:STDOUT: %Convert => constants.%Convert.bb3 -// CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.43b -// CHECK:STDOUT: %assoc0 => constants.%assoc0.f5b -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: --- instance_success.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { diff --git a/toolchain/check/testdata/impl/no_prelude/fail_impl_as_scope.carbon b/toolchain/check/testdata/impl/no_prelude/fail_impl_as_scope.carbon index bf7df1ef834fe..97077953e0a71 100644 --- a/toolchain/check/testdata/impl/no_prelude/fail_impl_as_scope.carbon +++ b/toolchain/check/testdata/impl/no_prelude/fail_impl_as_scope.carbon @@ -74,6 +74,10 @@ fn F() { // Even if the `impl` is diagnosed above, we must not add the impl of the // interface to itself in a way that allows it to be used during impl lookup, // or we end up with infinite impl lookup recursion here. + // CHECK:STDERR: fail_impl_as_self_interface.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Z` in type `type` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: Point.(Z.Zero)(); + // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: Point.(Z.Zero)(); ({} as Point).(Z.Method)(); } @@ -236,7 +240,6 @@ class X { // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] -// CHECK:STDOUT: %.c03: type = fn_type_with_self_type %Zero.type.822, %Z.facet [concrete] // CHECK:STDOUT: %Point.val: %Point = struct_value () [concrete] // CHECK:STDOUT: %.6a1: type = fn_type_with_self_type %Method.type.f12, %Z.facet [concrete] // CHECK:STDOUT: } @@ -388,26 +391,21 @@ class X { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Point.ref.loc35: type = name_ref Point, file.%Point.decl [concrete = constants.%Point] -// CHECK:STDOUT: %Z.ref.loc35: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] +// CHECK:STDOUT: %Point.ref.loc39: type = name_ref Point, file.%Point.decl [concrete = constants.%Point] +// CHECK:STDOUT: %Z.ref.loc39: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] // CHECK:STDOUT: %Zero.ref: %Z.assoc_type = name_ref Zero, @Z.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %Z.facet: %Z.type = facet_value constants.%Point, constants.%impl_witness [concrete = constants.%Z.facet] -// CHECK:STDOUT: %.loc35: %Z.type = converted %Point.ref.loc35, %Z.facet [concrete = constants.%Z.facet] -// CHECK:STDOUT: %as_wit: = facet_access_witness %.loc35 [concrete = constants.%impl_witness] -// CHECK:STDOUT: %impl.elem0: %.c03 = impl_witness_access %as_wit, element0 [concrete = constants.%Zero.dec] -// CHECK:STDOUT: %Zero.call: init %empty_tuple.type = call %impl.elem0() -// CHECK:STDOUT: %.loc36_5.1: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %Point.ref.loc36: type = name_ref Point, file.%Point.decl [concrete = constants.%Point] -// CHECK:STDOUT: %.loc36_5.2: ref %Point = temporary_storage -// CHECK:STDOUT: %.loc36_5.3: init %Point = class_init (), %.loc36_5.2 [concrete = constants.%Point.val] -// CHECK:STDOUT: %.loc36_5.4: ref %Point = temporary %.loc36_5.2, %.loc36_5.3 -// CHECK:STDOUT: %.loc36_7.1: ref %Point = converted %.loc36_5.1, %.loc36_5.4 -// CHECK:STDOUT: %Z.ref.loc36: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] +// CHECK:STDOUT: %.loc40_5.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %Point.ref.loc40: type = name_ref Point, file.%Point.decl [concrete = constants.%Point] +// CHECK:STDOUT: %.loc40_5.2: ref %Point = temporary_storage +// CHECK:STDOUT: %.loc40_5.3: init %Point = class_init (), %.loc40_5.2 [concrete = constants.%Point.val] +// CHECK:STDOUT: %.loc40_5.4: ref %Point = temporary %.loc40_5.2, %.loc40_5.3 +// CHECK:STDOUT: %.loc40_7.1: ref %Point = converted %.loc40_5.1, %.loc40_5.4 +// CHECK:STDOUT: %Z.ref.loc40: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] // CHECK:STDOUT: %Method.ref: %Z.assoc_type = name_ref Method, @Z.%assoc1 [concrete = constants.%assoc1] // CHECK:STDOUT: %impl.elem1: %.6a1 = impl_witness_access constants.%impl_witness, element1 [concrete = constants.%Method.2c2] -// CHECK:STDOUT: %bound_method: = bound_method %.loc36_7.1, %impl.elem1 -// CHECK:STDOUT: %.loc36_7.2: %Point = bind_value %.loc36_7.1 -// CHECK:STDOUT: %Method.call: init %empty_tuple.type = call %bound_method(%.loc36_7.2) +// CHECK:STDOUT: %bound_method: = bound_method %.loc40_7.1, %impl.elem1 +// CHECK:STDOUT: %.loc40_7.2: %Point = bind_value %.loc40_7.1 +// CHECK:STDOUT: %Method.call: init %empty_tuple.type = call %bound_method(%.loc40_7.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/no_prelude/import_compound.carbon b/toolchain/check/testdata/impl/no_prelude/import_compound.carbon index 250e80ac4af33..5afd410c90a75 100644 --- a/toolchain/check/testdata/impl/no_prelude/import_compound.carbon +++ b/toolchain/check/testdata/impl/no_prelude/import_compound.carbon @@ -33,6 +33,10 @@ library "[[@TEST_NAME]]"; import library "lib"; fn NonInstanceCallImport() { + // CHECK:STDERR: import_non-instance_success.carbon:[[@LINE+4]]:3: error: cannot access member of interface `NonInstance` in type `type` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: {.i: ()}.(NonInstance.F)(); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: {.i: ()}.(NonInstance.F)(); } @@ -50,13 +54,6 @@ import library "lib"; import Core; fn NonInstanceCallImportFail(n: {.i: ()}) { - // CHECK:STDERR: fail_import_non-instance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `{.i: ()}` to `NonInstance` [ImplicitAsConversionFailure] - // CHECK:STDERR: n.(NonInstance.F)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_non-instance.carbon:[[@LINE+4]]:3: note: type `{.i: ()}` does not implement interface `Core.ImplicitAs(NonInstance)` [MissingImplInMemberAccessNote] - // CHECK:STDERR: n.(NonInstance.F)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: n.(NonInstance.F)(); } @@ -67,13 +64,6 @@ import library "lib"; import Core; fn NonInstanceCallIndirectImport(p: {.i: ()}*) { - // CHECK:STDERR: fail_import_non-instance_indirect.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `{.i: ()}` to `NonInstance` [ImplicitAsConversionFailure] - // CHECK:STDERR: p->(NonInstance.F)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_import_non-instance_indirect.carbon:[[@LINE+4]]:3: note: type `{.i: ()}` does not implement interface `Core.ImplicitAs(NonInstance)` [MissingImplInMemberAccessNote] - // CHECK:STDERR: p->(NonInstance.F)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: p->(NonInstance.F)(); } @@ -254,17 +244,9 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: %NonInstanceCallImport: %NonInstanceCallImport.type = struct_value () [concrete] // CHECK:STDOUT: %struct_type.i: type = struct_type {.i: %empty_tuple.type} [concrete] // CHECK:STDOUT: %NonInstance.type: type = facet_type <@NonInstance> [concrete] -// CHECK:STDOUT: %Self.73c: %NonInstance.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %NonInstance.assoc_type: type = assoc_entity_type %NonInstance.type [concrete] // CHECK:STDOUT: %assoc0: %NonInstance.assoc_type = assoc_entity element0, imports.%Main.import_ref.bb3 [concrete] -// CHECK:STDOUT: %F.type.9e5: type = fn_type @F.1 [concrete] -// CHECK:STDOUT: %F.4e4: %F.type.9e5 = struct_value () [concrete] // CHECK:STDOUT: %Instance.type: type = facet_type <@Instance> [concrete] -// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%Main.import_ref.2d7) [concrete] -// CHECK:STDOUT: %NonInstance.facet: %NonInstance.type = facet_value %struct_type.i, %impl_witness [concrete] -// CHECK:STDOUT: %.582: type = fn_type_with_self_type %F.type.9e5, %NonInstance.facet [concrete] -// CHECK:STDOUT: %F.type.042: type = fn_type @F.2 [concrete] -// CHECK:STDOUT: %F.db4: %F.type.042 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -272,9 +254,8 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: %Main.Instance = import_ref Main//lib, Instance, unloaded // CHECK:STDOUT: %Main.import_ref.c55 = import_ref Main//lib, inst15 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.69f: %NonInstance.assoc_type = import_ref Main//lib, loc4_9, loaded [concrete = constants.%assoc0] -// CHECK:STDOUT: %Main.F: %F.type.9e5 = import_ref Main//lib, F, loaded [concrete = constants.%F.4e4] -// CHECK:STDOUT: %Main.import_ref.f85: %NonInstance.type = import_ref Main//lib, inst15 [no loc], loaded [symbolic = constants.%Self.73c] -// CHECK:STDOUT: %Main.import_ref.826: = import_ref Main//lib, loc7_30, loaded [concrete = constants.%impl_witness] +// CHECK:STDOUT: %Main.F = import_ref Main//lib, F, unloaded +// CHECK:STDOUT: %Main.import_ref.112 = import_ref Main//lib, loc7_30, unloaded // CHECK:STDOUT: %Main.import_ref.ded207.1: type = import_ref Main//lib, loc7_13, loaded [concrete = constants.%struct_type.i] // CHECK:STDOUT: %Main.import_ref.ef5: type = import_ref Main//lib, loc7_18, loaded [concrete = constants.%NonInstance.type] // CHECK:STDOUT: %Main.import_ref.dcd = import_ref Main//lib, inst39 [no loc], unloaded @@ -311,7 +292,7 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.c58: imports.%Main.import_ref.ded207.1 as imports.%Main.import_ref.ef5 [from "lib.carbon"] { // CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = imports.%Main.import_ref.826 +// CHECK:STDOUT: witness = imports.%Main.import_ref.112 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.477: imports.%Main.import_ref.ded207.2 as imports.%Main.import_ref.b49 [from "lib.carbon"] { @@ -321,27 +302,14 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: // CHECK:STDOUT: fn @NonInstanceCallImport() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc6_9.1: %empty_tuple.type = tuple_literal () -// CHECK:STDOUT: %.loc6_9.2: type = converted %.loc6_9.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc10_9.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc10_9.2: type = converted %.loc10_9.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %struct_type.i: type = struct_type {.i: %empty_tuple.type} [concrete = constants.%struct_type.i] // CHECK:STDOUT: %NonInstance.ref: type = name_ref NonInstance, imports.%Main.NonInstance [concrete = constants.%NonInstance.type] // CHECK:STDOUT: %F.ref: %NonInstance.assoc_type = name_ref F, imports.%Main.import_ref.69f [concrete = constants.%assoc0] -// CHECK:STDOUT: %NonInstance.facet: %NonInstance.type = facet_value constants.%struct_type.i, constants.%impl_witness [concrete = constants.%NonInstance.facet] -// CHECK:STDOUT: %.loc6_11: %NonInstance.type = converted %struct_type.i, %NonInstance.facet [concrete = constants.%NonInstance.facet] -// CHECK:STDOUT: %as_wit: = facet_access_witness %.loc6_11 [concrete = constants.%impl_witness] -// CHECK:STDOUT: %impl.elem0: %.582 = impl_witness_access %as_wit, element0 [concrete = constants.%F.db4] -// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %impl.elem0() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F.1(imports.%Main.import_ref.f85: %NonInstance.type) [from "lib.carbon"] { -// CHECK:STDOUT: fn(); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2() [from "lib.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%Self.73c) {} -// CHECK:STDOUT: // CHECK:STDOUT: --- core.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -448,46 +416,26 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: %NonInstance.type: type = facet_type <@NonInstance> [concrete] // CHECK:STDOUT: %Self.73c: %NonInstance.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %NonInstance.assoc_type: type = assoc_entity_type %NonInstance.type [concrete] -// CHECK:STDOUT: %assoc0.3d0: %NonInstance.assoc_type = assoc_entity element0, imports.%Main.import_ref.bb3 [concrete] -// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] -// CHECK:STDOUT: %F: %F.type = struct_value () [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.43db8b.1: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.1 [symbolic] -// CHECK:STDOUT: %ImplicitAs.type.a4a: type = facet_type <@ImplicitAs, @ImplicitAs(%NonInstance.type)> [concrete] -// CHECK:STDOUT: %Convert.type.0a7: type = fn_type @Convert, @ImplicitAs(%NonInstance.type) [concrete] -// CHECK:STDOUT: %Convert.c2d: %Convert.type.0a7 = struct_value () [concrete] -// CHECK:STDOUT: %ImplicitAs.assoc_type.ffd: type = assoc_entity_type %ImplicitAs.type.a4a [concrete] -// CHECK:STDOUT: %assoc0.ff2: %ImplicitAs.assoc_type.ffd = assoc_entity element0, imports.%Core.import_ref.207961.1 [concrete] -// CHECK:STDOUT: %assoc0.43db8b.2: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.2 [symbolic] +// CHECK:STDOUT: %assoc0: %NonInstance.assoc_type = assoc_entity element0, imports.%Main.import_ref.474 [concrete] // CHECK:STDOUT: %Instance.type: type = facet_type <@Instance> [concrete] +// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%Main.import_ref.2d7) [concrete] +// CHECK:STDOUT: %F.type.9e5: type = fn_type @F.1 [concrete] +// CHECK:STDOUT: %NonInstance.facet: %NonInstance.type = facet_value %struct_type.i, %impl_witness [concrete] +// CHECK:STDOUT: %.582: type = fn_type_with_self_type %F.type.9e5, %NonInstance.facet [concrete] +// CHECK:STDOUT: %F.type.042: type = fn_type @F.2 [concrete] +// CHECK:STDOUT: %F.db4: %F.type.042 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Main.NonInstance: type = import_ref Main//lib, NonInstance, loaded [concrete = constants.%NonInstance.type] // CHECK:STDOUT: %Main.Instance = import_ref Main//lib, Instance, unloaded // 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.c55 = import_ref Main//lib, inst15 [no loc], unloaded -// CHECK:STDOUT: %Main.import_ref.69f: %NonInstance.assoc_type = import_ref Main//lib, loc4_9, loaded [concrete = constants.%assoc0.3d0] -// CHECK:STDOUT: %Main.F: %F.type = import_ref Main//lib, F, loaded [concrete = constants.%F] -// CHECK:STDOUT: %Main.import_ref.f85: %NonInstance.type = import_ref Main//lib, inst15 [no loc], loaded [symbolic = constants.%Self.73c] -// CHECK:STDOUT: %Core.import_ref.ffd566.1: type = import_ref Core//default, loc3_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] -// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst26 [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.43db8b.2)] -// CHECK:STDOUT: %Core.Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, Convert, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] -// CHECK:STDOUT: %Core.import_ref.ffd566.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, inst26 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] -// CHECK:STDOUT: %Core.import_ref.207961.1 = import_ref Core//default, loc4_35, unloaded -// CHECK:STDOUT: %Main.import_ref.112 = import_ref Main//lib, loc7_30, unloaded +// CHECK:STDOUT: %Main.import_ref.69f: %NonInstance.assoc_type = import_ref Main//lib, loc4_9, loaded [concrete = constants.%assoc0] +// CHECK:STDOUT: %Main.F = import_ref Main//lib, F, unloaded +// CHECK:STDOUT: %Main.import_ref.826: = import_ref Main//lib, loc7_30, loaded [concrete = constants.%impl_witness] // CHECK:STDOUT: %Main.import_ref.ded207.1: type = import_ref Main//lib, loc7_13, loaded [concrete = constants.%struct_type.i] // CHECK:STDOUT: %Main.import_ref.ef5: type = import_ref Main//lib, loc7_18, loaded [concrete = constants.%NonInstance.type] // CHECK:STDOUT: %Main.import_ref.dcd = import_ref Main//lib, inst39 [no loc], unloaded @@ -496,6 +444,7 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: %Main.import_ref.ab2 = import_ref Main//lib, loc15_27, unloaded // CHECK:STDOUT: %Main.import_ref.ded207.2: type = import_ref Main//lib, loc15_13, loaded [concrete = constants.%struct_type.i] // CHECK:STDOUT: %Main.import_ref.b49: type = import_ref Main//lib, loc15_18, loaded [concrete = constants.%Instance.type] +// CHECK:STDOUT: %Main.import_ref.f85: %NonInstance.type = import_ref Main//lib, inst15 [no loc], loaded [symbolic = constants.%Self.73c] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -528,26 +477,6 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: witness = (imports.%Main.F) // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.ffd566.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.207961.1 [symbolic = %assoc0 (constants.%assoc0.43db8b.1)] -// 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: interface @Instance [from "lib.carbon"] { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = imports.%Main.import_ref.dcd @@ -557,7 +486,7 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.c58: imports.%Main.import_ref.ded207.1 as imports.%Main.import_ref.ef5 [from "lib.carbon"] { // CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = imports.%Main.import_ref.112 +// CHECK:STDOUT: witness = imports.%Main.import_ref.826 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.477: imports.%Main.import_ref.ded207.2 as imports.%Main.import_ref.b49 [from "lib.carbon"] { @@ -569,54 +498,19 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.ref: %struct_type.i = name_ref n, %n // CHECK:STDOUT: %NonInstance.ref: type = name_ref NonInstance, imports.%Main.NonInstance [concrete = constants.%NonInstance.type] -// CHECK:STDOUT: %F.ref: %NonInstance.assoc_type = name_ref F, imports.%Main.import_ref.69f [concrete = constants.%assoc0.3d0] -// CHECK:STDOUT: %.loc14: %NonInstance.type = converted %n.ref, [concrete = ] +// CHECK:STDOUT: %F.ref: %NonInstance.assoc_type = name_ref F, imports.%Main.import_ref.69f [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0: %.582 = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%F.db4] +// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %impl.elem0() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F(imports.%Main.import_ref.f85: %NonInstance.type) [from "lib.carbon"] { +// CHECK:STDOUT: generic fn @F.1(imports.%Main.import_ref.f85: %NonInstance.type) [from "lib.carbon"] { // CHECK:STDOUT: fn(); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.ffd566.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: specific @F(constants.%Self.73c) {} -// 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.%NonInstance.type) { -// CHECK:STDOUT: %Dest => constants.%NonInstance.type -// CHECK:STDOUT: %Dest.patt => constants.%NonInstance.type +// CHECK:STDOUT: fn @F.2() [from "lib.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.a4a -// CHECK:STDOUT: %Self => constants.%Self.519 -// CHECK:STDOUT: %Convert.type => constants.%Convert.type.0a7 -// CHECK:STDOUT: %Convert => constants.%Convert.c2d -// CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.ffd -// CHECK:STDOUT: %assoc0 => constants.%assoc0.ff2 -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @F.1(constants.%Self.73c) {} // CHECK:STDOUT: // CHECK:STDOUT: --- fail_import_non-instance_indirect.carbon // CHECK:STDOUT: @@ -629,46 +523,26 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: %NonInstance.type: type = facet_type <@NonInstance> [concrete] // CHECK:STDOUT: %Self.73c: %NonInstance.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %NonInstance.assoc_type: type = assoc_entity_type %NonInstance.type [concrete] -// CHECK:STDOUT: %assoc0.3d0: %NonInstance.assoc_type = assoc_entity element0, imports.%Main.import_ref.bb3 [concrete] -// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] -// CHECK:STDOUT: %F: %F.type = struct_value () [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.43db8b.1: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.1 [symbolic] -// CHECK:STDOUT: %ImplicitAs.type.a4a: type = facet_type <@ImplicitAs, @ImplicitAs(%NonInstance.type)> [concrete] -// CHECK:STDOUT: %Convert.type.0a7: type = fn_type @Convert, @ImplicitAs(%NonInstance.type) [concrete] -// CHECK:STDOUT: %Convert.c2d: %Convert.type.0a7 = struct_value () [concrete] -// CHECK:STDOUT: %ImplicitAs.assoc_type.ffd: type = assoc_entity_type %ImplicitAs.type.a4a [concrete] -// CHECK:STDOUT: %assoc0.ff2: %ImplicitAs.assoc_type.ffd = assoc_entity element0, imports.%Core.import_ref.207961.1 [concrete] -// CHECK:STDOUT: %assoc0.43db8b.2: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.2 [symbolic] +// CHECK:STDOUT: %assoc0: %NonInstance.assoc_type = assoc_entity element0, imports.%Main.import_ref.474 [concrete] // CHECK:STDOUT: %Instance.type: type = facet_type <@Instance> [concrete] +// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%Main.import_ref.2d7) [concrete] +// CHECK:STDOUT: %F.type.9e5: type = fn_type @F.1 [concrete] +// CHECK:STDOUT: %NonInstance.facet: %NonInstance.type = facet_value %struct_type.i, %impl_witness [concrete] +// CHECK:STDOUT: %.582: type = fn_type_with_self_type %F.type.9e5, %NonInstance.facet [concrete] +// CHECK:STDOUT: %F.type.042: type = fn_type @F.2 [concrete] +// CHECK:STDOUT: %F.db4: %F.type.042 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Main.NonInstance: type = import_ref Main//lib, NonInstance, loaded [concrete = constants.%NonInstance.type] // CHECK:STDOUT: %Main.Instance = import_ref Main//lib, Instance, unloaded // 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.c55 = import_ref Main//lib, inst15 [no loc], unloaded -// CHECK:STDOUT: %Main.import_ref.69f: %NonInstance.assoc_type = import_ref Main//lib, loc4_9, loaded [concrete = constants.%assoc0.3d0] -// CHECK:STDOUT: %Main.F: %F.type = import_ref Main//lib, F, loaded [concrete = constants.%F] -// CHECK:STDOUT: %Main.import_ref.f85: %NonInstance.type = import_ref Main//lib, inst15 [no loc], loaded [symbolic = constants.%Self.73c] -// CHECK:STDOUT: %Core.import_ref.ffd566.1: type = import_ref Core//default, loc3_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] -// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst26 [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.43db8b.2)] -// CHECK:STDOUT: %Core.Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, Convert, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] -// CHECK:STDOUT: %Core.import_ref.ffd566.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, inst26 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] -// CHECK:STDOUT: %Core.import_ref.207961.1 = import_ref Core//default, loc4_35, unloaded -// CHECK:STDOUT: %Main.import_ref.112 = import_ref Main//lib, loc7_30, unloaded +// CHECK:STDOUT: %Main.import_ref.69f: %NonInstance.assoc_type = import_ref Main//lib, loc4_9, loaded [concrete = constants.%assoc0] +// CHECK:STDOUT: %Main.F = import_ref Main//lib, F, unloaded +// CHECK:STDOUT: %Main.import_ref.826: = import_ref Main//lib, loc7_30, loaded [concrete = constants.%impl_witness] // CHECK:STDOUT: %Main.import_ref.ded207.1: type = import_ref Main//lib, loc7_13, loaded [concrete = constants.%struct_type.i] // CHECK:STDOUT: %Main.import_ref.ef5: type = import_ref Main//lib, loc7_18, loaded [concrete = constants.%NonInstance.type] // CHECK:STDOUT: %Main.import_ref.dcd = import_ref Main//lib, inst39 [no loc], unloaded @@ -677,6 +551,7 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: %Main.import_ref.ab2 = import_ref Main//lib, loc15_27, unloaded // CHECK:STDOUT: %Main.import_ref.ded207.2: type = import_ref Main//lib, loc15_13, loaded [concrete = constants.%struct_type.i] // CHECK:STDOUT: %Main.import_ref.b49: type = import_ref Main//lib, loc15_18, loaded [concrete = constants.%Instance.type] +// CHECK:STDOUT: %Main.import_ref.f85: %NonInstance.type = import_ref Main//lib, inst15 [no loc], loaded [symbolic = constants.%Self.73c] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -710,26 +585,6 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: witness = (imports.%Main.F) // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.ffd566.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.207961.1 [symbolic = %assoc0 (constants.%assoc0.43db8b.1)] -// 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: interface @Instance [from "lib.carbon"] { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = imports.%Main.import_ref.dcd @@ -739,7 +594,7 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.c58: imports.%Main.import_ref.ded207.1 as imports.%Main.import_ref.ef5 [from "lib.carbon"] { // CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = imports.%Main.import_ref.112 +// CHECK:STDOUT: witness = imports.%Main.import_ref.826 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.477: imports.%Main.import_ref.ded207.2 as imports.%Main.import_ref.b49 [from "lib.carbon"] { @@ -751,55 +606,20 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: %ptr = name_ref p, %p // CHECK:STDOUT: %NonInstance.ref: type = name_ref NonInstance, imports.%Main.NonInstance [concrete = constants.%NonInstance.type] -// CHECK:STDOUT: %F.ref: %NonInstance.assoc_type = name_ref F, imports.%Main.import_ref.69f [concrete = constants.%assoc0.3d0] -// CHECK:STDOUT: %.loc14_4.1: ref %struct_type.i = deref %p.ref -// CHECK:STDOUT: %.loc14_4.2: %NonInstance.type = converted %.loc14_4.1, [concrete = ] +// CHECK:STDOUT: %F.ref: %NonInstance.assoc_type = name_ref F, imports.%Main.import_ref.69f [concrete = constants.%assoc0] +// CHECK:STDOUT: %.loc7: ref %struct_type.i = deref %p.ref +// CHECK:STDOUT: %impl.elem0: %.582 = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%F.db4] +// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %impl.elem0() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F(imports.%Main.import_ref.f85: %NonInstance.type) [from "lib.carbon"] { +// CHECK:STDOUT: generic fn @F.1(imports.%Main.import_ref.f85: %NonInstance.type) [from "lib.carbon"] { // CHECK:STDOUT: fn(); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.ffd566.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: specific @F(constants.%Self.73c) {} -// 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.%NonInstance.type) { -// CHECK:STDOUT: %Dest => constants.%NonInstance.type -// CHECK:STDOUT: %Dest.patt => constants.%NonInstance.type +// CHECK:STDOUT: fn @F.2() [from "lib.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.a4a -// CHECK:STDOUT: %Self => constants.%Self.519 -// CHECK:STDOUT: %Convert.type => constants.%Convert.type.0a7 -// CHECK:STDOUT: %Convert => constants.%Convert.c2d -// CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.ffd -// CHECK:STDOUT: %assoc0 => constants.%assoc0.ff2 -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @F.1(constants.%Self.73c) {} // CHECK:STDOUT: // CHECK:STDOUT: --- import_instance_success.carbon // CHECK:STDOUT: @@ -812,11 +632,10 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: %Self.cf8: %Instance.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %Instance.assoc_type: type = assoc_entity_type %Instance.type [concrete] // CHECK:STDOUT: %assoc0: %Instance.assoc_type = assoc_entity element0, imports.%Main.import_ref.b4d [concrete] -// CHECK:STDOUT: %G.type.1e1: type = fn_type @G.1 [concrete] -// CHECK:STDOUT: %G.449: %G.type.1e1 = struct_value () [concrete] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.cf8 [symbolic] // CHECK:STDOUT: %NonInstance.type: type = facet_type <@NonInstance> [concrete] // CHECK:STDOUT: %impl_witness: = impl_witness (imports.%Main.import_ref.373) [concrete] +// CHECK:STDOUT: %G.type.1e1: type = fn_type @G.1 [concrete] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.cf8 [symbolic] // CHECK:STDOUT: %Instance.facet: %Instance.type = facet_value %struct_type.i, %impl_witness [concrete] // CHECK:STDOUT: %.6d8: type = fn_type_with_self_type %G.type.1e1, %Instance.facet [concrete] // CHECK:STDOUT: %G.type.0c0: type = fn_type @G.2 [concrete] @@ -833,8 +652,7 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: %Main.Instance: type = import_ref Main//lib, Instance, loaded [concrete = constants.%Instance.type] // CHECK:STDOUT: %Main.import_ref.dcd = import_ref Main//lib, inst39 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.7cb: %Instance.assoc_type = import_ref Main//lib, loc12_21, loaded [concrete = constants.%assoc0] -// CHECK:STDOUT: %Main.G: %G.type.1e1 = import_ref Main//lib, G, loaded [concrete = constants.%G.449] -// CHECK:STDOUT: %Main.import_ref.0d8: %Instance.type = import_ref Main//lib, inst39 [no loc], loaded [symbolic = constants.%Self.cf8] +// CHECK:STDOUT: %Main.G = import_ref Main//lib, G, unloaded // CHECK:STDOUT: %Main.import_ref.c55 = import_ref Main//lib, inst15 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.93f = import_ref Main//lib, loc4_9, unloaded // CHECK:STDOUT: %Main.F = import_ref Main//lib, F, unloaded @@ -844,6 +662,7 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: %Main.import_ref.97c: = import_ref Main//lib, loc15_27, loaded [concrete = constants.%impl_witness] // CHECK:STDOUT: %Main.import_ref.ded207.2: type = import_ref Main//lib, loc15_13, loaded [concrete = constants.%struct_type.i] // CHECK:STDOUT: %Main.import_ref.b49: type = import_ref Main//lib, loc15_18, loaded [concrete = constants.%Instance.type] +// CHECK:STDOUT: %Main.import_ref.0d8: %Instance.type = import_ref Main//lib, inst39 [no loc], loaded [symbolic = constants.%Self.cf8] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -955,12 +774,8 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: %InstanceCallImportFail: %InstanceCallImportFail.type = struct_value () [concrete] // CHECK:STDOUT: %struct_type.i: type = struct_type {.i: %empty_tuple.type} [concrete] // CHECK:STDOUT: %Instance.type: type = facet_type <@Instance> [concrete] -// CHECK:STDOUT: %Self.cf8: %Instance.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %Instance.assoc_type: type = assoc_entity_type %Instance.type [concrete] // CHECK:STDOUT: %assoc0: %Instance.assoc_type = assoc_entity element0, imports.%Main.import_ref.19f [concrete] -// CHECK:STDOUT: %G.type: type = fn_type @G [concrete] -// CHECK:STDOUT: %G: %G.type = struct_value () [concrete] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.cf8 [symbolic] // CHECK:STDOUT: %NonInstance.type: type = facet_type <@NonInstance> [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -972,8 +787,7 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: } // CHECK:STDOUT: %Main.import_ref.dcd = import_ref Main//lib, inst39 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.7cb: %Instance.assoc_type = import_ref Main//lib, loc12_21, loaded [concrete = constants.%assoc0] -// CHECK:STDOUT: %Main.G: %G.type = import_ref Main//lib, G, loaded [concrete = constants.%G] -// CHECK:STDOUT: %Main.import_ref.0d8: %Instance.type = import_ref Main//lib, inst39 [no loc], loaded [symbolic = constants.%Self.cf8] +// CHECK:STDOUT: %Main.G = import_ref Main//lib, G, unloaded // CHECK:STDOUT: %Main.import_ref.c55 = import_ref Main//lib, inst15 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.93f = import_ref Main//lib, loc4_9, unloaded // CHECK:STDOUT: %Main.F = import_ref Main//lib, F, unloaded @@ -1031,15 +845,3 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @G(imports.%Main.import_ref.0d8: %Instance.type) [from "lib.carbon"] { -// CHECK:STDOUT: %Self: %Instance.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.cf8)] -// 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: @G.%Self.as_type (%Self.as_type)](); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @G(constants.%Self.cf8) { -// CHECK:STDOUT: %Self => constants.%Self.cf8 -// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/no_prelude/import_use_generic.carbon b/toolchain/check/testdata/impl/no_prelude/import_use_generic.carbon index 647c280b24f2e..a2130de2ed422 100644 --- a/toolchain/check/testdata/impl/no_prelude/import_use_generic.carbon +++ b/toolchain/check/testdata/impl/no_prelude/import_use_generic.carbon @@ -32,16 +32,16 @@ var c: C({}) = {}; // We're just checking that this doesn't crash. It's not expected to compile. // CHECK:STDERR: fail_use_in_fn_decl.carbon:[[@LINE+8]]:11: error: `Core.ImplicitAs` implicitly referenced here, but package `Core` not found [CoreNotFound] // CHECK:STDERR: fn G() -> c.(I.F)() {} -// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: // CHECK:STDERR: fail_use_in_fn_decl.carbon:[[@LINE+4]]:22: error: missing `return` at end of function with declared return type [MissingReturnStatement] // CHECK:STDERR: fn G() -> c.(I.F)() {} // CHECK:STDERR: ^ // CHECK:STDERR: fn G() -> c.(I.F)() {} -// CHECK:STDERR: fail_use_in_fn_decl.carbon:[[@LINE+8]]:11: error: `Core.ImplicitAs` implicitly referenced here, but package `Core` not found [CoreNotFound] +// CHECK:STDERR: fail_use_in_fn_decl.carbon:[[@LINE+8]]:11: error: cannot access member of interface `I` in type `type` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: fn H() -> C({}).(I.F)() {} -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: ^~~~~~~~~~~ // CHECK:STDERR: // CHECK:STDERR: fail_use_in_fn_decl.carbon:[[@LINE+4]]:26: error: missing `return` at end of function with declared return type [MissingReturnStatement] // CHECK:STDERR: fn H() -> C({}).(I.F)() {} @@ -198,21 +198,20 @@ fn H() -> C({}).(I.F)() {} // 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, imports.%Main.import_ref.777 [concrete] -// CHECK:STDOUT: %F.type.cf0: type = fn_type @F.1 [concrete] -// CHECK:STDOUT: %F.bc6: %F.type.cf0 = struct_value () [concrete] -// CHECK:STDOUT: %G.type: type = fn_type @G [concrete] -// CHECK:STDOUT: %G: %G.type = struct_value () [concrete] +// CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, imports.%Main.import_ref.e03 [concrete] // CHECK:STDOUT: %impl_witness.681: = impl_witness (imports.%Main.import_ref.e2c), @impl(%T) [symbolic] -// CHECK:STDOUT: %F.type.40c: type = fn_type @F.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %F.type.40c: type = fn_type @F.1, @impl(%T) [symbolic] // CHECK:STDOUT: %F.071: %F.type.40c = struct_value () [symbolic] // CHECK:STDOUT: %impl_witness.02b: = impl_witness (imports.%Main.import_ref.e2c), @impl(%empty_struct_type) [concrete] // CHECK:STDOUT: %impl_witness.bbe: = impl_witness (imports.%Main.import_ref.c57), @impl(%T) [symbolic] -// CHECK:STDOUT: %F.type.4a4: type = fn_type @F.2, @impl(%empty_struct_type) [concrete] +// CHECK:STDOUT: %F.type.4a4: type = fn_type @F.1, @impl(%empty_struct_type) [concrete] // CHECK:STDOUT: %F.9e6: %F.type.4a4 = struct_value () [concrete] +// CHECK:STDOUT: %F.type.cf0: type = fn_type @F.2 [concrete] // CHECK:STDOUT: %I.facet: %I.type = facet_value %C.7a7, %impl_witness.02b [concrete] // CHECK:STDOUT: %.c06: type = fn_type_with_self_type %F.type.cf0, %I.facet [concrete] -// CHECK:STDOUT: %F.specific_fn: = specific_function %F.9e6, @F.2(%empty_struct_type) [concrete] +// CHECK:STDOUT: %F.specific_fn: = specific_function %F.9e6, @F.1(%empty_struct_type) [concrete] +// CHECK:STDOUT: %G.type: type = fn_type @G [concrete] +// CHECK:STDOUT: %G: %G.type = struct_value () [concrete] // CHECK:STDOUT: %H.type: type = fn_type @H [concrete] // CHECK:STDOUT: %H: %H.type = struct_value () [concrete] // CHECK:STDOUT: } @@ -225,14 +224,14 @@ fn H() -> C({}).(I.F)() {} // CHECK:STDOUT: %Main.import_ref.4c0 = import_ref Main//import_generic, inst25 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.e5d = import_ref Main//import_generic, inst31 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.bcb: %I.assoc_type = import_ref Main//import_generic, loc7_9, loaded [concrete = constants.%assoc0] -// CHECK:STDOUT: %Main.F: %F.type.cf0 = import_ref Main//import_generic, F, loaded [concrete = constants.%F.bc6] -// CHECK:STDOUT: %Main.import_ref.5dd: %I.type = import_ref Main//import_generic, inst31 [no loc], loaded [symbolic = constants.%Self] +// CHECK:STDOUT: %Main.F = import_ref Main//import_generic, F, unloaded // CHECK:STDOUT: %Main.import_ref.d91: = import_ref Main//import_generic, loc10_34, loaded [symbolic = @impl.%impl_witness (constants.%impl_witness.bbe)] // CHECK:STDOUT: %Main.import_ref.f6b058.2: type = import_ref Main//import_generic, loc10_14, loaded [symbolic = @impl.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.499: type = import_ref Main//import_generic, loc10_27, loaded [symbolic = @impl.%C (constants.%C.f2e)] // CHECK:STDOUT: %Main.import_ref.301: type = import_ref Main//import_generic, loc10_32, loaded [concrete = constants.%I.type] // CHECK:STDOUT: %Main.import_ref.e2c: @impl.%F.type (%F.type.40c) = import_ref Main//import_generic, loc11_10, loaded [symbolic = @impl.%F (constants.%F.071)] // CHECK:STDOUT: %Main.import_ref.f6b058.3: type = import_ref Main//import_generic, loc10_14, loaded [symbolic = @impl.%T (constants.%T)] +// CHECK:STDOUT: %Main.import_ref.5dd: %I.type = import_ref Main//import_generic, inst31 [no loc], loaded [symbolic = constants.%Self] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -263,7 +262,12 @@ fn H() -> C({}).(I.F)() {} // CHECK:STDOUT: %c.ref: ref %C.7a7 = name_ref c, file.%c // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] // CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, imports.%Main.import_ref.bcb [concrete = constants.%assoc0] -// CHECK:STDOUT: %.loc16: %I.type = converted %c.ref, [concrete = ] +// CHECK:STDOUT: %impl.elem0: %.c06 = impl_witness_access constants.%impl_witness.02b, element0 [concrete = constants.%F.9e6] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @F.1(constants.%empty_struct_type) [concrete = constants.%F.specific_fn] +// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %specific_fn() +// CHECK:STDOUT: %.loc16_19.1: ref %empty_tuple.type = temporary_storage +// CHECK:STDOUT: %.loc16_19.2: ref %empty_tuple.type = temporary %.loc16_19.1, %F.call +// CHECK:STDOUT: %.loc16_19.3: type = converted %F.call, [concrete = ] // CHECK:STDOUT: %return.param: ref = out_param runtime_param0 // CHECK:STDOUT: %return: ref = return_slot %return.param // CHECK:STDOUT: } @@ -277,15 +281,6 @@ fn H() -> C({}).(I.F)() {} // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%empty_struct_type) [concrete = constants.%C.7a7] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] // CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, imports.%Main.import_ref.bcb [concrete = constants.%assoc0] -// CHECK:STDOUT: %I.facet: %I.type = facet_value constants.%C.7a7, constants.%impl_witness.02b [concrete = constants.%I.facet] -// CHECK:STDOUT: %.loc25_16: %I.type = converted %C, %I.facet [concrete = constants.%I.facet] -// CHECK:STDOUT: %as_wit: = facet_access_witness %.loc25_16 [concrete = constants.%impl_witness.02b] -// CHECK:STDOUT: %impl.elem0: %.c06 = impl_witness_access %as_wit, element0 [concrete = constants.%F.9e6] -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @F.2(constants.%empty_struct_type) [concrete = constants.%F.specific_fn] -// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %specific_fn() -// CHECK:STDOUT: %.loc25_23.1: ref %empty_tuple.type = temporary_storage -// CHECK:STDOUT: %.loc25_23.2: ref %empty_tuple.type = temporary %.loc25_23.1, %F.call -// CHECK:STDOUT: %.loc25_23.3: type = converted %F.call, [concrete = ] // CHECK:STDOUT: %return.param: ref = out_param runtime_param0 // CHECK:STDOUT: %return: ref = return_slot %return.param // CHECK:STDOUT: } @@ -305,7 +300,7 @@ fn H() -> C({}).(I.F)() {} // CHECK:STDOUT: %impl_witness: = impl_witness (imports.%Main.import_ref.e2c), @impl(%T) [symbolic = %impl_witness (constants.%impl_witness.681)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %F.type: type = fn_type @F.2, @impl(%T) [symbolic = %F.type (constants.%F.type.40c)] +// CHECK:STDOUT: %F.type: type = fn_type @F.1, @impl(%T) [symbolic = %F.type (constants.%F.type.40c)] // CHECK:STDOUT: %F: @impl.%F.type (%F.type.40c) = struct_value () [symbolic = %F (constants.%F.071)] // CHECK:STDOUT: // CHECK:STDOUT: impl: imports.%Main.import_ref.499 as imports.%Main.import_ref.301 { @@ -328,7 +323,13 @@ fn H() -> C({}).(I.F)() {} // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F.1(imports.%Main.import_ref.5dd: %I.type) [from "import_generic.carbon"] { +// CHECK:STDOUT: generic fn @F.1(imports.%Main.import_ref.f6b058.3: type) [from "import_generic.carbon"] { +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn(); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @F.2(imports.%Main.import_ref.5dd: %I.type) [from "import_generic.carbon"] { // CHECK:STDOUT: fn(); // CHECK:STDOUT: } // CHECK:STDOUT: @@ -336,12 +337,6 @@ fn H() -> C({}).(I.F)() {} // CHECK:STDOUT: !entry: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F.2(imports.%Main.import_ref.f6b058.3: type) [from "import_generic.carbon"] { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: -// CHECK:STDOUT: fn(); -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: fn @H() -> { // CHECK:STDOUT: !entry: // CHECK:STDOUT: } @@ -367,8 +362,6 @@ fn H() -> C({}).(I.F)() {} // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(constants.%Self) {} -// CHECK:STDOUT: // CHECK:STDOUT: specific @impl(constants.%T) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: %T.patt => constants.%T @@ -384,7 +377,7 @@ fn H() -> C({}).(I.F)() {} // CHECK:STDOUT: // CHECK:STDOUT: specific @impl(%T) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.2(constants.%T) {} +// CHECK:STDOUT: specific @F.1(constants.%T) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @impl(constants.%empty_struct_type) { // CHECK:STDOUT: %T => constants.%empty_struct_type @@ -397,7 +390,9 @@ fn H() -> C({}).(I.F)() {} // CHECK:STDOUT: %F => constants.%F.9e6 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.2(constants.%empty_struct_type) { +// CHECK:STDOUT: specific @F.2(constants.%Self) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @F.1(constants.%empty_struct_type) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/no_prelude/interface_args.carbon b/toolchain/check/testdata/impl/no_prelude/interface_args.carbon index 8b09cb2afbba2..d4fa49955ffdd 100644 --- a/toolchain/check/testdata/impl/no_prelude/interface_args.carbon +++ b/toolchain/check/testdata/impl/no_prelude/interface_args.carbon @@ -66,6 +66,10 @@ impl A as Factory(B) { impl library "[[@TEST_NAME]]"; fn MakeB() -> B { + // CHECK:STDERR: factory.impl.carbon:[[@LINE+4]]:10: error: cannot access member of interface `Factory(B)` in type `type` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: return A.(Factory(B).Make)(); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: return A.(Factory(B).Make)(); } fn InstanceB(a: A) -> B { @@ -88,10 +92,7 @@ import Core; class C {} fn MakeC() -> C { - // CHECK:STDERR: fail_factory.impl.carbon:[[@LINE+7]]:10: error: cannot implicitly convert from `type` to `Factory(C)` [ImplicitAsConversionFailure] - // CHECK:STDERR: return A.(Factory(C).Make)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_factory.impl.carbon:[[@LINE+4]]:10: note: type `type` does not implement interface `Core.ImplicitAs(Factory(C))` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_factory.impl.carbon:[[@LINE+4]]:10: error: cannot access member of interface `Factory(C)` in type `type` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: return A.(Factory(C).Make)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -359,7 +360,7 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %Main.import_ref.f6b058.1: type = import_ref Main//action, loc4_18, loaded [symbolic = @Action.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.ddc = import_ref Main//action, inst26 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.318: @Action.%Action.assoc_type (%Action.assoc_type.8f9) = import_ref Main//action, loc5_22, loaded [symbolic = @Action.%assoc0 (constants.%assoc0.905ab9.2)] -// CHECK:STDOUT: %Main.Op: @Action.%Op.type (%Op.type.036) = import_ref Main//action, Op, loaded [symbolic = @Action.%Op (constants.%Op.6ed)] +// CHECK:STDOUT: %Main.Op = import_ref Main//action, Op, unloaded // CHECK:STDOUT: %Main.import_ref.71c: = import_ref Main//action, loc12_21, loaded [concrete = constants.%impl_witness] // CHECK:STDOUT: %Main.import_ref.8f24d3.2: = import_ref Main//action, loc8_10, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.da3 = import_ref Main//action, inst55 [no loc], unloaded @@ -531,7 +532,7 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %Main.import_ref.f6b058.1: type = import_ref Main//action, loc4_18, loaded [symbolic = @Action.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.ddc = import_ref Main//action, inst26 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.318: @Action.%Action.assoc_type (%Action.assoc_type.8f9) = import_ref Main//action, loc5_22, loaded [symbolic = @Action.%assoc0 (constants.%assoc0.905ab9.2)] -// CHECK:STDOUT: %Main.Op: @Action.%Op.type (%Op.type.036) = import_ref Main//action, Op, loaded [symbolic = @Action.%Op (constants.%Op.6ed)] +// CHECK:STDOUT: %Main.Op = import_ref Main//action, Op, unloaded // CHECK:STDOUT: %Main.import_ref.7a1 = import_ref Main//action, loc12_21, unloaded // CHECK:STDOUT: %Main.import_ref.8f24d3.2: = import_ref Main//action, loc8_10, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.da3 = import_ref Main//action, inst55 [no loc], unloaded @@ -917,7 +918,7 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic] // CHECK:STDOUT: %Factory.type.a5d: type = facet_type <@Factory, @Factory(%B)> [concrete] // CHECK:STDOUT: %A: type = class_type @A [concrete] -// CHECK:STDOUT: %Make.type.598: type = fn_type @Make.1, @Factory(%T) [symbolic] +// CHECK:STDOUT: %Make.type.598: type = fn_type @Make, @Factory(%T) [symbolic] // CHECK:STDOUT: %Make.737: %Make.type.598 = struct_value () [symbolic] // CHECK:STDOUT: %Factory.assoc_type.ca7: type = assoc_entity_type %Factory.type.c96 [symbolic] // CHECK:STDOUT: %assoc0.35472f.1: %Factory.assoc_type.ca7 = assoc_entity element0, imports.%Main.import_ref.21018a.1 [symbolic] @@ -925,7 +926,7 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %Method.a71: %Method.type.7ee = struct_value () [symbolic] // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] // CHECK:STDOUT: %assoc1.1fdf32.1: %Factory.assoc_type.ca7 = assoc_entity element1, imports.%Main.import_ref.46fc3c.1 [symbolic] -// CHECK:STDOUT: %Make.type.c59: type = fn_type @Make.1, @Factory(%B) [concrete] +// CHECK:STDOUT: %Make.type.c59: type = fn_type @Make, @Factory(%B) [concrete] // CHECK:STDOUT: %Make.efe: %Make.type.c59 = struct_value () [concrete] // CHECK:STDOUT: %Factory.assoc_type.668: type = assoc_entity_type %Factory.type.a5d [concrete] // CHECK:STDOUT: %assoc0.228: %Factory.assoc_type.668 = assoc_entity element0, imports.%Main.import_ref.21018a.2 [concrete] @@ -935,15 +936,12 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %MakeB.type: type = fn_type @MakeB [concrete] // CHECK:STDOUT: %MakeB: %MakeB.type = struct_value () [concrete] // CHECK:STDOUT: %assoc0.35472f.2: %Factory.assoc_type.ca7 = assoc_entity element0, imports.%Main.import_ref.21018a.3 [symbolic] -// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%Main.import_ref.9ec, imports.%Main.import_ref.7dd) [concrete] -// CHECK:STDOUT: %Factory.facet: %Factory.type.a5d = facet_value %A, %impl_witness [concrete] -// CHECK:STDOUT: %.161: type = fn_type_with_self_type %Make.type.c59, %Factory.facet [concrete] -// CHECK:STDOUT: %Make.type.ec4: type = fn_type @Make.2 [concrete] -// CHECK:STDOUT: %Make.377: %Make.type.ec4 = struct_value () [concrete] // CHECK:STDOUT: %InstanceB.type: type = fn_type @InstanceB [concrete] // CHECK:STDOUT: %InstanceB: %InstanceB.type = struct_value () [concrete] // CHECK:STDOUT: %assoc1.1fdf32.2: %Factory.assoc_type.ca7 = assoc_entity element1, imports.%Main.import_ref.46fc3c.2 [symbolic] -// CHECK:STDOUT: %.478: type = fn_type_with_self_type %Method.type.117, %Factory.facet [concrete] +// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%Main.import_ref.a27200.2, imports.%Main.import_ref.7dd) [concrete] +// CHECK:STDOUT: %Factory.facet: %Factory.type.a5d = facet_value %A, %impl_witness [concrete] +// CHECK:STDOUT: %.604: type = fn_type_with_self_type %Method.type.117, %Factory.facet [concrete] // CHECK:STDOUT: %Method.type.af5: type = fn_type @Method.2 [concrete] // CHECK:STDOUT: %Method.3d4: %Method.type.af5 = struct_value () [concrete] // CHECK:STDOUT: } @@ -958,14 +956,14 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %Main.import_ref.fbb = import_ref Main//factory, inst26 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.8d5: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = import_ref Main//factory, loc6_17, loaded [symbolic = @Factory.%assoc0 (constants.%assoc0.35472f.2)] // CHECK:STDOUT: %Main.import_ref.ff7: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = import_ref Main//factory, loc8_31, loaded [symbolic = @Factory.%assoc1 (constants.%assoc1.1fdf32.2)] -// CHECK:STDOUT: %Main.Make: @Factory.%Make.type (%Make.type.598) = import_ref Main//factory, Make, loaded [symbolic = @Factory.%Make (constants.%Make.737)] -// CHECK:STDOUT: %Main.Method: @Factory.%Method.type (%Method.type.7ee) = import_ref Main//factory, Method, loaded [symbolic = @Factory.%Method (constants.%Method.a71)] +// CHECK:STDOUT: %Main.Make = import_ref Main//factory, Make, unloaded +// CHECK:STDOUT: %Main.Method = import_ref Main//factory, Method, unloaded // CHECK:STDOUT: %Main.import_ref.f8d: = import_ref Main//factory, loc14_22, loaded [concrete = constants.%impl_witness] // CHECK:STDOUT: %Main.import_ref.8f24d3.2: = import_ref Main//factory, loc11_10, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.da3 = import_ref Main//factory, inst74 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.984: type = import_ref Main//factory, loc14_6, loaded [concrete = constants.%A] // CHECK:STDOUT: %Main.import_ref.bd2: type = import_ref Main//factory, loc14_20, loaded [concrete = constants.%Factory.type.a5d] -// CHECK:STDOUT: %Main.import_ref.a27 = import_ref Main//factory, loc15_17, unloaded +// CHECK:STDOUT: %Main.import_ref.a27200.1 = import_ref Main//factory, loc15_17, unloaded // CHECK:STDOUT: %Main.import_ref.163 = import_ref Main//factory, loc16_31, unloaded // CHECK:STDOUT: %Main.import_ref.f6b058.2: type = import_ref Main//factory, loc4_19, loaded [symbolic = @Factory.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.91b53a.1: @Factory.%Factory.type (%Factory.type.c96) = import_ref Main//factory, inst26 [no loc], loaded [symbolic = @Factory.%Self (constants.%Self)] @@ -999,7 +997,7 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %return.patt: %B = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %B = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %B.ref.loc7: type = name_ref B, imports.%Main.B [concrete = constants.%B] +// CHECK:STDOUT: %B.ref.loc11: type = name_ref B, imports.%Main.B [concrete = constants.%B] // CHECK:STDOUT: %a.param: %A = value_param runtime_param0 // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A] // CHECK:STDOUT: %a: %A = bind_name a, %a.param @@ -1015,7 +1013,7 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(%T)> [symbolic = %Factory.type (constants.%Factory.type.c96)] // CHECK:STDOUT: %Self: %Factory.type.c96 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Make.type: type = fn_type @Make.1, @Factory(%T) [symbolic = %Make.type (constants.%Make.type.598)] +// CHECK:STDOUT: %Make.type: type = fn_type @Make, @Factory(%T) [symbolic = %Make.type (constants.%Make.type.598)] // CHECK:STDOUT: %Make: @Factory.%Make.type (%Make.type.598) = struct_value () [symbolic = %Make (constants.%Make.737)] // CHECK:STDOUT: %Factory.assoc_type: type = assoc_entity_type @Factory.%Factory.type (%Factory.type.c96) [symbolic = %Factory.assoc_type (constants.%Factory.assoc_type.ca7)] // CHECK:STDOUT: %assoc0: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = assoc_entity element0, imports.%Main.import_ref.21018a.1 [symbolic = %assoc0 (constants.%assoc0.35472f.1)] @@ -1034,7 +1032,7 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: imports.%Main.import_ref.984 as imports.%Main.import_ref.bd2 [from "factory.carbon"] { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Make = imports.%Main.import_ref.a27 +// CHECK:STDOUT: .Make = imports.%Main.import_ref.a27200.1 // CHECK:STDOUT: .Method = imports.%Main.import_ref.163 // CHECK:STDOUT: witness = imports.%Main.import_ref.f8d // CHECK:STDOUT: } @@ -1053,10 +1051,10 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: .Self = imports.%Main.import_ref.da3 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Make.1(imports.%Main.import_ref.f6b058.2: type, imports.%Main.import_ref.91b53a.1: @Factory.%Factory.type (%Factory.type.c96)) [from "factory.carbon"] { +// CHECK:STDOUT: generic fn @Make(imports.%Main.import_ref.f6b058.2: type, imports.%Main.import_ref.91b53a.1: @Factory.%Factory.type (%Factory.type.c96)) [from "factory.carbon"] { // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] // CHECK:STDOUT: -// CHECK:STDOUT: fn() -> @Make.1.%T (%T); +// CHECK:STDOUT: fn() -> @Make.%T (%T); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @Method.1(imports.%Main.import_ref.f6b058.3: type, imports.%Main.import_ref.91b53a.2: @Factory.%Factory.type (%Factory.type.c96)) [from "factory.carbon"] { @@ -1072,33 +1070,25 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A] // CHECK:STDOUT: %Factory.ref: %Factory.type.1a8 = name_ref Factory, imports.%Main.Factory [concrete = constants.%Factory.generic] -// CHECK:STDOUT: %B.ref.loc5: type = name_ref B, imports.%Main.B [concrete = constants.%B] +// CHECK:STDOUT: %B.ref.loc9: type = name_ref B, imports.%Main.B [concrete = constants.%B] // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%B)> [concrete = constants.%Factory.type.a5d] -// CHECK:STDOUT: %.loc5_23: %Factory.assoc_type.668 = specific_constant imports.%Main.import_ref.8d5, @Factory(constants.%B) [concrete = constants.%assoc0.228] -// CHECK:STDOUT: %Make.ref: %Factory.assoc_type.668 = name_ref Make, %.loc5_23 [concrete = constants.%assoc0.228] -// CHECK:STDOUT: %Factory.facet: %Factory.type.a5d = facet_value constants.%A, constants.%impl_witness [concrete = constants.%Factory.facet] -// CHECK:STDOUT: %.loc5_11: %Factory.type.a5d = converted %A.ref, %Factory.facet [concrete = constants.%Factory.facet] -// CHECK:STDOUT: %as_wit: = facet_access_witness %.loc5_11 [concrete = constants.%impl_witness] -// CHECK:STDOUT: %impl.elem0: %.161 = impl_witness_access %as_wit, element0 [concrete = constants.%Make.377] -// CHECK:STDOUT: %.loc4: ref %B = splice_block %return {} -// CHECK:STDOUT: %Make.call: init %B = call %impl.elem0() to %.loc4 -// CHECK:STDOUT: return %Make.call to %return +// CHECK:STDOUT: %.loc9: %Factory.assoc_type.668 = specific_constant imports.%Main.import_ref.8d5, @Factory(constants.%B) [concrete = constants.%assoc0.228] +// CHECK:STDOUT: %Make.ref: %Factory.assoc_type.668 = name_ref Make, %.loc9 [concrete = constants.%assoc0.228] +// CHECK:STDOUT: return to %return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Make.2() -> %B [from "factory.carbon"]; -// CHECK:STDOUT: // CHECK:STDOUT: fn @InstanceB(%a.param_patt: %A) -> %return.param_patt: %B { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: %A = name_ref a, %a // CHECK:STDOUT: %Factory.ref: %Factory.type.1a8 = name_ref Factory, imports.%Main.Factory [concrete = constants.%Factory.generic] -// CHECK:STDOUT: %B.ref.loc8: type = name_ref B, imports.%Main.B [concrete = constants.%B] +// CHECK:STDOUT: %B.ref.loc12: type = name_ref B, imports.%Main.B [concrete = constants.%B] // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%B)> [concrete = constants.%Factory.type.a5d] -// CHECK:STDOUT: %.loc8: %Factory.assoc_type.668 = specific_constant imports.%Main.import_ref.ff7, @Factory(constants.%B) [concrete = constants.%assoc1.51f] -// CHECK:STDOUT: %Method.ref: %Factory.assoc_type.668 = name_ref Method, %.loc8 [concrete = constants.%assoc1.51f] -// CHECK:STDOUT: %impl.elem1: %.478 = impl_witness_access constants.%impl_witness, element1 [concrete = constants.%Method.3d4] +// CHECK:STDOUT: %.loc12: %Factory.assoc_type.668 = specific_constant imports.%Main.import_ref.ff7, @Factory(constants.%B) [concrete = constants.%assoc1.51f] +// CHECK:STDOUT: %Method.ref: %Factory.assoc_type.668 = name_ref Method, %.loc12 [concrete = constants.%assoc1.51f] +// CHECK:STDOUT: %impl.elem1: %.604 = impl_witness_access constants.%impl_witness, element1 [concrete = constants.%Method.3d4] // CHECK:STDOUT: %bound_method: = bound_method %a.ref, %impl.elem1 -// CHECK:STDOUT: %.loc7: ref %B = splice_block %return {} -// CHECK:STDOUT: %Method.call: init %B = call %bound_method(%a.ref) to %.loc7 +// CHECK:STDOUT: %.loc11: ref %B = splice_block %return {} +// CHECK:STDOUT: %Method.call: init %B = call %bound_method(%a.ref) to %.loc11 // CHECK:STDOUT: return %Method.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1127,7 +1117,7 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: // CHECK:STDOUT: specific @Factory(%T) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Make.1(constants.%T, constants.%Self) { +// CHECK:STDOUT: specific @Make(constants.%T, constants.%Self) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1246,7 +1236,7 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %Factory.generic: %Factory.type.1a8 = struct_value () [concrete] // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %Factory.type.c96: type = facet_type <@Factory, @Factory(%T)> [symbolic] -// CHECK:STDOUT: %Self.9ba: %Factory.type.c96 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Self: %Factory.type.c96 = bind_symbolic_name Self, 1 [symbolic] // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic] // CHECK:STDOUT: %Factory.type.a5d: type = facet_type <@Factory, @Factory(%B)> [concrete] // CHECK:STDOUT: %A: type = class_type @A [concrete] @@ -1256,7 +1246,7 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %assoc0.35472f.1: %Factory.assoc_type.ca7 = assoc_entity element0, imports.%Main.import_ref.21018a.1 [symbolic] // CHECK:STDOUT: %Method.type.7ee: type = fn_type @Method, @Factory(%T) [symbolic] // CHECK:STDOUT: %Method.a71: %Method.type.7ee = struct_value () [symbolic] -// CHECK:STDOUT: %Self.as_type.56c: type = facet_access_type %Self.9ba [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] // CHECK:STDOUT: %assoc1.1fdf32.1: %Factory.assoc_type.ca7 = assoc_entity element1, imports.%Main.import_ref.46fc3c.1 [symbolic] // CHECK:STDOUT: %Make.type.c59: type = fn_type @Make, @Factory(%B) [concrete] // CHECK:STDOUT: %Make.efe: %Make.type.c59 = struct_value () [concrete] @@ -1277,21 +1267,6 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %Method.f9e: %Method.type.d46 = struct_value () [concrete] // CHECK:STDOUT: %assoc1.ae5: %Factory.assoc_type.709 = assoc_entity element1, imports.%Main.import_ref.46fc3c.1 [concrete] // CHECK:STDOUT: %assoc0.35472f.2: %Factory.assoc_type.ca7 = assoc_entity element0, imports.%Main.import_ref.21018a.3 [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.43db8b.1: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.1 [symbolic] -// CHECK:STDOUT: %ImplicitAs.type.d43: type = facet_type <@ImplicitAs, @ImplicitAs(%Factory.type.5c5)> [concrete] -// CHECK:STDOUT: %Convert.type.9b5: type = fn_type @Convert, @ImplicitAs(%Factory.type.5c5) [concrete] -// CHECK:STDOUT: %Convert.8cc: %Convert.type.9b5 = struct_value () [concrete] -// CHECK:STDOUT: %ImplicitAs.assoc_type.0f8: type = assoc_entity_type %ImplicitAs.type.d43 [concrete] -// CHECK:STDOUT: %assoc0.ae3: %ImplicitAs.assoc_type.0f8 = assoc_entity element0, imports.%Core.import_ref.207961.1 [concrete] -// CHECK:STDOUT: %assoc0.43db8b.2: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.2 [symbolic] // CHECK:STDOUT: %InstanceC.type: type = fn_type @InstanceC [concrete] // CHECK:STDOUT: %InstanceC: %InstanceC.type = struct_value () [concrete] // CHECK:STDOUT: %assoc1.1fdf32.2: %Factory.assoc_type.ca7 = assoc_entity element1, imports.%Main.import_ref.46fc3c.3 [symbolic] @@ -1302,7 +1277,6 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %Main.A: type = import_ref Main//factory, A, loaded [concrete = constants.%A] // CHECK:STDOUT: %Main.B = import_ref Main//factory, B, unloaded // 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.8f24d3.1: = import_ref Main//factory, loc12_10, loaded [concrete = constants.%complete_type] @@ -1311,8 +1285,8 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %Main.import_ref.fbb = import_ref Main//factory, inst26 [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.8d5: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = import_ref Main//factory, loc6_17, loaded [symbolic = @Factory.%assoc0 (constants.%assoc0.35472f.2)] // CHECK:STDOUT: %Main.import_ref.ff7: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = import_ref Main//factory, loc8_31, loaded [symbolic = @Factory.%assoc1 (constants.%assoc1.1fdf32.2)] -// CHECK:STDOUT: %Main.Make: @Factory.%Make.type (%Make.type.598) = import_ref Main//factory, Make, loaded [symbolic = @Factory.%Make (constants.%Make.737)] -// CHECK:STDOUT: %Main.Method: @Factory.%Method.type (%Method.type.7ee) = import_ref Main//factory, Method, loaded [symbolic = @Factory.%Method (constants.%Method.a71)] +// CHECK:STDOUT: %Main.Make = import_ref Main//factory, Make, unloaded +// CHECK:STDOUT: %Main.Method = import_ref Main//factory, Method, unloaded // CHECK:STDOUT: %Main.import_ref.e41 = import_ref Main//factory, loc14_22, unloaded // CHECK:STDOUT: %Main.import_ref.8f24d3.2: = import_ref Main//factory, loc11_10, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.da3 = import_ref Main//factory, inst74 [no loc], unloaded @@ -1321,18 +1295,11 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %Main.import_ref.a27 = import_ref Main//factory, loc15_17, unloaded // CHECK:STDOUT: %Main.import_ref.163 = import_ref Main//factory, loc16_31, unloaded // CHECK:STDOUT: %Main.import_ref.f6b058.2: type = import_ref Main//factory, loc4_19, loaded [symbolic = @Factory.%T (constants.%T)] -// CHECK:STDOUT: %Main.import_ref.91b53a.1: @Factory.%Factory.type (%Factory.type.c96) = import_ref Main//factory, inst26 [no loc], loaded [symbolic = @Factory.%Self (constants.%Self.9ba)] +// CHECK:STDOUT: %Main.import_ref.91b53a.1: @Factory.%Factory.type (%Factory.type.c96) = import_ref Main//factory, inst26 [no loc], loaded [symbolic = @Factory.%Self (constants.%Self)] // CHECK:STDOUT: %Main.import_ref.21018a.1 = import_ref Main//factory, loc6_17, unloaded // CHECK:STDOUT: %Main.import_ref.f6b058.3: type = import_ref Main//factory, loc4_19, loaded [symbolic = @Factory.%T (constants.%T)] -// CHECK:STDOUT: %Main.import_ref.91b53a.2: @Factory.%Factory.type (%Factory.type.c96) = import_ref Main//factory, inst26 [no loc], loaded [symbolic = @Factory.%Self (constants.%Self.9ba)] +// CHECK:STDOUT: %Main.import_ref.91b53a.2: @Factory.%Factory.type (%Factory.type.c96) = import_ref Main//factory, inst26 [no loc], loaded [symbolic = @Factory.%Self (constants.%Self)] // CHECK:STDOUT: %Main.import_ref.46fc3c.1 = import_ref Main//factory, loc8_31, unloaded -// CHECK:STDOUT: %Core.import_ref.ffd566.1: type = import_ref Core//default, loc3_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] -// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst26 [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.43db8b.2)] -// CHECK:STDOUT: %Core.Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, Convert, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] -// CHECK:STDOUT: %Core.import_ref.ffd566.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, inst26 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] -// CHECK:STDOUT: %Core.import_ref.207961.1 = import_ref Core//default, loc4_35, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -1363,7 +1330,7 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %return.patt: %C = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %C = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %C.ref.loc19: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc16: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %a.param: %A = value_param runtime_param0 // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A] // CHECK:STDOUT: %a: %A = bind_name a, %a.param @@ -1378,7 +1345,7 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(%T)> [symbolic = %Factory.type (constants.%Factory.type.c96)] -// CHECK:STDOUT: %Self: %Factory.type.c96 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.9ba)] +// CHECK:STDOUT: %Self: %Factory.type.c96 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] // CHECK:STDOUT: %Make.type: type = fn_type @Make, @Factory(%T) [symbolic = %Make.type (constants.%Make.type.598)] // CHECK:STDOUT: %Make: @Factory.%Make.type (%Make.type.598) = struct_value () [symbolic = %Make (constants.%Make.737)] // CHECK:STDOUT: %Factory.assoc_type: type = assoc_entity_type @Factory.%Factory.type (%Factory.type.c96) [symbolic = %Factory.assoc_type (constants.%Factory.assoc_type.ca7)] @@ -1396,26 +1363,6 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.ffd566.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.207961.1 [symbolic = %assoc0 (constants.%assoc0.43db8b.1)] -// 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: impl @impl: imports.%Main.import_ref.984 as imports.%Main.import_ref.bd2 [from "factory.carbon"] { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Make = imports.%Main.import_ref.a27 @@ -1454,41 +1401,31 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: generic fn @Method(imports.%Main.import_ref.f6b058.3: type, imports.%Main.import_ref.91b53a.2: @Factory.%Factory.type (%Factory.type.c96)) [from "factory.carbon"] { // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(%T)> [symbolic = %Factory.type (constants.%Factory.type.c96)] -// CHECK:STDOUT: %Self: %Factory.type.c96 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.9ba)] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type.56c)] +// CHECK:STDOUT: %Self: %Factory.type.c96 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] +// 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: @Method.%Self.as_type (%Self.as_type.56c)]() -> @Method.%T (%T); +// CHECK:STDOUT: fn[%self.param_patt: @Method.%Self.as_type (%Self.as_type)]() -> @Method.%T (%T); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @MakeC() -> %return.param_patt: %C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A] // CHECK:STDOUT: %Factory.ref: %Factory.type.1a8 = name_ref Factory, imports.%Main.Factory [concrete = constants.%Factory.generic] -// CHECK:STDOUT: %C.ref.loc16: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc13: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%C)> [concrete = constants.%Factory.type.5c5] -// CHECK:STDOUT: %.loc16_23: %Factory.assoc_type.709 = specific_constant imports.%Main.import_ref.8d5, @Factory(constants.%C) [concrete = constants.%assoc0.ef9] -// CHECK:STDOUT: %Make.ref: %Factory.assoc_type.709 = name_ref Make, %.loc16_23 [concrete = constants.%assoc0.ef9] -// CHECK:STDOUT: %.loc16_11: %Factory.type.5c5 = converted %A.ref, [concrete = ] +// CHECK:STDOUT: %.loc13: %Factory.assoc_type.709 = specific_constant imports.%Main.import_ref.8d5, @Factory(constants.%C) [concrete = constants.%assoc0.ef9] +// CHECK:STDOUT: %Make.ref: %Factory.assoc_type.709 = name_ref Make, %.loc13 [concrete = constants.%assoc0.ef9] // CHECK:STDOUT: return to %return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.ffd566.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: fn @InstanceC(%a.param_patt: %A) -> %return.param_patt: %C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: %A = name_ref a, %a // CHECK:STDOUT: %Factory.ref: %Factory.type.1a8 = name_ref Factory, imports.%Main.Factory [concrete = constants.%Factory.generic] -// CHECK:STDOUT: %C.ref.loc24: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc21: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%C)> [concrete = constants.%Factory.type.5c5] -// CHECK:STDOUT: %.loc24: %Factory.assoc_type.709 = specific_constant imports.%Main.import_ref.ff7, @Factory(constants.%C) [concrete = constants.%assoc1.ae5] -// CHECK:STDOUT: %Method.ref: %Factory.assoc_type.709 = name_ref Method, %.loc24 [concrete = constants.%assoc1.ae5] +// CHECK:STDOUT: %.loc21: %Factory.assoc_type.709 = specific_constant imports.%Main.import_ref.ff7, @Factory(constants.%C) [concrete = constants.%assoc1.ae5] +// CHECK:STDOUT: %Method.ref: %Factory.assoc_type.709 = name_ref Method, %.loc21 [concrete = constants.%assoc1.ae5] // CHECK:STDOUT: return to %return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1503,7 +1440,7 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Factory.type => constants.%Factory.type.a5d -// CHECK:STDOUT: %Self => constants.%Self.9ba +// CHECK:STDOUT: %Self => constants.%Self // CHECK:STDOUT: %Make.type => constants.%Make.type.c59 // CHECK:STDOUT: %Make => constants.%Make.efe // CHECK:STDOUT: %Factory.assoc_type => constants.%Factory.assoc_type.668 @@ -1515,17 +1452,17 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: // CHECK:STDOUT: specific @Factory(%T) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Make(constants.%T, constants.%Self.9ba) { +// CHECK:STDOUT: specific @Make(constants.%T, constants.%Self) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Factory(@Method.%T) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Method(constants.%T, constants.%Self.9ba) { +// CHECK:STDOUT: specific @Method(constants.%T, constants.%Self) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: %Factory.type => constants.%Factory.type.c96 -// CHECK:STDOUT: %Self => constants.%Self.9ba -// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type.56c +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Factory(constants.%C) { @@ -1534,7 +1471,7 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Factory.type => constants.%Factory.type.5c5 -// CHECK:STDOUT: %Self => constants.%Self.9ba +// CHECK:STDOUT: %Self => constants.%Self // CHECK:STDOUT: %Make.type => constants.%Make.type.0de // CHECK:STDOUT: %Make => constants.%Make.8ba // CHECK:STDOUT: %Factory.assoc_type => constants.%Factory.assoc_type.709 @@ -1544,32 +1481,3 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %assoc1 => constants.%assoc1.ae5 // 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.%Factory.type.5c5) { -// CHECK:STDOUT: %Dest => constants.%Factory.type.5c5 -// CHECK:STDOUT: %Dest.patt => constants.%Factory.type.5c5 -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.d43 -// CHECK:STDOUT: %Self => constants.%Self.519 -// CHECK:STDOUT: %Convert.type => constants.%Convert.type.9b5 -// CHECK:STDOUT: %Convert => constants.%Convert.8cc -// CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.0f8 -// CHECK:STDOUT: %assoc0 => constants.%assoc0.ae3 -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/no_prelude/compound_member_access.carbon b/toolchain/check/testdata/interface/no_prelude/compound_member_access.carbon index 58506a96afe29..e2887662222d9 100644 --- a/toolchain/check/testdata/interface/no_prelude/compound_member_access.carbon +++ b/toolchain/check/testdata/interface/no_prelude/compound_member_access.carbon @@ -38,6 +38,10 @@ interface J { fn Simple1(T:! J, S:! T.U) {} // This should be equivalent to `Simple1` above, but using compound member access. +// CHECK:STDERR: associated_constant.carbon:[[@LINE+4]]:25: error: cannot access member of interface `J` in type `J` that does not implement that interface [MissingImplInMemberAccess] +// CHECK:STDERR: fn Compound1(V:! J, W:! V.(J.U)) {} +// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fn Compound1(V:! J, W:! V.(J.U)) {} // --- non_instance.carbon @@ -54,6 +58,10 @@ fn Simple2(T:! K1) { // This should be equivalent to `Simple2` above, but using compound member access. fn Compound2(V:! K1) { + // CHECK:STDERR: non_instance.carbon:[[@LINE+4]]:3: error: cannot access member of interface `K1` in type `K1` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: V.(K1.Q1)(); + // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: V.(K1.Q1)(); } @@ -79,10 +87,7 @@ fn Simple3(T:! K2, x: T) { // Compound member access does not. It tries to convert `y` to `K2`, but only // its type `V` can. fn Compound3(V:! K2, y: V) { - // CHECK:STDERR: fail_caller_instance_interface_not.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `V` to `K2` [ImplicitAsConversionFailure] - // CHECK:STDERR: y.(K2.Q2)(); - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_caller_instance_interface_not.carbon:[[@LINE+4]]:3: note: type `V` does not implement interface `Core.ImplicitAs(K2)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_caller_instance_interface_not.carbon:[[@LINE+4]]:3: error: cannot access member of interface `K2` in type `V` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: y.(K2.Q2)(); // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: @@ -188,29 +193,8 @@ impl C as A { // Since `A.G` is a non-instance method, compound member access may only be // used with a type, not an instance. fn Fails() { - // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `C` to `A` [ImplicitAsConversionFailure] - // CHECK:STDERR: ({} as C).((A & A).G)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+4]]:3: note: type `C` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessNote] - // CHECK:STDERR: ({} as C).((A & A).G)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: ({} as C).((A & A).G)(); - // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `C` to `A` [ImplicitAsConversionFailure] - // CHECK:STDERR: (({} as C) as (C as (A & A))).((A & A).G)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+4]]:3: note: type `C` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessNote] - // CHECK:STDERR: (({} as C) as (C as (A & A))).((A & A).G)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: (({} as C) as (C as (A & A))).((A & A).G)(); - // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `C` to `A` [ImplicitAsConversionFailure] - // CHECK:STDERR: (({} as C) as (C as (A & A))).(A.G)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+4]]:3: note: type `C` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessNote] - // CHECK:STDERR: (({} as C) as (C as (A & A))).(A.G)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: (({} as C) as (C as (A & A))).(A.G)(); } @@ -229,8 +213,20 @@ impl C as A { } fn Works() { + // CHECK:STDERR: allowed_combine_non_instance.carbon:[[@LINE+4]]:3: error: cannot access member of interface `A` in type `type` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: C.((A & A).G)(); + // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: C.((A & A).G)(); + // CHECK:STDERR: allowed_combine_non_instance.carbon:[[@LINE+4]]:3: error: cannot access member of interface `A` in type `A` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: (C as (A & A)).((A & A).G)(); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: (C as (A & A)).((A & A).G)(); + // CHECK:STDERR: allowed_combine_non_instance.carbon:[[@LINE+4]]:3: error: cannot access member of interface `A` in type `A` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: (C as (A & A)).(A.G)(); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: (C as (A & A)).(A.G)(); } @@ -562,20 +558,15 @@ fn Works() { // CHECK:STDOUT: %T.patt: %J.type = symbolic_binding_pattern T, 0 [symbolic] // CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic] // CHECK:STDOUT: %T.as_wit: = facet_access_witness %T [symbolic] -// CHECK:STDOUT: %J.facet.70ff88.1: %J.type = facet_value %T.as_type, %T.as_wit [symbolic] -// CHECK:STDOUT: %impl.elem0.f44b07.1: type = impl_witness_access %T.as_wit, element0 [symbolic] -// CHECK:STDOUT: %S: %impl.elem0.f44b07.1 = bind_symbolic_name S, 1 [symbolic] -// CHECK:STDOUT: %S.patt: %impl.elem0.f44b07.1 = symbolic_binding_pattern S, 1 [symbolic] +// CHECK:STDOUT: %J.facet: %J.type = facet_value %T.as_type, %T.as_wit [symbolic] +// CHECK:STDOUT: %impl.elem0: type = impl_witness_access %T.as_wit, element0 [symbolic] +// CHECK:STDOUT: %S: %impl.elem0 = bind_symbolic_name S, 1 [symbolic] +// CHECK:STDOUT: %S.patt: %impl.elem0 = symbolic_binding_pattern S, 1 [symbolic] // CHECK:STDOUT: %Simple1.type: type = fn_type @Simple1 [concrete] // CHECK:STDOUT: %Simple1: %Simple1.type = struct_value () [concrete] // CHECK:STDOUT: %V: %J.type = bind_symbolic_name V, 0 [symbolic] // CHECK:STDOUT: %V.patt: %J.type = symbolic_binding_pattern V, 0 [symbolic] -// CHECK:STDOUT: %V.as_type: type = facet_access_type %V [symbolic] -// CHECK:STDOUT: %V.as_wit: = facet_access_witness %V [symbolic] -// CHECK:STDOUT: %J.facet.70ff88.2: %J.type = facet_value %V.as_type, %V.as_wit [symbolic] -// CHECK:STDOUT: %impl.elem0.f44b07.2: type = impl_witness_access %V.as_wit, element0 [symbolic] -// CHECK:STDOUT: %W: %impl.elem0.f44b07.2 = bind_symbolic_name W, 1 [symbolic] -// CHECK:STDOUT: %W.patt: %impl.elem0.f44b07.2 = symbolic_binding_pattern W, 1 [symbolic] +// CHECK:STDOUT: %W.patt: = symbolic_binding_pattern W, 1 [symbolic] // CHECK:STDOUT: %Compound1.type: type = fn_type @Compound1 [concrete] // CHECK:STDOUT: %Compound1: %Compound1.type = struct_value () [concrete] // CHECK:STDOUT: } @@ -590,41 +581,39 @@ fn Works() { // CHECK:STDOUT: %Simple1.decl: %Simple1.type = fn_decl @Simple1 [concrete = constants.%Simple1] { // CHECK:STDOUT: %T.patt.loc8_12.1: %J.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_12.2 (constants.%T.patt)] // CHECK:STDOUT: %T.param_patt: %J.type = value_param_pattern %T.patt.loc8_12.1, runtime_param [symbolic = %T.patt.loc8_12.2 (constants.%T.patt)] -// CHECK:STDOUT: %S.patt.loc8_19.1: @Simple1.%impl.elem0.loc8_24.2 (%impl.elem0.f44b07.1) = symbolic_binding_pattern S, 1 [symbolic = %S.patt.loc8_19.2 (constants.%S.patt)] -// CHECK:STDOUT: %S.param_patt: @Simple1.%impl.elem0.loc8_24.2 (%impl.elem0.f44b07.1) = value_param_pattern %S.patt.loc8_19.1, runtime_param [symbolic = %S.patt.loc8_19.2 (constants.%S.patt)] +// CHECK:STDOUT: %S.patt.loc8_19.1: @Simple1.%impl.elem0.loc8_24.2 (%impl.elem0) = symbolic_binding_pattern S, 1 [symbolic = %S.patt.loc8_19.2 (constants.%S.patt)] +// CHECK:STDOUT: %S.param_patt: @Simple1.%impl.elem0.loc8_24.2 (%impl.elem0) = value_param_pattern %S.patt.loc8_19.1, runtime_param [symbolic = %S.patt.loc8_19.2 (constants.%S.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %T.param: %J.type = value_param runtime_param // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] // CHECK:STDOUT: %T.loc8_12.1: %J.type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc8_12.2 (constants.%T)] -// CHECK:STDOUT: %S.param: @Simple1.%impl.elem0.loc8_24.2 (%impl.elem0.f44b07.1) = value_param runtime_param -// CHECK:STDOUT: %.loc8_24.1: type = splice_block %impl.elem0.loc8_24.1 [symbolic = %impl.elem0.loc8_24.2 (constants.%impl.elem0.f44b07.1)] { +// CHECK:STDOUT: %S.param: @Simple1.%impl.elem0.loc8_24.2 (%impl.elem0) = value_param runtime_param +// CHECK:STDOUT: %.loc8_24.1: type = splice_block %impl.elem0.loc8_24.1 [symbolic = %impl.elem0.loc8_24.2 (constants.%impl.elem0)] { // CHECK:STDOUT: %T.ref: %J.type = name_ref T, %T.loc8_12.1 [symbolic = %T.loc8_12.2 (constants.%T)] // CHECK:STDOUT: %U.ref: %J.assoc_type = name_ref U, @U.%assoc0 [concrete = constants.%assoc0] // CHECK:STDOUT: %T.as_type.loc8_24.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc8_24.2 (constants.%T.as_type)] // CHECK:STDOUT: %.loc8_24.2: type = converted %T.ref, %T.as_type.loc8_24.1 [symbolic = %T.as_type.loc8_24.2 (constants.%T.as_type)] // CHECK:STDOUT: %T.as_wit.loc8_24.1: = facet_access_witness %T.ref [symbolic = %T.as_wit.loc8_24.2 (constants.%T.as_wit)] -// CHECK:STDOUT: %impl.elem0.loc8_24.1: type = impl_witness_access %T.as_wit.loc8_24.1, element0 [symbolic = %impl.elem0.loc8_24.2 (constants.%impl.elem0.f44b07.1)] +// CHECK:STDOUT: %impl.elem0.loc8_24.1: type = impl_witness_access %T.as_wit.loc8_24.1, element0 [symbolic = %impl.elem0.loc8_24.2 (constants.%impl.elem0)] // CHECK:STDOUT: } -// CHECK:STDOUT: %S.loc8_19.1: @Simple1.%impl.elem0.loc8_24.2 (%impl.elem0.f44b07.1) = bind_symbolic_name S, 1, %S.param [symbolic = %S.loc8_19.2 (constants.%S)] +// CHECK:STDOUT: %S.loc8_19.1: @Simple1.%impl.elem0.loc8_24.2 (%impl.elem0) = bind_symbolic_name S, 1, %S.param [symbolic = %S.loc8_19.2 (constants.%S)] // CHECK:STDOUT: } // CHECK:STDOUT: %Compound1.decl: %Compound1.type = fn_decl @Compound1 [concrete = constants.%Compound1] { -// CHECK:STDOUT: %V.patt.loc11_14.1: %J.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc11_14.2 (constants.%V.patt)] -// CHECK:STDOUT: %V.param_patt: %J.type = value_param_pattern %V.patt.loc11_14.1, runtime_param [symbolic = %V.patt.loc11_14.2 (constants.%V.patt)] -// CHECK:STDOUT: %W.patt.loc11_21.1: @Compound1.%impl.elem0.loc11_26.2 (%impl.elem0.f44b07.2) = symbolic_binding_pattern W, 1 [symbolic = %W.patt.loc11_21.2 (constants.%W.patt)] -// CHECK:STDOUT: %W.param_patt: @Compound1.%impl.elem0.loc11_26.2 (%impl.elem0.f44b07.2) = value_param_pattern %W.patt.loc11_21.1, runtime_param [symbolic = %W.patt.loc11_21.2 (constants.%W.patt)] +// CHECK:STDOUT: %V.patt.loc15_14.1: %J.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc15_14.2 (constants.%V.patt)] +// CHECK:STDOUT: %V.param_patt: %J.type = value_param_pattern %V.patt.loc15_14.1, runtime_param [symbolic = %V.patt.loc15_14.2 (constants.%V.patt)] +// CHECK:STDOUT: %W.patt.loc15_21.1: = symbolic_binding_pattern W, 1 [symbolic = %W.patt.loc15_21.2 (constants.%W.patt)] +// CHECK:STDOUT: %W.param_patt: = value_param_pattern %W.patt.loc15_21.1, runtime_param [concrete = ] // CHECK:STDOUT: } { // CHECK:STDOUT: %V.param: %J.type = value_param runtime_param -// CHECK:STDOUT: %J.ref.loc11_18: type = name_ref J, file.%J.decl [concrete = constants.%J.type] -// CHECK:STDOUT: %V.loc11_14.1: %J.type = bind_symbolic_name V, 0, %V.param [symbolic = %V.loc11_14.2 (constants.%V)] -// CHECK:STDOUT: %W.param: @Compound1.%impl.elem0.loc11_26.2 (%impl.elem0.f44b07.2) = value_param runtime_param -// CHECK:STDOUT: %.loc11: type = splice_block %impl.elem0.loc11_26.1 [symbolic = %impl.elem0.loc11_26.2 (constants.%impl.elem0.f44b07.2)] { -// CHECK:STDOUT: %V.ref: %J.type = name_ref V, %V.loc11_14.1 [symbolic = %V.loc11_14.2 (constants.%V)] -// CHECK:STDOUT: %J.ref.loc11_28: type = name_ref J, file.%J.decl [concrete = constants.%J.type] +// CHECK:STDOUT: %J.ref.loc15_18: type = name_ref J, file.%J.decl [concrete = constants.%J.type] +// CHECK:STDOUT: %V.loc15_14.1: %J.type = bind_symbolic_name V, 0, %V.param [symbolic = %V.loc15_14.2 (constants.%V)] +// CHECK:STDOUT: %W.param: = value_param runtime_param +// CHECK:STDOUT: %.1: = splice_block [concrete = ] { +// CHECK:STDOUT: %V.ref: %J.type = name_ref V, %V.loc15_14.1 [symbolic = %V.loc15_14.2 (constants.%V)] +// CHECK:STDOUT: %J.ref.loc15_28: type = name_ref J, file.%J.decl [concrete = constants.%J.type] // CHECK:STDOUT: %U.ref: %J.assoc_type = name_ref U, @U.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %V.as_wit.loc11_26.1: = facet_access_witness %V.ref [symbolic = %V.as_wit.loc11_26.2 (constants.%V.as_wit)] -// CHECK:STDOUT: %impl.elem0.loc11_26.1: type = impl_witness_access %V.as_wit.loc11_26.1, element0 [symbolic = %impl.elem0.loc11_26.2 (constants.%impl.elem0.f44b07.2)] // CHECK:STDOUT: } -// CHECK:STDOUT: %W.loc11_21.1: @Compound1.%impl.elem0.loc11_26.2 (%impl.elem0.f44b07.2) = bind_symbolic_name W, 1, %W.param [symbolic = %W.loc11_21.2 (constants.%W)] +// CHECK:STDOUT: %W: = bind_symbolic_name W, 1, %W.param [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -644,34 +633,31 @@ fn Works() { // CHECK:STDOUT: assoc_const U:! type; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Simple1(%T.loc8_12.1: %J.type, %S.loc8_19.1: @Simple1.%impl.elem0.loc8_24.2 (%impl.elem0.f44b07.1)) { +// CHECK:STDOUT: generic fn @Simple1(%T.loc8_12.1: %J.type, %S.loc8_19.1: @Simple1.%impl.elem0.loc8_24.2 (%impl.elem0)) { // CHECK:STDOUT: %T.loc8_12.2: %J.type = bind_symbolic_name T, 0 [symbolic = %T.loc8_12.2 (constants.%T)] // CHECK:STDOUT: %T.patt.loc8_12.2: %J.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_12.2 (constants.%T.patt)] // CHECK:STDOUT: %T.as_type.loc8_24.2: type = facet_access_type %T.loc8_12.2 [symbolic = %T.as_type.loc8_24.2 (constants.%T.as_type)] // CHECK:STDOUT: %T.as_wit.loc8_24.2: = facet_access_witness %T.loc8_12.2 [symbolic = %T.as_wit.loc8_24.2 (constants.%T.as_wit)] -// CHECK:STDOUT: %impl.elem0.loc8_24.2: type = impl_witness_access %T.as_wit.loc8_24.2, element0 [symbolic = %impl.elem0.loc8_24.2 (constants.%impl.elem0.f44b07.1)] -// CHECK:STDOUT: %S.loc8_19.2: %impl.elem0.f44b07.1 = bind_symbolic_name S, 1 [symbolic = %S.loc8_19.2 (constants.%S)] -// CHECK:STDOUT: %S.patt.loc8_19.2: %impl.elem0.f44b07.1 = symbolic_binding_pattern S, 1 [symbolic = %S.patt.loc8_19.2 (constants.%S.patt)] +// CHECK:STDOUT: %impl.elem0.loc8_24.2: type = impl_witness_access %T.as_wit.loc8_24.2, element0 [symbolic = %impl.elem0.loc8_24.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %S.loc8_19.2: %impl.elem0 = bind_symbolic_name S, 1 [symbolic = %S.loc8_19.2 (constants.%S)] +// CHECK:STDOUT: %S.patt.loc8_19.2: %impl.elem0 = symbolic_binding_pattern S, 1 [symbolic = %S.patt.loc8_19.2 (constants.%S.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: fn(%T.param_patt: %J.type, %S.param_patt: @Simple1.%impl.elem0.loc8_24.2 (%impl.elem0.f44b07.1)) { +// CHECK:STDOUT: fn(%T.param_patt: %J.type, %S.param_patt: @Simple1.%impl.elem0.loc8_24.2 (%impl.elem0)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Compound1(%V.loc11_14.1: %J.type, %W.loc11_21.1: @Compound1.%impl.elem0.loc11_26.2 (%impl.elem0.f44b07.2)) { -// CHECK:STDOUT: %V.loc11_14.2: %J.type = bind_symbolic_name V, 0 [symbolic = %V.loc11_14.2 (constants.%V)] -// CHECK:STDOUT: %V.patt.loc11_14.2: %J.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc11_14.2 (constants.%V.patt)] -// CHECK:STDOUT: %V.as_wit.loc11_26.2: = facet_access_witness %V.loc11_14.2 [symbolic = %V.as_wit.loc11_26.2 (constants.%V.as_wit)] -// CHECK:STDOUT: %impl.elem0.loc11_26.2: type = impl_witness_access %V.as_wit.loc11_26.2, element0 [symbolic = %impl.elem0.loc11_26.2 (constants.%impl.elem0.f44b07.2)] -// CHECK:STDOUT: %W.loc11_21.2: %impl.elem0.f44b07.2 = bind_symbolic_name W, 1 [symbolic = %W.loc11_21.2 (constants.%W)] -// CHECK:STDOUT: %W.patt.loc11_21.2: %impl.elem0.f44b07.2 = symbolic_binding_pattern W, 1 [symbolic = %W.patt.loc11_21.2 (constants.%W.patt)] +// CHECK:STDOUT: generic fn @Compound1(%V.loc15_14.1: %J.type, %W: ) { +// CHECK:STDOUT: %V.loc15_14.2: %J.type = bind_symbolic_name V, 0 [symbolic = %V.loc15_14.2 (constants.%V)] +// CHECK:STDOUT: %V.patt.loc15_14.2: %J.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc15_14.2 (constants.%V.patt)] +// CHECK:STDOUT: %W.patt.loc15_21.2: = symbolic_binding_pattern W, 1 [symbolic = %W.patt.loc15_21.2 (constants.%W.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: fn(%V.param_patt: %J.type, %W.param_patt: @Compound1.%impl.elem0.loc11_26.2 (%impl.elem0.f44b07.2)) { +// CHECK:STDOUT: fn(%V.param_patt: %J.type, %W.param_patt: ) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -679,27 +665,22 @@ fn Works() { // CHECK:STDOUT: // CHECK:STDOUT: specific @U(constants.%Self) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @U(constants.%J.facet.70ff88.1) {} +// CHECK:STDOUT: specific @U(constants.%J.facet) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Simple1(constants.%T, constants.%S) { // CHECK:STDOUT: %T.loc8_12.2 => constants.%T // CHECK:STDOUT: %T.patt.loc8_12.2 => constants.%T // CHECK:STDOUT: %T.as_type.loc8_24.2 => constants.%T.as_type // CHECK:STDOUT: %T.as_wit.loc8_24.2 => constants.%T.as_wit -// CHECK:STDOUT: %impl.elem0.loc8_24.2 => constants.%impl.elem0.f44b07.1 +// CHECK:STDOUT: %impl.elem0.loc8_24.2 => constants.%impl.elem0 // CHECK:STDOUT: %S.loc8_19.2 => constants.%S // CHECK:STDOUT: %S.patt.loc8_19.2 => constants.%S // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @U(constants.%J.facet.70ff88.2) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Compound1(constants.%V, constants.%W) { -// CHECK:STDOUT: %V.loc11_14.2 => constants.%V -// CHECK:STDOUT: %V.patt.loc11_14.2 => constants.%V -// CHECK:STDOUT: %V.as_wit.loc11_26.2 => constants.%V.as_wit -// CHECK:STDOUT: %impl.elem0.loc11_26.2 => constants.%impl.elem0.f44b07.2 -// CHECK:STDOUT: %W.loc11_21.2 => constants.%W -// CHECK:STDOUT: %W.patt.loc11_21.2 => constants.%W +// CHECK:STDOUT: specific @Compound1(constants.%V, ) { +// CHECK:STDOUT: %V.loc15_14.2 => constants.%V +// CHECK:STDOUT: %V.patt.loc15_14.2 => constants.%V +// CHECK:STDOUT: %W.patt.loc15_21.2 => // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- non_instance.carbon @@ -718,20 +699,14 @@ fn Works() { // CHECK:STDOUT: %Simple2: %Simple2.type = struct_value () [concrete] // CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic] // CHECK:STDOUT: %T.as_wit: = facet_access_witness %T [symbolic] -// CHECK:STDOUT: %K1.facet.5fb678.1: %K1.type = facet_value %T.as_type, %T.as_wit [symbolic] -// CHECK:STDOUT: %.aaf76c.1: type = fn_type_with_self_type %Q1.type, %K1.facet.5fb678.1 [symbolic] -// CHECK:STDOUT: %impl.elem0.3809cc.1: %.aaf76c.1 = impl_witness_access %T.as_wit, element0 [symbolic] -// CHECK:STDOUT: %specific_fn.bc5944.1: = specific_function %impl.elem0.3809cc.1, @Q1(%K1.facet.5fb678.1) [symbolic] +// CHECK:STDOUT: %K1.facet: %K1.type = facet_value %T.as_type, %T.as_wit [symbolic] +// CHECK:STDOUT: %.aaf: type = fn_type_with_self_type %Q1.type, %K1.facet [symbolic] +// CHECK:STDOUT: %impl.elem0: %.aaf = impl_witness_access %T.as_wit, element0 [symbolic] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Q1(%K1.facet) [symbolic] // CHECK:STDOUT: %V: %K1.type = bind_symbolic_name V, 0 [symbolic] // CHECK:STDOUT: %V.patt: %K1.type = symbolic_binding_pattern V, 0 [symbolic] // CHECK:STDOUT: %Compound2.type: type = fn_type @Compound2 [concrete] // CHECK:STDOUT: %Compound2: %Compound2.type = struct_value () [concrete] -// CHECK:STDOUT: %V.as_type: type = facet_access_type %V [symbolic] -// CHECK:STDOUT: %V.as_wit: = facet_access_witness %V [symbolic] -// CHECK:STDOUT: %K1.facet.5fb678.2: %K1.type = facet_value %V.as_type, %V.as_wit [symbolic] -// CHECK:STDOUT: %.aaf76c.2: type = fn_type_with_self_type %Q1.type, %K1.facet.5fb678.2 [symbolic] -// CHECK:STDOUT: %impl.elem0.3809cc.2: %.aaf76c.2 = impl_witness_access %V.as_wit, element0 [symbolic] -// CHECK:STDOUT: %specific_fn.bc5944.2: = specific_function %impl.elem0.3809cc.2, @Q1(%K1.facet.5fb678.2) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -781,10 +756,10 @@ fn Works() { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %T.as_type.loc9_4.2: type = facet_access_type %T.loc8_12.2 [symbolic = %T.as_type.loc9_4.2 (constants.%T.as_type)] // CHECK:STDOUT: %T.as_wit.loc9_4.2: = facet_access_witness %T.loc8_12.2 [symbolic = %T.as_wit.loc9_4.2 (constants.%T.as_wit)] -// CHECK:STDOUT: %K1.facet: %K1.type = facet_value %T.as_type.loc9_4.2, %T.as_wit.loc9_4.2 [symbolic = %K1.facet (constants.%K1.facet.5fb678.1)] -// CHECK:STDOUT: %.loc9_4.2: type = fn_type_with_self_type constants.%Q1.type, %K1.facet [symbolic = %.loc9_4.2 (constants.%.aaf76c.1)] -// CHECK:STDOUT: %impl.elem0.loc9_4.2: @Simple2.%.loc9_4.2 (%.aaf76c.1) = impl_witness_access %T.as_wit.loc9_4.2, element0 [symbolic = %impl.elem0.loc9_4.2 (constants.%impl.elem0.3809cc.1)] -// CHECK:STDOUT: %specific_fn.loc9_4.2: = specific_function %impl.elem0.loc9_4.2, @Q1(%K1.facet) [symbolic = %specific_fn.loc9_4.2 (constants.%specific_fn.bc5944.1)] +// CHECK:STDOUT: %K1.facet: %K1.type = facet_value %T.as_type.loc9_4.2, %T.as_wit.loc9_4.2 [symbolic = %K1.facet (constants.%K1.facet)] +// CHECK:STDOUT: %.loc9_4.2: type = fn_type_with_self_type constants.%Q1.type, %K1.facet [symbolic = %.loc9_4.2 (constants.%.aaf)] +// CHECK:STDOUT: %impl.elem0.loc9_4.2: @Simple2.%.loc9_4.2 (%.aaf) = impl_witness_access %T.as_wit.loc9_4.2, element0 [symbolic = %impl.elem0.loc9_4.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %specific_fn.loc9_4.2: = specific_function %impl.elem0.loc9_4.2, @Q1(%K1.facet) [symbolic = %specific_fn.loc9_4.2 (constants.%specific_fn)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%T.param_patt: %K1.type) { // CHECK:STDOUT: !entry: @@ -793,8 +768,8 @@ fn Works() { // CHECK:STDOUT: %T.as_type.loc9_4.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc9_4.2 (constants.%T.as_type)] // CHECK:STDOUT: %.loc9_4.1: type = converted %T.ref, %T.as_type.loc9_4.1 [symbolic = %T.as_type.loc9_4.2 (constants.%T.as_type)] // CHECK:STDOUT: %T.as_wit.loc9_4.1: = facet_access_witness %T.ref [symbolic = %T.as_wit.loc9_4.2 (constants.%T.as_wit)] -// CHECK:STDOUT: %impl.elem0.loc9_4.1: @Simple2.%.loc9_4.2 (%.aaf76c.1) = impl_witness_access %T.as_wit.loc9_4.1, element0 [symbolic = %impl.elem0.loc9_4.2 (constants.%impl.elem0.3809cc.1)] -// CHECK:STDOUT: %specific_fn.loc9_4.1: = specific_function %impl.elem0.loc9_4.1, @Q1(constants.%K1.facet.5fb678.1) [symbolic = %specific_fn.loc9_4.2 (constants.%specific_fn.bc5944.1)] +// CHECK:STDOUT: %impl.elem0.loc9_4.1: @Simple2.%.loc9_4.2 (%.aaf) = impl_witness_access %T.as_wit.loc9_4.1, element0 [symbolic = %impl.elem0.loc9_4.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %specific_fn.loc9_4.1: = specific_function %impl.elem0.loc9_4.1, @Q1(constants.%K1.facet) [symbolic = %specific_fn.loc9_4.2 (constants.%specific_fn)] // CHECK:STDOUT: %Q1.call: init %empty_tuple.type = call %specific_fn.loc9_4.1() // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -805,22 +780,12 @@ fn Works() { // CHECK:STDOUT: %V.patt.loc13_14.2: %K1.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc13_14.2 (constants.%V.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %V.as_wit.loc14_4.2: = facet_access_witness %V.loc13_14.2 [symbolic = %V.as_wit.loc14_4.2 (constants.%V.as_wit)] -// CHECK:STDOUT: %V.as_type: type = facet_access_type %V.loc13_14.2 [symbolic = %V.as_type (constants.%V.as_type)] -// CHECK:STDOUT: %K1.facet: %K1.type = facet_value %V.as_type, %V.as_wit.loc14_4.2 [symbolic = %K1.facet (constants.%K1.facet.5fb678.2)] -// CHECK:STDOUT: %.loc14: type = fn_type_with_self_type constants.%Q1.type, %K1.facet [symbolic = %.loc14 (constants.%.aaf76c.2)] -// CHECK:STDOUT: %impl.elem0.loc14_4.2: @Compound2.%.loc14 (%.aaf76c.2) = impl_witness_access %V.as_wit.loc14_4.2, element0 [symbolic = %impl.elem0.loc14_4.2 (constants.%impl.elem0.3809cc.2)] -// CHECK:STDOUT: %specific_fn.loc14_4.2: = specific_function %impl.elem0.loc14_4.2, @Q1(%K1.facet) [symbolic = %specific_fn.loc14_4.2 (constants.%specific_fn.bc5944.2)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%V.param_patt: %K1.type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %V.ref: %K1.type = name_ref V, %V.loc13_14.1 [symbolic = %V.loc13_14.2 (constants.%V)] -// CHECK:STDOUT: %K1.ref.loc14: type = name_ref K1, file.%K1.decl [concrete = constants.%K1.type] +// CHECK:STDOUT: %K1.ref.loc18: type = name_ref K1, file.%K1.decl [concrete = constants.%K1.type] // CHECK:STDOUT: %Q1.ref: %K1.assoc_type = name_ref Q1, @K1.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %V.as_wit.loc14_4.1: = facet_access_witness %V.ref [symbolic = %V.as_wit.loc14_4.2 (constants.%V.as_wit)] -// CHECK:STDOUT: %impl.elem0.loc14_4.1: @Compound2.%.loc14 (%.aaf76c.2) = impl_witness_access %V.as_wit.loc14_4.1, element0 [symbolic = %impl.elem0.loc14_4.2 (constants.%impl.elem0.3809cc.2)] -// CHECK:STDOUT: %specific_fn.loc14_4.1: = specific_function %impl.elem0.loc14_4.1, @Q1(constants.%K1.facet.5fb678.2) [symbolic = %specific_fn.loc14_4.2 (constants.%specific_fn.bc5944.2)] -// CHECK:STDOUT: %Q1.call: init %empty_tuple.type = call %specific_fn.loc14_4.1() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -832,7 +797,7 @@ fn Works() { // CHECK:STDOUT: %T.patt.loc8_12.2 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Q1(constants.%K1.facet.5fb678.1) {} +// CHECK:STDOUT: specific @Q1(constants.%K1.facet) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Q1(@Simple2.%K1.facet) {} // CHECK:STDOUT: @@ -841,22 +806,18 @@ fn Works() { // CHECK:STDOUT: %V.patt.loc13_14.2 => constants.%V // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Q1(constants.%K1.facet.5fb678.2) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Q1(@Compound2.%K1.facet) {} -// CHECK:STDOUT: // CHECK:STDOUT: --- fail_caller_instance_interface_not.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %K2.type: type = facet_type <@K2> [concrete] -// CHECK:STDOUT: %Self.0ce: %K2.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self: %K2.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %Q2.type: type = fn_type @Q2 [concrete] // CHECK:STDOUT: %Q2: %Q2.type = struct_value () [concrete] // CHECK:STDOUT: %K2.assoc_type: type = assoc_entity_type %K2.type [concrete] -// CHECK:STDOUT: %assoc0.358: %K2.assoc_type = assoc_entity element0, @K2.%Q2.decl [concrete] -// CHECK:STDOUT: %T.0ce: %K2.type = bind_symbolic_name T, 0 [symbolic] -// CHECK:STDOUT: %T.patt.6d1: %K2.type = symbolic_binding_pattern T, 0 [symbolic] -// CHECK:STDOUT: %T.as_type: type = facet_access_type %T.0ce [symbolic] +// CHECK:STDOUT: %assoc0: %K2.assoc_type = assoc_entity element0, @K2.%Q2.decl [concrete] +// CHECK:STDOUT: %T: %K2.type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.patt: %K2.type = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic] // CHECK:STDOUT: %Simple3.type: type = fn_type @Simple3 [concrete] // CHECK:STDOUT: %Simple3: %Simple3.type = struct_value () [concrete] // CHECK:STDOUT: %require_complete.022e81.1: = require_complete_type %T.as_type [symbolic] @@ -866,51 +827,12 @@ fn Works() { // CHECK:STDOUT: %Compound3.type: type = fn_type @Compound3 [concrete] // CHECK:STDOUT: %Compound3: %Compound3.type = struct_value () [concrete] // CHECK:STDOUT: %require_complete.022e81.2: = require_complete_type %V.as_type [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: type = facet_access_type %Self.519 [symbolic] -// CHECK:STDOUT: %ImplicitAs.assoc_type.837: type = assoc_entity_type %ImplicitAs.type.d62 [symbolic] -// CHECK:STDOUT: %assoc0.43db8b.1: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.1 [symbolic] -// CHECK:STDOUT: %ImplicitAs.type.014: type = facet_type <@ImplicitAs, @ImplicitAs(%K2.type)> [concrete] -// CHECK:STDOUT: %Convert.type.a72: type = fn_type @Convert, @ImplicitAs(%K2.type) [concrete] -// CHECK:STDOUT: %Convert.2ea: %Convert.type.a72 = struct_value () [concrete] -// CHECK:STDOUT: %ImplicitAs.assoc_type.053: type = assoc_entity_type %ImplicitAs.type.014 [concrete] -// CHECK:STDOUT: %assoc0.3e2: %ImplicitAs.assoc_type.053 = assoc_entity element0, imports.%Core.import_ref.207961.1 [concrete] -// CHECK:STDOUT: %assoc0.43db8b.2: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.2 [symbolic] -// CHECK:STDOUT: %BitAnd.type: type = facet_type <@BitAnd> [concrete] -// CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic] -// CHECK:STDOUT: %T.patt.e01: type = symbolic_binding_pattern T, 0 [symbolic] -// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%Core.import_ref.bd4), @impl(%T.8b3) [symbolic] -// CHECK:STDOUT: %Op.type: type = fn_type @Op, @impl(%T.8b3) [symbolic] -// CHECK:STDOUT: %Op: %Op.type = struct_value () [symbolic] -// CHECK:STDOUT: %require_complete.4ae: = require_complete_type %T.8b3 [symbolic] // CHECK:STDOUT: } // 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.ffd566.1: type = import_ref Core//default, loc7_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] -// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst69 [no loc], unloaded -// CHECK:STDOUT: %Core.import_ref.630: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = import_ref Core//default, loc8_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.43db8b.2)] -// CHECK:STDOUT: %Core.Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, Convert, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] -// CHECK:STDOUT: %Core.import_ref.ffd566.2: type = import_ref Core//default, loc7_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] -// CHECK:STDOUT: %Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) = import_ref Core//default, inst69 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] -// CHECK:STDOUT: %Core.import_ref.207961.1 = import_ref Core//default, loc8_35, unloaded -// CHECK:STDOUT: %Core.import_ref.ad0 = import_ref Core//default, inst104 [no loc], unloaded -// CHECK:STDOUT: %Core.import_ref.3bf = import_ref Core//default, loc12_41, unloaded -// CHECK:STDOUT: %Core.Op = import_ref Core//default, Op, unloaded -// CHECK:STDOUT: %Core.import_ref.f80 = import_ref Core//default, loc15_36, unloaded -// CHECK:STDOUT: %Core.import_ref.f6b058.1: type = import_ref Core//default, loc15_14, loaded [symbolic = @impl.%T (constants.%T.8b3)] -// CHECK:STDOUT: %Core.import_ref.601: type = import_ref Core//default, loc15_24, loaded [symbolic = @impl.%T (constants.%T.8b3)] -// CHECK:STDOUT: %Core.import_ref.9c1: type = import_ref Core//default, loc15_29, loaded [concrete = constants.%BitAnd.type] -// CHECK:STDOUT: %Core.import_ref.bd4 = import_ref Core//default, loc16_42, unloaded -// CHECK:STDOUT: %Core.import_ref.f6b058.2: type = import_ref Core//default, loc15_14, loaded [symbolic = @impl.%T (constants.%T.8b3)] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -923,17 +845,17 @@ fn Works() { // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %K2.decl: type = interface_decl @K2 [concrete = constants.%K2.type] {} {} // CHECK:STDOUT: %Simple3.decl: %Simple3.type = fn_decl @Simple3 [concrete = constants.%Simple3] { -// CHECK:STDOUT: %T.patt.loc11_12.1: %K2.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_12.2 (constants.%T.patt.6d1)] -// CHECK:STDOUT: %T.param_patt: %K2.type = value_param_pattern %T.patt.loc11_12.1, runtime_param [symbolic = %T.patt.loc11_12.2 (constants.%T.patt.6d1)] +// CHECK:STDOUT: %T.patt.loc11_12.1: %K2.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_12.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.param_patt: %K2.type = value_param_pattern %T.patt.loc11_12.1, runtime_param [symbolic = %T.patt.loc11_12.2 (constants.%T.patt)] // CHECK:STDOUT: %x.patt: @Simple3.%T.as_type.loc11_23.2 (%T.as_type) = binding_pattern x // CHECK:STDOUT: %x.param_patt: @Simple3.%T.as_type.loc11_23.2 (%T.as_type) = value_param_pattern %x.patt, runtime_param0 // CHECK:STDOUT: } { // CHECK:STDOUT: %T.param: %K2.type = value_param runtime_param // CHECK:STDOUT: %K2.ref: type = name_ref K2, file.%K2.decl [concrete = constants.%K2.type] -// CHECK:STDOUT: %T.loc11_12.1: %K2.type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc11_12.2 (constants.%T.0ce)] +// CHECK:STDOUT: %T.loc11_12.1: %K2.type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc11_12.2 (constants.%T)] // CHECK:STDOUT: %x.param: @Simple3.%T.as_type.loc11_23.2 (%T.as_type) = value_param runtime_param0 // CHECK:STDOUT: %.loc11_23.1: type = splice_block %.loc11_23.2 [symbolic = %T.as_type.loc11_23.2 (constants.%T.as_type)] { -// CHECK:STDOUT: %T.ref: %K2.type = name_ref T, %T.loc11_12.1 [symbolic = %T.loc11_12.2 (constants.%T.0ce)] +// CHECK:STDOUT: %T.ref: %K2.type = name_ref T, %T.loc11_12.1 [symbolic = %T.loc11_12.2 (constants.%T)] // CHECK:STDOUT: %T.as_type.loc11_23.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc11_23.2 (constants.%T.as_type)] // CHECK:STDOUT: %.loc11_23.2: type = converted %T.ref, %T.as_type.loc11_23.1 [symbolic = %T.as_type.loc11_23.2 (constants.%T.as_type)] // CHECK:STDOUT: } @@ -959,9 +881,9 @@ fn Works() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @K2 { -// CHECK:STDOUT: %Self: %K2.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.0ce] +// CHECK:STDOUT: %Self: %K2.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] // CHECK:STDOUT: %Q2.decl: %Q2.type = fn_decl @Q2 [concrete = constants.%Q2] {} {} -// CHECK:STDOUT: %assoc0: %K2.assoc_type = assoc_entity element0, %Q2.decl [concrete = constants.%assoc0.358] +// CHECK:STDOUT: %assoc0: %K2.assoc_type = assoc_entity element0, %Q2.decl [concrete = constants.%assoc0] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self @@ -969,56 +891,13 @@ fn Works() { // CHECK:STDOUT: witness = (%Q2.decl) // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.ffd566.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.207961.1 [symbolic = %assoc0 (constants.%assoc0.43db8b.1)] -// 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: interface @BitAnd [from "core.carbon"] { -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%Core.import_ref.ad0 -// CHECK:STDOUT: .Op = imports.%Core.import_ref.3bf -// CHECK:STDOUT: witness = (imports.%Core.Op) -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic impl @impl(imports.%Core.import_ref.f6b058.1: type) [from "core.carbon"] { -// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T.8b3)] -// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt.e01)] -// CHECK:STDOUT: %impl_witness: = impl_witness (imports.%Core.import_ref.bd4), @impl(%T) [symbolic = %impl_witness (constants.%impl_witness)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Op.type: type = fn_type @Op, @impl(%T) [symbolic = %Op.type (constants.%Op.type)] -// CHECK:STDOUT: %Op: @impl.%Op.type (%Op.type) = struct_value () [symbolic = %Op (constants.%Op)] -// CHECK:STDOUT: %require_complete: = require_complete_type @impl.%T (%T.8b3) [symbolic = %require_complete (constants.%require_complete.4ae)] -// CHECK:STDOUT: -// CHECK:STDOUT: impl: imports.%Core.import_ref.601 as imports.%Core.import_ref.9c1 { -// CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = imports.%Core.import_ref.f80 -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: generic fn @Q2(@K2.%Self: %K2.type) { // CHECK:STDOUT: fn(); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @Simple3(%T.loc11_12.1: %K2.type) { -// CHECK:STDOUT: %T.loc11_12.2: %K2.type = bind_symbolic_name T, 0 [symbolic = %T.loc11_12.2 (constants.%T.0ce)] -// CHECK:STDOUT: %T.patt.loc11_12.2: %K2.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_12.2 (constants.%T.patt.6d1)] +// CHECK:STDOUT: %T.loc11_12.2: %K2.type = bind_symbolic_name T, 0 [symbolic = %T.loc11_12.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc11_12.2: %K2.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_12.2 (constants.%T.patt)] // CHECK:STDOUT: %T.as_type.loc11_23.2: type = facet_access_type %T.loc11_12.2 [symbolic = %T.as_type.loc11_23.2 (constants.%T.as_type)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: @@ -1042,35 +921,17 @@ fn Works() { // CHECK:STDOUT: fn(%V.param_patt: %K2.type, %y.param_patt: @Compound3.%V.as_type.loc21_25.2 (%V.as_type)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %y.ref: @Compound3.%V.as_type.loc21_25.2 (%V.as_type) = name_ref y, %y -// CHECK:STDOUT: %K2.ref.loc29: type = name_ref K2, file.%K2.decl [concrete = constants.%K2.type] -// CHECK:STDOUT: %Q2.ref: %K2.assoc_type = name_ref Q2, @K2.%assoc0 [concrete = constants.%assoc0.358] -// CHECK:STDOUT: %.loc29: %K2.type = converted %y.ref, [concrete = ] +// CHECK:STDOUT: %K2.ref.loc26: type = name_ref K2, file.%K2.decl [concrete = constants.%K2.type] +// CHECK:STDOUT: %Q2.ref: %K2.assoc_type = name_ref Q2, @K2.%assoc0 [concrete = constants.%assoc0] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.ffd566.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 @Op(imports.%Core.import_ref.f6b058.2: type) [from "core.carbon"] { -// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T.8b3)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Op.%T (%T.8b3)](%other.param_patt: @Op.%T (%T.8b3)) -> @Op.%T (%T.8b3) = "type.and"; -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Q2(constants.%Self.0ce) {} +// CHECK:STDOUT: specific @Q2(constants.%Self) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Simple3(constants.%T.0ce) { -// CHECK:STDOUT: %T.loc11_12.2 => constants.%T.0ce -// CHECK:STDOUT: %T.patt.loc11_12.2 => constants.%T.0ce +// CHECK:STDOUT: specific @Simple3(constants.%T) { +// CHECK:STDOUT: %T.loc11_12.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc11_12.2 => constants.%T // CHECK:STDOUT: %T.as_type.loc11_23.2 => constants.%T.as_type // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1080,47 +941,6 @@ fn Works() { // CHECK:STDOUT: %V.as_type.loc21_25.2 => constants.%V.as_type // 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 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(constants.%K2.type) { -// CHECK:STDOUT: %Dest => constants.%K2.type -// CHECK:STDOUT: %Dest.patt => constants.%K2.type -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.014 -// CHECK:STDOUT: %Self => constants.%Self.519 -// CHECK:STDOUT: %Convert.type => constants.%Convert.type.a72 -// CHECK:STDOUT: %Convert => constants.%Convert.2ea -// CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.053 -// CHECK:STDOUT: %assoc0 => constants.%assoc0.3e2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @impl(constants.%T.8b3) { -// CHECK:STDOUT: %T => constants.%T.8b3 -// CHECK:STDOUT: %T.patt => constants.%T.8b3 -// CHECK:STDOUT: %impl_witness => constants.%impl_witness -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @impl(%T) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Op(constants.%T.8b3) { -// CHECK:STDOUT: %T => constants.%T.8b3 -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: --- fail_todo_instance.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -1541,6 +1361,7 @@ fn Works() { // CHECK:STDOUT: %A.type: type = facet_type <@A> [concrete] // CHECK:STDOUT: %Self.31d: %A.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %G.type.c3a: type = fn_type @G.1 [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %G.11a: %G.type.c3a = struct_value () [concrete] // CHECK:STDOUT: %A.assoc_type: type = assoc_entity_type %A.type [concrete] // CHECK:STDOUT: %assoc0.773: %A.assoc_type = assoc_entity element0, @A.%G.decl [concrete] @@ -1558,64 +1379,41 @@ fn Works() { // CHECK:STDOUT: %Self.25f: %BitAnd.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %BitAnd.assoc_type: type = assoc_entity_type %BitAnd.type [concrete] // CHECK:STDOUT: %assoc0.a63: %BitAnd.assoc_type = assoc_entity element0, imports.%Core.import_ref.a93 [concrete] -// CHECK:STDOUT: %Op.type.27a: type = fn_type @Op.1 [concrete] -// CHECK:STDOUT: %Op.ab9: %Op.type.27a = struct_value () [concrete] -// CHECK:STDOUT: %Self.as_type.19f: type = facet_access_type %Self.25f [symbolic] // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic] // CHECK:STDOUT: %impl_witness.db8: = impl_witness (imports.%Core.import_ref.1e6), @impl.f92(%T) [symbolic] -// CHECK:STDOUT: %Op.type.f99: type = fn_type @Op.2, @impl.f92(%T) [symbolic] +// CHECK:STDOUT: %Op.type.f99: type = fn_type @Op.1, @impl.f92(%T) [symbolic] // CHECK:STDOUT: %Op.05a: %Op.type.f99 = struct_value () [symbolic] // CHECK:STDOUT: %require_complete: = require_complete_type %T [symbolic] // CHECK:STDOUT: %impl_witness.3ea: = impl_witness (imports.%Core.import_ref.1e6), @impl.f92(type) [concrete] // CHECK:STDOUT: %impl_witness.b81: = impl_witness (imports.%Core.import_ref.bd4), @impl.f92(%T) [symbolic] -// CHECK:STDOUT: %Op.type.eb8: type = fn_type @Op.2, @impl.f92(type) [concrete] +// CHECK:STDOUT: %Op.type.eb8: type = fn_type @Op.1, @impl.f92(type) [concrete] // CHECK:STDOUT: %Op.444: %Op.type.eb8 = struct_value () [concrete] // CHECK:STDOUT: %complete_type.473: = complete_type_witness type [concrete] +// CHECK:STDOUT: %Op.type.27a: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.25f [symbolic] // CHECK:STDOUT: %BitAnd.facet: %BitAnd.type = facet_value type, %impl_witness.3ea [concrete] // CHECK:STDOUT: %.d4d: type = fn_type_with_self_type %Op.type.27a, %BitAnd.facet [concrete] // CHECK:STDOUT: %Op.bound: = bound_method %A.type, %Op.444 [concrete] -// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.bound, @Op.2(type) [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.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.43db8b.1: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.1 [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.6fc: %ImplicitAs.assoc_type.568 = assoc_entity element0, imports.%Core.import_ref.207961.1 [concrete] -// CHECK:STDOUT: %assoc0.43db8b.2: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207961.2 [symbolic] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.bound, @Op.1(type) [concrete] +// CHECK:STDOUT: %.faa: type = fn_type_with_self_type %G.type.c3a, %A.facet [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .BitAnd = %Core.BitAnd -// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs // CHECK:STDOUT: import Core//default // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import_ref.ad0 = import_ref Core//default, inst104 [no loc], unloaded // CHECK:STDOUT: %Core.import_ref.08d: %BitAnd.assoc_type = import_ref Core//default, loc12_41, loaded [concrete = constants.%assoc0.a63] -// CHECK:STDOUT: %Core.Op: %Op.type.27a = import_ref Core//default, Op, loaded [concrete = constants.%Op.ab9] -// CHECK:STDOUT: %Core.import_ref.040: %BitAnd.type = import_ref Core//default, inst104 [no loc], loaded [symbolic = constants.%Self.25f] +// CHECK:STDOUT: %Core.Op = import_ref Core//default, Op, unloaded // CHECK:STDOUT: %Core.import_ref.51c: = import_ref Core//default, loc15_36, loaded [symbolic = @impl.f92.%impl_witness (constants.%impl_witness.b81)] // CHECK:STDOUT: %Core.import_ref.f6b058.1: type = import_ref Core//default, loc15_14, loaded [symbolic = @impl.f92.%T (constants.%T)] // CHECK:STDOUT: %Core.import_ref.601: type = import_ref Core//default, loc15_24, loaded [symbolic = @impl.f92.%T (constants.%T)] // CHECK:STDOUT: %Core.import_ref.9c1: type = import_ref Core//default, loc15_29, loaded [concrete = constants.%BitAnd.type] // CHECK:STDOUT: %Core.import_ref.1e6: @impl.f92.%Op.type (%Op.type.f99) = import_ref Core//default, loc16_42, loaded [symbolic = @impl.f92.%Op (constants.%Op.05a)] // CHECK:STDOUT: %Core.import_ref.f6b058.2: type = import_ref Core//default, loc15_14, loaded [symbolic = @impl.f92.%T (constants.%T)] -// CHECK:STDOUT: %Core.import_ref.ffd566.1: type = import_ref Core//default, loc7_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] -// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst69 [no loc], unloaded -// CHECK:STDOUT: %Core.import_ref.630: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = import_ref Core//default, loc8_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.43db8b.2)] -// CHECK:STDOUT: %Core.Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, Convert, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] -// CHECK:STDOUT: %Core.import_ref.ffd566.2: type = import_ref Core//default, loc7_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] -// CHECK:STDOUT: %Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) = import_ref Core//default, inst69 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] -// CHECK:STDOUT: %Core.import_ref.207961.1 = import_ref Core//default, loc8_35, unloaded +// CHECK:STDOUT: %Core.import_ref.040: %BitAnd.type = import_ref Core//default, inst104 [no loc], loaded [symbolic = constants.%Self.25f] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -1654,26 +1452,6 @@ fn Works() { // CHECK:STDOUT: witness = (imports.%Core.Op) // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.ffd566.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.207961.1 [symbolic = %assoc0 (constants.%assoc0.43db8b.1)] -// 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: impl @impl.77d: %C.ref as %A.ref { // CHECK:STDOUT: %G.decl: %G.type.486 = fn_decl @G.2 [concrete = constants.%G.001] {} {} // CHECK:STDOUT: @@ -1688,7 +1466,7 @@ fn Works() { // CHECK:STDOUT: %impl_witness: = impl_witness (imports.%Core.import_ref.1e6), @impl.f92(%T) [symbolic = %impl_witness (constants.%impl_witness.db8)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Op.type: type = fn_type @Op.2, @impl.f92(%T) [symbolic = %Op.type (constants.%Op.type.f99)] +// CHECK:STDOUT: %Op.type: type = fn_type @Op.1, @impl.f92(%T) [symbolic = %Op.type (constants.%Op.type.f99)] // CHECK:STDOUT: %Op: @impl.f92.%Op.type (%Op.type.f99) = struct_value () [symbolic = %Op (constants.%Op.05a)] // CHECK:STDOUT: %require_complete: = require_complete_type @impl.f92.%T (%T) [symbolic = %require_complete (constants.%require_complete)] // CHECK:STDOUT: @@ -1717,105 +1495,94 @@ fn Works() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Fails() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc24_5.1: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %C.ref.loc24: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc24_5.2: ref %C = temporary_storage -// CHECK:STDOUT: %.loc24_5.3: init %C = class_init (), %.loc24_5.2 [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc24_5.4: ref %C = temporary %.loc24_5.2, %.loc24_5.3 -// CHECK:STDOUT: %.loc24_7: ref %C = converted %.loc24_5.1, %.loc24_5.4 -// CHECK:STDOUT: %A.ref.loc24_15: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %A.ref.loc24_19: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc24: %.d4d = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] -// CHECK:STDOUT: %bound_method.loc24: = bound_method %A.ref.loc24_15, %impl.elem0.loc24 [concrete = constants.%Op.bound] -// CHECK:STDOUT: %specific_fn.loc24: = specific_function %bound_method.loc24, @Op.2(type) [concrete = constants.%Op.specific_fn] -// CHECK:STDOUT: %type.and.loc24: init type = call %specific_fn.loc24(%A.ref.loc24_15, %A.ref.loc24_19) [concrete = constants.%A.type] -// CHECK:STDOUT: %G.ref.loc24: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.773] -// CHECK:STDOUT: %.loc24_12: %A.type = converted %.loc24_7, [concrete = ] -// CHECK:STDOUT: %.loc32_6.1: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %C.ref.loc32_11: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc32_6.2: ref %C = temporary_storage -// CHECK:STDOUT: %.loc32_6.3: init %C = class_init (), %.loc32_6.2 [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc32_6.4: ref %C = temporary %.loc32_6.2, %.loc32_6.3 -// CHECK:STDOUT: %.loc32_8: ref %C = converted %.loc32_6.1, %.loc32_6.4 -// CHECK:STDOUT: %C.ref.loc32_18: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %A.ref.loc32_24: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %A.ref.loc32_28: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc32_26: %.d4d = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] -// CHECK:STDOUT: %bound_method.loc32_26: = bound_method %A.ref.loc32_24, %impl.elem0.loc32_26 [concrete = constants.%Op.bound] -// CHECK:STDOUT: %specific_fn.loc32_26: = specific_function %bound_method.loc32_26, @Op.2(type) [concrete = constants.%Op.specific_fn] -// CHECK:STDOUT: %type.and.loc32_26: init type = call %specific_fn.loc32_26(%A.ref.loc32_24, %A.ref.loc32_28) [concrete = constants.%A.type] -// CHECK:STDOUT: %.loc32_29.1: type = value_of_initializer %type.and.loc32_26 [concrete = constants.%A.type] -// CHECK:STDOUT: %.loc32_29.2: type = converted %type.and.loc32_26, %.loc32_29.1 [concrete = constants.%A.type] -// CHECK:STDOUT: %A.facet.loc32: %A.type = facet_value constants.%C, constants.%impl_witness.a7a [concrete = constants.%A.facet] -// CHECK:STDOUT: %.loc32_20: %A.type = converted %C.ref.loc32_18, %A.facet.loc32 [concrete = constants.%A.facet] -// CHECK:STDOUT: %as_type.loc32: type = facet_access_type %.loc32_20 [concrete = constants.%C] -// CHECK:STDOUT: %.loc32_30: type = converted %.loc32_20, %as_type.loc32 [concrete = constants.%C] -// CHECK:STDOUT: %A.ref.loc32_35: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %A.ref.loc32_39: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc32_37: %.d4d = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] -// CHECK:STDOUT: %bound_method.loc32_37: = bound_method %A.ref.loc32_35, %impl.elem0.loc32_37 [concrete = constants.%Op.bound] -// CHECK:STDOUT: %specific_fn.loc32_37: = specific_function %bound_method.loc32_37, @Op.2(type) [concrete = constants.%Op.specific_fn] -// CHECK:STDOUT: %type.and.loc32_37: init type = call %specific_fn.loc32_37(%A.ref.loc32_35, %A.ref.loc32_39) [concrete = constants.%A.type] -// CHECK:STDOUT: %G.ref.loc32: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.773] -// CHECK:STDOUT: %.loc32_32: %A.type = converted %.loc32_8, [concrete = ] -// CHECK:STDOUT: %.loc40_6.1: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %C.ref.loc40_11: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc40_6.2: ref %C = temporary_storage -// CHECK:STDOUT: %.loc40_6.3: init %C = class_init (), %.loc40_6.2 [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc40_6.4: ref %C = temporary %.loc40_6.2, %.loc40_6.3 -// CHECK:STDOUT: %.loc40_8: ref %C = converted %.loc40_6.1, %.loc40_6.4 -// CHECK:STDOUT: %C.ref.loc40_18: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %A.ref.loc40_24: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %A.ref.loc40_28: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc40: %.d4d = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] -// CHECK:STDOUT: %bound_method.loc40: = bound_method %A.ref.loc40_24, %impl.elem0.loc40 [concrete = constants.%Op.bound] -// CHECK:STDOUT: %specific_fn.loc40: = specific_function %bound_method.loc40, @Op.2(type) [concrete = constants.%Op.specific_fn] -// CHECK:STDOUT: %type.and.loc40: init type = call %specific_fn.loc40(%A.ref.loc40_24, %A.ref.loc40_28) [concrete = constants.%A.type] -// CHECK:STDOUT: %.loc40_29.1: type = value_of_initializer %type.and.loc40 [concrete = constants.%A.type] -// CHECK:STDOUT: %.loc40_29.2: type = converted %type.and.loc40, %.loc40_29.1 [concrete = constants.%A.type] -// CHECK:STDOUT: %A.facet.loc40: %A.type = facet_value constants.%C, constants.%impl_witness.a7a [concrete = constants.%A.facet] -// CHECK:STDOUT: %.loc40_20: %A.type = converted %C.ref.loc40_18, %A.facet.loc40 [concrete = constants.%A.facet] -// CHECK:STDOUT: %as_type.loc40: type = facet_access_type %.loc40_20 [concrete = constants.%C] -// CHECK:STDOUT: %.loc40_30: type = converted %.loc40_20, %as_type.loc40 [concrete = constants.%C] -// CHECK:STDOUT: %A.ref.loc40_34: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %G.ref.loc40: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.773] -// CHECK:STDOUT: %.loc40_32: %A.type = converted %.loc40_8, [concrete = ] +// CHECK:STDOUT: %.loc17_5.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %C.ref.loc17: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc17_5.2: ref %C = temporary_storage +// CHECK:STDOUT: %.loc17_5.3: init %C = class_init (), %.loc17_5.2 [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc17_5.4: ref %C = temporary %.loc17_5.2, %.loc17_5.3 +// CHECK:STDOUT: %.loc17_7: ref %C = converted %.loc17_5.1, %.loc17_5.4 +// CHECK:STDOUT: %A.ref.loc17_15: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %A.ref.loc17_19: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc17_17: %.d4d = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] +// CHECK:STDOUT: %bound_method.loc17: = bound_method %A.ref.loc17_15, %impl.elem0.loc17_17 [concrete = constants.%Op.bound] +// CHECK:STDOUT: %specific_fn.loc17: = specific_function %bound_method.loc17, @Op.1(type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %type.and.loc17: init type = call %specific_fn.loc17(%A.ref.loc17_15, %A.ref.loc17_19) [concrete = constants.%A.type] +// CHECK:STDOUT: %G.ref.loc17: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.773] +// CHECK:STDOUT: %impl.elem0.loc17_12: %.faa = impl_witness_access constants.%impl_witness.a7a, element0 [concrete = constants.%G.001] +// CHECK:STDOUT: %G.call.loc17: init %empty_tuple.type = call %impl.elem0.loc17_12() +// CHECK:STDOUT: %.loc18_6.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %C.ref.loc18_11: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc18_6.2: ref %C = temporary_storage +// CHECK:STDOUT: %.loc18_6.3: init %C = class_init (), %.loc18_6.2 [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc18_6.4: ref %C = temporary %.loc18_6.2, %.loc18_6.3 +// CHECK:STDOUT: %.loc18_8: ref %C = converted %.loc18_6.1, %.loc18_6.4 +// CHECK:STDOUT: %C.ref.loc18_18: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %A.ref.loc18_24: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %A.ref.loc18_28: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc18_26: %.d4d = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] +// CHECK:STDOUT: %bound_method.loc18_26: = bound_method %A.ref.loc18_24, %impl.elem0.loc18_26 [concrete = constants.%Op.bound] +// CHECK:STDOUT: %specific_fn.loc18_26: = specific_function %bound_method.loc18_26, @Op.1(type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %type.and.loc18_26: init type = call %specific_fn.loc18_26(%A.ref.loc18_24, %A.ref.loc18_28) [concrete = constants.%A.type] +// CHECK:STDOUT: %.loc18_29.1: type = value_of_initializer %type.and.loc18_26 [concrete = constants.%A.type] +// CHECK:STDOUT: %.loc18_29.2: type = converted %type.and.loc18_26, %.loc18_29.1 [concrete = constants.%A.type] +// CHECK:STDOUT: %A.facet.loc18: %A.type = facet_value constants.%C, constants.%impl_witness.a7a [concrete = constants.%A.facet] +// CHECK:STDOUT: %.loc18_20: %A.type = converted %C.ref.loc18_18, %A.facet.loc18 [concrete = constants.%A.facet] +// CHECK:STDOUT: %as_type.loc18: type = facet_access_type %.loc18_20 [concrete = constants.%C] +// CHECK:STDOUT: %.loc18_30: type = converted %.loc18_20, %as_type.loc18 [concrete = constants.%C] +// CHECK:STDOUT: %A.ref.loc18_35: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %A.ref.loc18_39: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc18_37: %.d4d = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] +// CHECK:STDOUT: %bound_method.loc18_37: = bound_method %A.ref.loc18_35, %impl.elem0.loc18_37 [concrete = constants.%Op.bound] +// CHECK:STDOUT: %specific_fn.loc18_37: = specific_function %bound_method.loc18_37, @Op.1(type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %type.and.loc18_37: init type = call %specific_fn.loc18_37(%A.ref.loc18_35, %A.ref.loc18_39) [concrete = constants.%A.type] +// CHECK:STDOUT: %G.ref.loc18: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.773] +// CHECK:STDOUT: %impl.elem0.loc18_32: %.faa = impl_witness_access constants.%impl_witness.a7a, element0 [concrete = constants.%G.001] +// CHECK:STDOUT: %G.call.loc18: init %empty_tuple.type = call %impl.elem0.loc18_32() +// CHECK:STDOUT: %.loc19_6.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %C.ref.loc19_11: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc19_6.2: ref %C = temporary_storage +// CHECK:STDOUT: %.loc19_6.3: init %C = class_init (), %.loc19_6.2 [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc19_6.4: ref %C = temporary %.loc19_6.2, %.loc19_6.3 +// CHECK:STDOUT: %.loc19_8: ref %C = converted %.loc19_6.1, %.loc19_6.4 +// CHECK:STDOUT: %C.ref.loc19_18: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %A.ref.loc19_24: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %A.ref.loc19_28: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc19_26: %.d4d = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] +// CHECK:STDOUT: %bound_method.loc19: = bound_method %A.ref.loc19_24, %impl.elem0.loc19_26 [concrete = constants.%Op.bound] +// CHECK:STDOUT: %specific_fn.loc19: = specific_function %bound_method.loc19, @Op.1(type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %type.and.loc19: init type = call %specific_fn.loc19(%A.ref.loc19_24, %A.ref.loc19_28) [concrete = constants.%A.type] +// CHECK:STDOUT: %.loc19_29.1: type = value_of_initializer %type.and.loc19 [concrete = constants.%A.type] +// CHECK:STDOUT: %.loc19_29.2: type = converted %type.and.loc19, %.loc19_29.1 [concrete = constants.%A.type] +// CHECK:STDOUT: %A.facet.loc19: %A.type = facet_value constants.%C, constants.%impl_witness.a7a [concrete = constants.%A.facet] +// CHECK:STDOUT: %.loc19_20: %A.type = converted %C.ref.loc19_18, %A.facet.loc19 [concrete = constants.%A.facet] +// CHECK:STDOUT: %as_type.loc19: type = facet_access_type %.loc19_20 [concrete = constants.%C] +// CHECK:STDOUT: %.loc19_30: type = converted %.loc19_20, %as_type.loc19 [concrete = constants.%C] +// CHECK:STDOUT: %A.ref.loc19_34: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %G.ref.loc19: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.773] +// CHECK:STDOUT: %impl.elem0.loc19_32: %.faa = impl_witness_access constants.%impl_witness.a7a, element0 [concrete = constants.%G.001] +// CHECK:STDOUT: %G.call.loc19: init %empty_tuple.type = call %impl.elem0.loc19_32() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Op.1(imports.%Core.import_ref.040: %BitAnd.type) [from "core.carbon"] { -// CHECK:STDOUT: %Self: %BitAnd.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.25f)] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type.19f)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Op.1.%Self.as_type (%Self.as_type.19f)](%other.param_patt: @Op.1.%Self.as_type (%Self.as_type.19f)) -> @Op.1.%Self.as_type (%Self.as_type.19f); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Op.2(imports.%Core.import_ref.f6b058.2: type) [from "core.carbon"] { +// CHECK:STDOUT: generic fn @Op.1(imports.%Core.import_ref.f6b058.2: type) [from "core.carbon"] { // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Op.2.%T (%T)](%other.param_patt: @Op.2.%T (%T)) -> @Op.2.%T (%T) = "type.and"; +// CHECK:STDOUT: fn[%self.param_patt: @Op.1.%T (%T)](%other.param_patt: @Op.1.%T (%T)) -> @Op.1.%T (%T) = "type.and"; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.ffd566.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: generic fn @Op.2(imports.%Core.import_ref.040: %BitAnd.type) [from "core.carbon"] { +// CHECK:STDOUT: %Self: %BitAnd.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.25f)] +// 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.40a)]() -> @Convert.%Dest (%Dest); +// CHECK:STDOUT: fn[%self.param_patt: @Op.2.%Self.as_type (%Self.as_type)](%other.param_patt: @Op.2.%Self.as_type (%Self.as_type)) -> @Op.2.%Self.as_type (%Self.as_type); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @G.1(constants.%Self.31d) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @G.1(constants.%A.facet) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Op.1(constants.%Self.25f) { -// CHECK:STDOUT: %Self => constants.%Self.25f -// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type.19f -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: specific @impl.f92(constants.%T) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: %T.patt => constants.%T @@ -1824,7 +1591,7 @@ fn Works() { // CHECK:STDOUT: // CHECK:STDOUT: specific @impl.f92(%T) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Op.2(constants.%T) { +// CHECK:STDOUT: specific @Op.1(constants.%T) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1839,39 +1606,15 @@ fn Works() { // CHECK:STDOUT: %require_complete => constants.%complete_type.473 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Op.2(type) { -// CHECK:STDOUT: %T => type -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// 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: specific @Op.2(constants.%Self.25f) { +// CHECK:STDOUT: %Self => constants.%Self.25f +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type // 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: specific @Op.1(type) { +// CHECK:STDOUT: %T => 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.6fc // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- allowed_combine_non_instance.carbon @@ -1880,7 +1623,6 @@ fn Works() { // CHECK:STDOUT: %A.type: type = facet_type <@A> [concrete] // CHECK:STDOUT: %Self.31d: %A.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %G.type.c3a: type = fn_type @G.1 [concrete] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %G.11a: %G.type.c3a = struct_value () [concrete] // CHECK:STDOUT: %A.assoc_type: type = assoc_entity_type %A.type [concrete] // CHECK:STDOUT: %assoc0.773: %A.assoc_type = assoc_entity element0, @A.%G.decl [concrete] @@ -1897,25 +1639,23 @@ fn Works() { // CHECK:STDOUT: %Self.25f: %BitAnd.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %BitAnd.assoc_type: type = assoc_entity_type %BitAnd.type [concrete] // CHECK:STDOUT: %assoc0.a63: %BitAnd.assoc_type = assoc_entity element0, imports.%Core.import_ref.a93 [concrete] -// CHECK:STDOUT: %Op.type.27a: type = fn_type @Op.1 [concrete] -// CHECK:STDOUT: %Op.ab9: %Op.type.27a = struct_value () [concrete] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.25f [symbolic] // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic] // CHECK:STDOUT: %impl_witness.db8: = impl_witness (imports.%Core.import_ref.1e6), @impl.f92(%T) [symbolic] -// CHECK:STDOUT: %Op.type.f99: type = fn_type @Op.2, @impl.f92(%T) [symbolic] +// CHECK:STDOUT: %Op.type.f99: type = fn_type @Op.1, @impl.f92(%T) [symbolic] // CHECK:STDOUT: %Op.05a: %Op.type.f99 = struct_value () [symbolic] // CHECK:STDOUT: %require_complete: = require_complete_type %T [symbolic] // CHECK:STDOUT: %impl_witness.3ea: = impl_witness (imports.%Core.import_ref.1e6), @impl.f92(type) [concrete] // CHECK:STDOUT: %impl_witness.b81: = impl_witness (imports.%Core.import_ref.bd4), @impl.f92(%T) [symbolic] -// CHECK:STDOUT: %Op.type.eb8: type = fn_type @Op.2, @impl.f92(type) [concrete] +// CHECK:STDOUT: %Op.type.eb8: type = fn_type @Op.1, @impl.f92(type) [concrete] // CHECK:STDOUT: %Op.444: %Op.type.eb8 = struct_value () [concrete] // CHECK:STDOUT: %complete_type.473: = complete_type_witness type [concrete] +// CHECK:STDOUT: %Op.type.27a: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.25f [symbolic] // CHECK:STDOUT: %BitAnd.facet: %BitAnd.type = facet_value type, %impl_witness.3ea [concrete] // CHECK:STDOUT: %.d4d: type = fn_type_with_self_type %Op.type.27a, %BitAnd.facet [concrete] // CHECK:STDOUT: %Op.bound: = bound_method %A.type, %Op.444 [concrete] -// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.bound, @Op.2(type) [concrete] -// CHECK:STDOUT: %.faa: type = fn_type_with_self_type %G.type.c3a, %A.facet [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.bound, @Op.1(type) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -1925,14 +1665,14 @@ fn Works() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import_ref.ad0 = import_ref Core//default, inst104 [no loc], unloaded // CHECK:STDOUT: %Core.import_ref.08d: %BitAnd.assoc_type = import_ref Core//default, loc12_41, loaded [concrete = constants.%assoc0.a63] -// CHECK:STDOUT: %Core.Op: %Op.type.27a = import_ref Core//default, Op, loaded [concrete = constants.%Op.ab9] -// CHECK:STDOUT: %Core.import_ref.040: %BitAnd.type = import_ref Core//default, inst104 [no loc], loaded [symbolic = constants.%Self.25f] +// CHECK:STDOUT: %Core.Op = import_ref Core//default, Op, unloaded // CHECK:STDOUT: %Core.import_ref.51c: = import_ref Core//default, loc15_36, loaded [symbolic = @impl.f92.%impl_witness (constants.%impl_witness.b81)] // CHECK:STDOUT: %Core.import_ref.f6b058.1: type = import_ref Core//default, loc15_14, loaded [symbolic = @impl.f92.%T (constants.%T)] // CHECK:STDOUT: %Core.import_ref.601: type = import_ref Core//default, loc15_24, loaded [symbolic = @impl.f92.%T (constants.%T)] // CHECK:STDOUT: %Core.import_ref.9c1: type = import_ref Core//default, loc15_29, loaded [concrete = constants.%BitAnd.type] // CHECK:STDOUT: %Core.import_ref.1e6: @impl.f92.%Op.type (%Op.type.f99) = import_ref Core//default, loc16_42, loaded [symbolic = @impl.f92.%Op (constants.%Op.05a)] // CHECK:STDOUT: %Core.import_ref.f6b058.2: type = import_ref Core//default, loc15_14, loaded [symbolic = @impl.f92.%T (constants.%T)] +// CHECK:STDOUT: %Core.import_ref.040: %BitAnd.type = import_ref Core//default, inst104 [no loc], loaded [symbolic = constants.%Self.25f] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -1985,7 +1725,7 @@ fn Works() { // CHECK:STDOUT: %impl_witness: = impl_witness (imports.%Core.import_ref.1e6), @impl.f92(%T) [symbolic = %impl_witness (constants.%impl_witness.db8)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Op.type: type = fn_type @Op.2, @impl.f92(%T) [symbolic = %Op.type (constants.%Op.type.f99)] +// CHECK:STDOUT: %Op.type: type = fn_type @Op.1, @impl.f92(%T) [symbolic = %Op.type (constants.%Op.type.f99)] // CHECK:STDOUT: %Op: @impl.f92.%Op.type (%Op.type.f99) = struct_value () [symbolic = %Op (constants.%Op.05a)] // CHECK:STDOUT: %require_complete: = require_complete_type @impl.f92.%T (%T) [symbolic = %require_complete (constants.%require_complete)] // CHECK:STDOUT: @@ -2014,83 +1754,67 @@ fn Works() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Works() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %C.ref.loc15: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %A.ref.loc15_7: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %A.ref.loc15_11: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc15_9: %.d4d = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] -// CHECK:STDOUT: %bound_method.loc15: = bound_method %A.ref.loc15_7, %impl.elem0.loc15_9 [concrete = constants.%Op.bound] -// CHECK:STDOUT: %specific_fn.loc15: = specific_function %bound_method.loc15, @Op.2(type) [concrete = constants.%Op.specific_fn] -// CHECK:STDOUT: %type.and.loc15: init type = call %specific_fn.loc15(%A.ref.loc15_7, %A.ref.loc15_11) [concrete = constants.%A.type] -// CHECK:STDOUT: %G.ref.loc15: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.773] -// CHECK:STDOUT: %A.facet.loc15: %A.type = facet_value constants.%C, constants.%impl_witness.a7a [concrete = constants.%A.facet] -// CHECK:STDOUT: %.loc15: %A.type = converted %C.ref.loc15, %A.facet.loc15 [concrete = constants.%A.facet] -// CHECK:STDOUT: %as_wit.loc15: = facet_access_witness %.loc15 [concrete = constants.%impl_witness.a7a] -// CHECK:STDOUT: %impl.elem0.loc15_4: %.faa = impl_witness_access %as_wit.loc15, element0 [concrete = constants.%G.001] -// CHECK:STDOUT: %G.call.loc15: init %empty_tuple.type = call %impl.elem0.loc15_4() -// CHECK:STDOUT: %C.ref.loc16: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %A.ref.loc16_10: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %A.ref.loc16_14: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc16_12: %.d4d = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] -// CHECK:STDOUT: %bound_method.loc16_12: = bound_method %A.ref.loc16_10, %impl.elem0.loc16_12 [concrete = constants.%Op.bound] -// CHECK:STDOUT: %specific_fn.loc16_12: = specific_function %bound_method.loc16_12, @Op.2(type) [concrete = constants.%Op.specific_fn] -// CHECK:STDOUT: %type.and.loc16_12: init type = call %specific_fn.loc16_12(%A.ref.loc16_10, %A.ref.loc16_14) [concrete = constants.%A.type] -// CHECK:STDOUT: %.loc16_15.1: type = value_of_initializer %type.and.loc16_12 [concrete = constants.%A.type] -// CHECK:STDOUT: %.loc16_15.2: type = converted %type.and.loc16_12, %.loc16_15.1 [concrete = constants.%A.type] -// CHECK:STDOUT: %A.facet.loc16: %A.type = facet_value constants.%C, constants.%impl_witness.a7a [concrete = constants.%A.facet] -// CHECK:STDOUT: %.loc16_6: %A.type = converted %C.ref.loc16, %A.facet.loc16 [concrete = constants.%A.facet] -// CHECK:STDOUT: %A.ref.loc16_20: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %A.ref.loc16_24: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc16_22: %.d4d = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] -// CHECK:STDOUT: %bound_method.loc16_22: = bound_method %A.ref.loc16_20, %impl.elem0.loc16_22 [concrete = constants.%Op.bound] -// CHECK:STDOUT: %specific_fn.loc16_22: = specific_function %bound_method.loc16_22, @Op.2(type) [concrete = constants.%Op.specific_fn] -// CHECK:STDOUT: %type.and.loc16_22: init type = call %specific_fn.loc16_22(%A.ref.loc16_20, %A.ref.loc16_24) [concrete = constants.%A.type] -// CHECK:STDOUT: %G.ref.loc16: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.773] -// CHECK:STDOUT: %as_wit.loc16: = facet_access_witness %.loc16_6 [concrete = constants.%impl_witness.a7a] -// CHECK:STDOUT: %impl.elem0.loc16_17: %.faa = impl_witness_access %as_wit.loc16, element0 [concrete = constants.%G.001] -// CHECK:STDOUT: %G.call.loc16: init %empty_tuple.type = call %impl.elem0.loc16_17() -// CHECK:STDOUT: %C.ref.loc17: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %A.ref.loc17_10: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %A.ref.loc17_14: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc17_12: %.d4d = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] -// CHECK:STDOUT: %bound_method.loc17: = bound_method %A.ref.loc17_10, %impl.elem0.loc17_12 [concrete = constants.%Op.bound] -// CHECK:STDOUT: %specific_fn.loc17: = specific_function %bound_method.loc17, @Op.2(type) [concrete = constants.%Op.specific_fn] -// CHECK:STDOUT: %type.and.loc17: init type = call %specific_fn.loc17(%A.ref.loc17_10, %A.ref.loc17_14) [concrete = constants.%A.type] -// CHECK:STDOUT: %.loc17_15.1: type = value_of_initializer %type.and.loc17 [concrete = constants.%A.type] -// CHECK:STDOUT: %.loc17_15.2: type = converted %type.and.loc17, %.loc17_15.1 [concrete = constants.%A.type] -// CHECK:STDOUT: %A.facet.loc17: %A.type = facet_value constants.%C, constants.%impl_witness.a7a [concrete = constants.%A.facet] -// CHECK:STDOUT: %.loc17_6: %A.type = converted %C.ref.loc17, %A.facet.loc17 [concrete = constants.%A.facet] -// CHECK:STDOUT: %A.ref.loc17_19: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %G.ref.loc17: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.773] -// CHECK:STDOUT: %as_wit.loc17: = facet_access_witness %.loc17_6 [concrete = constants.%impl_witness.a7a] -// CHECK:STDOUT: %impl.elem0.loc17_17: %.faa = impl_witness_access %as_wit.loc17, element0 [concrete = constants.%G.001] -// CHECK:STDOUT: %G.call.loc17: init %empty_tuple.type = call %impl.elem0.loc17_17() +// CHECK:STDOUT: %C.ref.loc19: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %A.ref.loc19_7: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %A.ref.loc19_11: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc19: %.d4d = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] +// CHECK:STDOUT: %bound_method.loc19: = bound_method %A.ref.loc19_7, %impl.elem0.loc19 [concrete = constants.%Op.bound] +// CHECK:STDOUT: %specific_fn.loc19: = specific_function %bound_method.loc19, @Op.1(type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %type.and.loc19: init type = call %specific_fn.loc19(%A.ref.loc19_7, %A.ref.loc19_11) [concrete = constants.%A.type] +// CHECK:STDOUT: %G.ref.loc19: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.773] +// CHECK:STDOUT: %C.ref.loc24: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %A.ref.loc24_10: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %A.ref.loc24_14: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc24_12: %.d4d = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] +// CHECK:STDOUT: %bound_method.loc24_12: = bound_method %A.ref.loc24_10, %impl.elem0.loc24_12 [concrete = constants.%Op.bound] +// CHECK:STDOUT: %specific_fn.loc24_12: = specific_function %bound_method.loc24_12, @Op.1(type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %type.and.loc24_12: init type = call %specific_fn.loc24_12(%A.ref.loc24_10, %A.ref.loc24_14) [concrete = constants.%A.type] +// CHECK:STDOUT: %.loc24_15.1: type = value_of_initializer %type.and.loc24_12 [concrete = constants.%A.type] +// CHECK:STDOUT: %.loc24_15.2: type = converted %type.and.loc24_12, %.loc24_15.1 [concrete = constants.%A.type] +// CHECK:STDOUT: %A.facet.loc24: %A.type = facet_value constants.%C, constants.%impl_witness.a7a [concrete = constants.%A.facet] +// CHECK:STDOUT: %.loc24_6: %A.type = converted %C.ref.loc24, %A.facet.loc24 [concrete = constants.%A.facet] +// CHECK:STDOUT: %A.ref.loc24_20: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %A.ref.loc24_24: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc24_22: %.d4d = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] +// CHECK:STDOUT: %bound_method.loc24_22: = bound_method %A.ref.loc24_20, %impl.elem0.loc24_22 [concrete = constants.%Op.bound] +// CHECK:STDOUT: %specific_fn.loc24_22: = specific_function %bound_method.loc24_22, @Op.1(type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %type.and.loc24_22: init type = call %specific_fn.loc24_22(%A.ref.loc24_20, %A.ref.loc24_24) [concrete = constants.%A.type] +// CHECK:STDOUT: %G.ref.loc24: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.773] +// CHECK:STDOUT: %C.ref.loc29: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %A.ref.loc29_10: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %A.ref.loc29_14: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc29: %.d4d = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] +// CHECK:STDOUT: %bound_method.loc29: = bound_method %A.ref.loc29_10, %impl.elem0.loc29 [concrete = constants.%Op.bound] +// CHECK:STDOUT: %specific_fn.loc29: = specific_function %bound_method.loc29, @Op.1(type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %type.and.loc29: init type = call %specific_fn.loc29(%A.ref.loc29_10, %A.ref.loc29_14) [concrete = constants.%A.type] +// CHECK:STDOUT: %.loc29_15.1: type = value_of_initializer %type.and.loc29 [concrete = constants.%A.type] +// CHECK:STDOUT: %.loc29_15.2: type = converted %type.and.loc29, %.loc29_15.1 [concrete = constants.%A.type] +// CHECK:STDOUT: %A.facet.loc29: %A.type = facet_value constants.%C, constants.%impl_witness.a7a [concrete = constants.%A.facet] +// CHECK:STDOUT: %.loc29_6: %A.type = converted %C.ref.loc29, %A.facet.loc29 [concrete = constants.%A.facet] +// CHECK:STDOUT: %A.ref.loc29_19: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %G.ref.loc29: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.773] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Op.1(imports.%Core.import_ref.040: %BitAnd.type) [from "core.carbon"] { -// CHECK:STDOUT: %Self: %BitAnd.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.25f)] -// 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: @Op.1.%Self.as_type (%Self.as_type)](%other.param_patt: @Op.1.%Self.as_type (%Self.as_type)) -> @Op.1.%Self.as_type (%Self.as_type); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Op.2(imports.%Core.import_ref.f6b058.2: type) [from "core.carbon"] { +// CHECK:STDOUT: generic fn @Op.1(imports.%Core.import_ref.f6b058.2: type) [from "core.carbon"] { // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Op.2.%T (%T)](%other.param_patt: @Op.2.%T (%T)) -> @Op.2.%T (%T) = "type.and"; +// CHECK:STDOUT: fn[%self.param_patt: @Op.1.%T (%T)](%other.param_patt: @Op.1.%T (%T)) -> @Op.1.%T (%T) = "type.and"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Op.2(imports.%Core.import_ref.040: %BitAnd.type) [from "core.carbon"] { +// CHECK:STDOUT: %Self: %BitAnd.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.25f)] +// 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: @Op.2.%Self.as_type (%Self.as_type)](%other.param_patt: @Op.2.%Self.as_type (%Self.as_type)) -> @Op.2.%Self.as_type (%Self.as_type); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @G.1(constants.%Self.31d) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @G.1(constants.%A.facet) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Op.1(constants.%Self.25f) { -// CHECK:STDOUT: %Self => constants.%Self.25f -// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: specific @impl.f92(constants.%T) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: %T.patt => constants.%T @@ -2099,7 +1823,7 @@ fn Works() { // CHECK:STDOUT: // CHECK:STDOUT: specific @impl.f92(%T) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Op.2(constants.%T) { +// CHECK:STDOUT: specific @Op.1(constants.%T) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: @@ -2114,7 +1838,12 @@ fn Works() { // CHECK:STDOUT: %require_complete => constants.%complete_type.473 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Op.2(type) { +// CHECK:STDOUT: specific @Op.2(constants.%Self.25f) { +// CHECK:STDOUT: %Self => constants.%Self.25f +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Op.1(type) { // CHECK:STDOUT: %T => type // CHECK:STDOUT: // CHECK:STDOUT: !definition: diff --git a/toolchain/check/testdata/interface/no_prelude/fail_member_lookup.carbon b/toolchain/check/testdata/interface/no_prelude/fail_member_lookup.carbon index 1180ee7ae189a..5e48095c927c8 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_member_lookup.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_member_lookup.carbon @@ -45,10 +45,7 @@ fn F() { interface Different {} -// CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+7]]:24: error: cannot implicitly convert from `Different` to `Interface` [ImplicitAsConversionFailure] -// CHECK:STDERR: fn G(U:! Different) -> U.(Interface.T); -// CHECK:STDERR: ^~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+4]]:24: note: type `Different` does not implement interface `Core.ImplicitAs(Interface)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+4]]:24: error: cannot access member of interface `Interface` in type `Different` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: fn G(U:! Different) -> U.(Interface.T); // CHECK:STDERR: ^~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -181,11 +178,6 @@ fn G(U:! Different) -> U.(Interface.T); // CHECK:STDOUT: %Self.e7f: %Different.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %U: %Different.type = bind_symbolic_name U, 0 [symbolic] // CHECK:STDOUT: %U.patt: %Different.type = symbolic_binding_pattern U, 0 [symbolic] -// CHECK:STDOUT: %ImplicitAs.type.55e: type = facet_type <@ImplicitAs, @ImplicitAs(%Interface.type)> [concrete] -// CHECK:STDOUT: %Convert.type.2bc: type = fn_type @Convert, @ImplicitAs(%Interface.type) [concrete] -// CHECK:STDOUT: %Convert.6b1: %Convert.type.2bc = struct_value () [concrete] -// CHECK:STDOUT: %ImplicitAs.assoc_type.62c: type = assoc_entity_type %ImplicitAs.type.55e [concrete] -// CHECK:STDOUT: %assoc0.b1f: %ImplicitAs.assoc_type.62c = assoc_entity element0, imports.%Core.import_ref.207961.1 [concrete] // CHECK:STDOUT: %G.type: type = fn_type @G [concrete] // CHECK:STDOUT: %G: %G.type = struct_value () [concrete] // CHECK:STDOUT: } @@ -198,7 +190,7 @@ fn G(U:! Different) -> U.(Interface.T); // CHECK:STDOUT: %Core.import_ref.ffd566.1: type = import_ref Core//default, loc3_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] // CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst26 [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.43db8b.2)] -// CHECK:STDOUT: %Core.Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, Convert, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] +// CHECK:STDOUT: %Core.Convert = import_ref Core//default, Convert, unloaded // CHECK:STDOUT: %Core.import_ref.ffd566.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, inst26 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] // CHECK:STDOUT: %Core.import_ref.207961.1 = import_ref Core//default, loc4_35, unloaded @@ -217,18 +209,17 @@ fn G(U:! Different) -> U.(Interface.T); // CHECK:STDOUT: %F.decl: %F.type.b25 = fn_decl @F.2 [concrete = constants.%F.c41] {} {} // CHECK:STDOUT: %Different.decl: type = interface_decl @Different [concrete = constants.%Different.type] {} {} // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] { -// CHECK:STDOUT: %U.patt.loc37_6.1: %Different.type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc37_6.2 (constants.%U.patt)] -// CHECK:STDOUT: %U.param_patt: %Different.type = value_param_pattern %U.patt.loc37_6.1, runtime_param [symbolic = %U.patt.loc37_6.2 (constants.%U.patt)] +// CHECK:STDOUT: %U.patt.loc34_6.1: %Different.type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc34_6.2 (constants.%U.patt)] +// CHECK:STDOUT: %U.param_patt: %Different.type = value_param_pattern %U.patt.loc34_6.1, runtime_param [symbolic = %U.patt.loc34_6.2 (constants.%U.patt)] // CHECK:STDOUT: %return.patt: = return_slot_pattern // CHECK:STDOUT: %return.param_patt: = out_param_pattern %return.patt, runtime_param0 // CHECK:STDOUT: } { -// CHECK:STDOUT: %U.ref: %Different.type = name_ref U, %U.loc37_6.1 [symbolic = %U.loc37_6.2 (constants.%U)] +// CHECK:STDOUT: %U.ref: %Different.type = name_ref U, %U.loc34_6.1 [symbolic = %U.loc34_6.2 (constants.%U)] // CHECK:STDOUT: %Interface.ref: type = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.type] // CHECK:STDOUT: %T.ref: %Interface.assoc_type = name_ref T, @T.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: %.loc37: %Interface.type = converted %U.ref, [concrete = ] // CHECK:STDOUT: %U.param: %Different.type = value_param runtime_param // CHECK:STDOUT: %Different.ref: type = name_ref Different, file.%Different.decl [concrete = constants.%Different.type] -// CHECK:STDOUT: %U.loc37_6.1: %Different.type = bind_symbolic_name U, 0, %U.param [symbolic = %U.loc37_6.2 (constants.%U)] +// CHECK:STDOUT: %U.loc34_6.1: %Different.type = bind_symbolic_name U, 0, %U.param [symbolic = %U.loc34_6.2 (constants.%U)] // CHECK:STDOUT: %return.param: ref = out_param runtime_param0 // CHECK:STDOUT: %return: ref = return_slot %return.param // CHECK:STDOUT: } @@ -312,9 +303,9 @@ fn G(U:! Different) -> U.(Interface.T); // CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type (%Self.as_type)]() -> @Convert.%Dest (%Dest); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @G(%U.loc37_6.1: %Different.type) { -// CHECK:STDOUT: %U.loc37_6.2: %Different.type = bind_symbolic_name U, 0 [symbolic = %U.loc37_6.2 (constants.%U)] -// CHECK:STDOUT: %U.patt.loc37_6.2: %Different.type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc37_6.2 (constants.%U.patt)] +// CHECK:STDOUT: generic fn @G(%U.loc34_6.1: %Different.type) { +// CHECK:STDOUT: %U.loc34_6.2: %Different.type = bind_symbolic_name U, 0 [symbolic = %U.loc34_6.2 (constants.%U)] +// CHECK:STDOUT: %U.patt.loc34_6.2: %Different.type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc34_6.2 (constants.%U.patt)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%U.param_patt: %Different.type) -> ; // CHECK:STDOUT: } @@ -352,21 +343,8 @@ fn G(U:! Different) -> U.(Interface.T); // CHECK:STDOUT: %assoc0 => constants.%assoc0.536 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(constants.%Interface.type) { -// CHECK:STDOUT: %Dest => constants.%Interface.type -// CHECK:STDOUT: %Dest.patt => constants.%Interface.type -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.55e -// CHECK:STDOUT: %Self => constants.%Self.519 -// CHECK:STDOUT: %Convert.type => constants.%Convert.type.2bc -// CHECK:STDOUT: %Convert => constants.%Convert.6b1 -// CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.62c -// CHECK:STDOUT: %assoc0 => constants.%assoc0.b1f -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: specific @G(constants.%U) { -// CHECK:STDOUT: %U.loc37_6.2 => constants.%U -// CHECK:STDOUT: %U.patt.loc37_6.2 => constants.%U +// CHECK:STDOUT: %U.loc34_6.2 => constants.%U +// CHECK:STDOUT: %U.patt.loc34_6.2 => constants.%U // CHECK:STDOUT: } // CHECK:STDOUT: From ea4167d44ef2604e08e0f0fd9868c863e15f8fb9 Mon Sep 17 00:00:00 2001 From: Josh L Date: Mon, 3 Mar 2025 16:59:32 +0000 Subject: [PATCH 5/8] Mark tests todo/fail --- .../impl/lookup/no_prelude/subtyping.carbon | 10 +++---- .../testdata/impl/no_prelude/compound.carbon | 14 +++++----- .../impl/no_prelude/import_compound.carbon | 14 +++++----- .../impl/no_prelude/interface_args.carbon | 6 ++--- .../no_prelude/compound_member_access.carbon | 26 +++++++++---------- 5 files changed, 34 insertions(+), 36 deletions(-) diff --git a/toolchain/check/testdata/impl/lookup/no_prelude/subtyping.carbon b/toolchain/check/testdata/impl/lookup/no_prelude/subtyping.carbon index eba2dfcfb5d6b..8cb9d5133d12c 100644 --- a/toolchain/check/testdata/impl/lookup/no_prelude/subtyping.carbon +++ b/toolchain/check/testdata/impl/lookup/no_prelude/subtyping.carbon @@ -8,9 +8,7 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/lookup/no_prelude/subtyping.carbon -// This is testing `FindWitnessInFacet` from impl_lookup.cpp - -// --- equivalent.carbon +// --- fail_todo_equivalent.carbon library "[[@TEST_NAME]]"; interface A {} @@ -18,17 +16,17 @@ interface A {} fn TakesA[T:! A](x: T) {} fn WithExtraWhere[U:! A where .Self impls type](y: U) { - // CHECK:STDERR: equivalent.carbon:[[@LINE+7]]:3: error: `Core.ImplicitAs` implicitly referenced here, but package `Core` not found [CoreNotFound] + // CHECK:STDERR: fail_todo_equivalent.carbon:[[@LINE+7]]:3: error: `Core.ImplicitAs` implicitly referenced here, but package `Core` not found [CoreNotFound] // CHECK:STDERR: TakesA(y); // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: equivalent.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: fail_todo_equivalent.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] // CHECK:STDERR: fn TakesA[T:! A](x: T) {} // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: TakesA(y); } -// CHECK:STDOUT: --- equivalent.carbon +// CHECK:STDOUT: --- fail_todo_equivalent.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %A.type: type = facet_type <@A> [concrete] diff --git a/toolchain/check/testdata/impl/no_prelude/compound.carbon b/toolchain/check/testdata/impl/no_prelude/compound.carbon index f95fed0273ac7..685d4033d27fb 100644 --- a/toolchain/check/testdata/impl/no_prelude/compound.carbon +++ b/toolchain/check/testdata/impl/no_prelude/compound.carbon @@ -8,7 +8,7 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/no_prelude/compound.carbon -// --- non-instance_success.carbon +// --- fail_todo_non-instance_success.carbon library "[[@TEST_NAME]]"; interface NonInstance1 { @@ -20,7 +20,7 @@ impl {.a: ()} as NonInstance1 { } fn NonInstanceCall1() { - // CHECK:STDERR: non-instance_success.carbon:[[@LINE+4]]:3: error: cannot access member of interface `NonInstance1` in type `type` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: fail_todo_non-instance_success.carbon:[[@LINE+4]]:3: error: cannot access member of interface `NonInstance1` in type `type` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: {.a: ()}.(NonInstance1.F1)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -34,7 +34,7 @@ interface ImplicitAs(Dest:! type) { fn Convert[self: Self]() -> Dest; } -// --- fail_non-instance.carbon +// --- todo_fail_non-instance.carbon library "[[@TEST_NAME]]"; import Core; @@ -51,7 +51,7 @@ fn NonInstanceCall2(n: {.b: ()}) { n.(NonInstance2.F2)(); } -// --- fail_non-instance_indirect.carbon +// --- todo_fail_non-instance_indirect.carbon library "[[@TEST_NAME]]"; import Core; @@ -106,7 +106,7 @@ fn InstanceCallFail() { {.e: ()}.(Instance2.G2)(); } -// CHECK:STDOUT: --- non-instance_success.carbon +// CHECK:STDOUT: --- fail_todo_non-instance_success.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %NonInstance1.type: type = facet_type <@NonInstance1> [concrete] @@ -279,7 +279,7 @@ fn InstanceCallFail() { // CHECK:STDOUT: // CHECK:STDOUT: specific @ImplicitAs(%Dest.loc3_22.2) {} // CHECK:STDOUT: -// CHECK:STDOUT: --- fail_non-instance.carbon +// CHECK:STDOUT: --- todo_fail_non-instance.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %NonInstance2.type: type = facet_type <@NonInstance2> [concrete] @@ -376,7 +376,7 @@ fn InstanceCallFail() { // CHECK:STDOUT: // CHECK:STDOUT: specific @F2.1(constants.%NonInstance2.facet) {} // CHECK:STDOUT: -// CHECK:STDOUT: --- fail_non-instance_indirect.carbon +// CHECK:STDOUT: --- todo_fail_non-instance_indirect.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %NonInstance3.type: type = facet_type <@NonInstance3> [concrete] diff --git a/toolchain/check/testdata/impl/no_prelude/import_compound.carbon b/toolchain/check/testdata/impl/no_prelude/import_compound.carbon index 5afd410c90a75..0a21aacc7ddc1 100644 --- a/toolchain/check/testdata/impl/no_prelude/import_compound.carbon +++ b/toolchain/check/testdata/impl/no_prelude/import_compound.carbon @@ -27,13 +27,13 @@ impl {.i: ()} as Instance { fn G[self: Self]() {} } -// --- import_non-instance_success.carbon +// --- fail_todo_import_non-instance_success.carbon library "[[@TEST_NAME]]"; import library "lib"; fn NonInstanceCallImport() { - // CHECK:STDERR: import_non-instance_success.carbon:[[@LINE+4]]:3: error: cannot access member of interface `NonInstance` in type `type` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: fail_todo_import_non-instance_success.carbon:[[@LINE+4]]:3: error: cannot access member of interface `NonInstance` in type `type` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: {.i: ()}.(NonInstance.F)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -47,7 +47,7 @@ interface ImplicitAs(Dest:! type) { fn Convert[self: Self]() -> Dest; } -// --- fail_import_non-instance.carbon +// --- todo_fail_import_non-instance.carbon library "[[@TEST_NAME]]"; import library "lib"; @@ -57,7 +57,7 @@ fn NonInstanceCallImportFail(n: {.i: ()}) { n.(NonInstance.F)(); } -// --- fail_import_non-instance_indirect.carbon +// --- todo_fail_import_non-instance_indirect.carbon library "[[@TEST_NAME]]"; import library "lib"; @@ -236,7 +236,7 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: %Self.as_type.loc12_14.1 => constants.%struct_type.i // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: --- import_non-instance_success.carbon +// CHECK:STDOUT: --- fail_todo_import_non-instance_success.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %NonInstanceCallImport.type: type = fn_type @NonInstanceCallImport [concrete] @@ -406,7 +406,7 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: // CHECK:STDOUT: specific @ImplicitAs(%Dest.loc3_22.2) {} // CHECK:STDOUT: -// CHECK:STDOUT: --- fail_import_non-instance.carbon +// CHECK:STDOUT: --- todo_fail_import_non-instance.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] @@ -512,7 +512,7 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: // CHECK:STDOUT: specific @F.1(constants.%Self.73c) {} // CHECK:STDOUT: -// CHECK:STDOUT: --- fail_import_non-instance_indirect.carbon +// CHECK:STDOUT: --- todo_fail_import_non-instance_indirect.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] diff --git a/toolchain/check/testdata/impl/no_prelude/interface_args.carbon b/toolchain/check/testdata/impl/no_prelude/interface_args.carbon index d4fa49955ffdd..4585350889e3b 100644 --- a/toolchain/check/testdata/impl/no_prelude/interface_args.carbon +++ b/toolchain/check/testdata/impl/no_prelude/interface_args.carbon @@ -61,12 +61,12 @@ impl A as Factory(B) { fn Method[self: Self]() -> B; } -// --- factory.impl.carbon +// --- fail_todo_factory.impl.carbon impl library "[[@TEST_NAME]]"; fn MakeB() -> B { - // CHECK:STDERR: factory.impl.carbon:[[@LINE+4]]:10: error: cannot access member of interface `Factory(B)` in type `type` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: fail_todo_factory.impl.carbon:[[@LINE+4]]:10: error: cannot access member of interface `Factory(B)` in type `type` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: return A.(Factory(B).Make)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -904,7 +904,7 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %Self.as_type.loc8_19.1 => constants.%A // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: --- factory.impl.carbon +// CHECK:STDOUT: --- fail_todo_factory.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %B: type = class_type @B [concrete] diff --git a/toolchain/check/testdata/interface/no_prelude/compound_member_access.carbon b/toolchain/check/testdata/interface/no_prelude/compound_member_access.carbon index e2887662222d9..ca503243a74f2 100644 --- a/toolchain/check/testdata/interface/no_prelude/compound_member_access.carbon +++ b/toolchain/check/testdata/interface/no_prelude/compound_member_access.carbon @@ -27,7 +27,7 @@ impl forall [T:! type] T as BitAnd { fn Op[self: Self](other: Self) -> Self = "type.and"; } -// --- associated_constant.carbon +// --- fail_todo_associated_constant.carbon library "[[@TEST_NAME]]"; interface J { @@ -38,13 +38,13 @@ interface J { fn Simple1(T:! J, S:! T.U) {} // This should be equivalent to `Simple1` above, but using compound member access. -// CHECK:STDERR: associated_constant.carbon:[[@LINE+4]]:25: error: cannot access member of interface `J` in type `J` that does not implement that interface [MissingImplInMemberAccess] +// CHECK:STDERR: fail_todo_associated_constant.carbon:[[@LINE+4]]:25: error: cannot access member of interface `J` in type `J` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: fn Compound1(V:! J, W:! V.(J.U)) {} // CHECK:STDERR: ^~~~~~~ // CHECK:STDERR: fn Compound1(V:! J, W:! V.(J.U)) {} -// --- non_instance.carbon +// --- fail_todo_non_instance.carbon library "[[@TEST_NAME]]"; interface K1 { @@ -58,7 +58,7 @@ fn Simple2(T:! K1) { // This should be equivalent to `Simple2` above, but using compound member access. fn Compound2(V:! K1) { - // CHECK:STDERR: non_instance.carbon:[[@LINE+4]]:3: error: cannot access member of interface `K1` in type `K1` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: fail_todo_non_instance.carbon:[[@LINE+4]]:3: error: cannot access member of interface `K1` in type `K1` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: V.(K1.Q1)(); // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: @@ -176,7 +176,7 @@ fn Compound5(V:! L2) { V.(L2.S2)(); } -// --- fail_combine_non_instance.carbon +// --- todo_fail_combine_non_instance.carbon library "[[@TEST_NAME]]"; import Core; @@ -198,7 +198,7 @@ fn Fails() { (({} as C) as (C as (A & A))).(A.G)(); } -// --- allowed_combine_non_instance.carbon +// --- fail_todo_allowed_combine_non_instance.carbon library "[[@TEST_NAME]]"; import Core; @@ -213,17 +213,17 @@ impl C as A { } fn Works() { - // CHECK:STDERR: allowed_combine_non_instance.carbon:[[@LINE+4]]:3: error: cannot access member of interface `A` in type `type` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: fail_todo_allowed_combine_non_instance.carbon:[[@LINE+4]]:3: error: cannot access member of interface `A` in type `type` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: C.((A & A).G)(); // CHECK:STDERR: ^~~~~~~~~~~~~ // CHECK:STDERR: C.((A & A).G)(); - // CHECK:STDERR: allowed_combine_non_instance.carbon:[[@LINE+4]]:3: error: cannot access member of interface `A` in type `A` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: fail_todo_allowed_combine_non_instance.carbon:[[@LINE+4]]:3: error: cannot access member of interface `A` in type `A` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: (C as (A & A)).((A & A).G)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: (C as (A & A)).((A & A).G)(); - // CHECK:STDERR: allowed_combine_non_instance.carbon:[[@LINE+4]]:3: error: cannot access member of interface `A` in type `A` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: fail_todo_allowed_combine_non_instance.carbon:[[@LINE+4]]:3: error: cannot access member of interface `A` in type `A` that does not implement that interface [MissingImplInMemberAccess] // CHECK:STDERR: (C as (A & A)).(A.G)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -547,7 +547,7 @@ fn Works() { // CHECK:STDOUT: %Self.as_type.loc12_15.1 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: --- associated_constant.carbon +// CHECK:STDOUT: --- fail_todo_associated_constant.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %J.type: type = facet_type <@J> [concrete] @@ -683,7 +683,7 @@ fn Works() { // CHECK:STDOUT: %W.patt.loc15_21.2 => // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: --- non_instance.carbon +// CHECK:STDOUT: --- fail_todo_non_instance.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %K1.type: type = facet_type <@K1> [concrete] @@ -1355,7 +1355,7 @@ fn Works() { // CHECK:STDOUT: %V.patt.loc30_14.2 => constants.%V // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: --- fail_combine_non_instance.carbon +// CHECK:STDOUT: --- todo_fail_combine_non_instance.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %A.type: type = facet_type <@A> [concrete] @@ -1617,7 +1617,7 @@ fn Works() { // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: --- allowed_combine_non_instance.carbon +// CHECK:STDOUT: --- fail_todo_allowed_combine_non_instance.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %A.type: type = facet_type <@A> [concrete] From e1dbbfd09a540a0d1ed08804e41eec015a7fca0d Mon Sep 17 00:00:00 2001 From: Josh L Date: Mon, 3 Mar 2025 19:47:27 +0000 Subject: [PATCH 6/8] Checkpoint progress. --- toolchain/check/testdata/facet/no_prelude/combine.carbon | 3 +++ 1 file changed, 3 insertions(+) diff --git a/toolchain/check/testdata/facet/no_prelude/combine.carbon b/toolchain/check/testdata/facet/no_prelude/combine.carbon index c640c5938a425..5f584d0706c54 100644 --- a/toolchain/check/testdata/facet/no_prelude/combine.carbon +++ b/toolchain/check/testdata/facet/no_prelude/combine.carbon @@ -64,6 +64,9 @@ library "[[@TEST_NAME]]"; import Core; +// Non-instance versions of these tests are in +// .../interface/no_prelude/compound_member_access.carbon. + interface A { fn G[self: Self](); } From 692fb00028135f2e0428ae87fd69a32d749cd477 Mon Sep 17 00:00:00 2001 From: Josh L Date: Mon, 3 Mar 2025 21:26:14 +0000 Subject: [PATCH 7/8] Move `Core` package to the top of tests --- .../testdata/impl/no_prelude/compound.carbon | 168 +++++++------- .../impl/no_prelude/import_compound.carbon | 206 +++++++++--------- .../impl/no_prelude/interface_args.carbon | 206 +++++++++--------- 3 files changed, 290 insertions(+), 290 deletions(-) diff --git a/toolchain/check/testdata/impl/no_prelude/compound.carbon b/toolchain/check/testdata/impl/no_prelude/compound.carbon index 685d4033d27fb..c799c2a126dba 100644 --- a/toolchain/check/testdata/impl/no_prelude/compound.carbon +++ b/toolchain/check/testdata/impl/no_prelude/compound.carbon @@ -8,6 +8,13 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/no_prelude/compound.carbon +// --- core.carbon +package Core; + +interface ImplicitAs(Dest:! type) { + fn Convert[self: Self]() -> Dest; +} + // --- fail_todo_non-instance_success.carbon library "[[@TEST_NAME]]"; @@ -27,13 +34,6 @@ fn NonInstanceCall1() { {.a: ()}.(NonInstance1.F1)(); } -// --- core.carbon -package Core; - -interface ImplicitAs(Dest:! type) { - fn Convert[self: Self]() -> Dest; -} - // --- todo_fail_non-instance.carbon library "[[@TEST_NAME]]"; @@ -106,83 +106,6 @@ fn InstanceCallFail() { {.e: ()}.(Instance2.G2)(); } -// CHECK:STDOUT: --- fail_todo_non-instance_success.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %NonInstance1.type: type = facet_type <@NonInstance1> [concrete] -// CHECK:STDOUT: %Self: %NonInstance1.type = bind_symbolic_name Self, 0 [symbolic] -// CHECK:STDOUT: %F1.type.163: type = fn_type @F1.1 [concrete] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %F1.b1f: %F1.type.163 = struct_value () [concrete] -// CHECK:STDOUT: %NonInstance1.assoc_type: type = assoc_entity_type %NonInstance1.type [concrete] -// CHECK:STDOUT: %assoc0: %NonInstance1.assoc_type = assoc_entity element0, @NonInstance1.%F1.decl [concrete] -// CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_tuple.type} [concrete] -// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%F1.decl) [concrete] -// CHECK:STDOUT: %F1.type.d4a: type = fn_type @F1.2 [concrete] -// CHECK:STDOUT: %F1.c75: %F1.type.d4a = struct_value () [concrete] -// CHECK:STDOUT: %NonInstance1.facet: %NonInstance1.type = facet_value %struct_type.a, %impl_witness [concrete] -// CHECK:STDOUT: %NonInstanceCall1.type: type = fn_type @NonInstanceCall1 [concrete] -// CHECK:STDOUT: %NonInstanceCall1: %NonInstanceCall1.type = struct_value () [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .NonInstance1 = %NonInstance1.decl -// CHECK:STDOUT: .NonInstanceCall1 = %NonInstanceCall1.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %NonInstance1.decl: type = interface_decl @NonInstance1 [concrete = constants.%NonInstance1.type] {} {} -// CHECK:STDOUT: impl_decl @impl [concrete] {} { -// CHECK:STDOUT: %.loc7_12.1: %empty_tuple.type = tuple_literal () -// CHECK:STDOUT: %.loc7_12.2: type = converted %.loc7_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_tuple.type} [concrete = constants.%struct_type.a] -// CHECK:STDOUT: %NonInstance1.ref: type = name_ref NonInstance1, file.%NonInstance1.decl [concrete = constants.%NonInstance1.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%F1.decl) [concrete = constants.%impl_witness] -// CHECK:STDOUT: %NonInstanceCall1.decl: %NonInstanceCall1.type = fn_decl @NonInstanceCall1 [concrete = constants.%NonInstanceCall1] {} {} -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: interface @NonInstance1 { -// CHECK:STDOUT: %Self: %NonInstance1.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F1.decl: %F1.type.163 = fn_decl @F1.1 [concrete = constants.%F1.b1f] {} {} -// CHECK:STDOUT: %assoc0: %NonInstance1.assoc_type = assoc_entity element0, %F1.decl [concrete = constants.%assoc0] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F1 = %assoc0 -// CHECK:STDOUT: witness = (%F1.decl) -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %struct_type.a as %NonInstance1.ref { -// CHECK:STDOUT: %F1.decl: %F1.type.d4a = fn_decl @F1.2 [concrete = constants.%F1.c75] {} {} -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .F1 = %F1.decl -// CHECK:STDOUT: witness = file.%impl_witness -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F1.1(@NonInstance1.%Self: %NonInstance1.type) { -// CHECK:STDOUT: fn(); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @F1.2() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @NonInstanceCall1() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc16_9.1: %empty_tuple.type = tuple_literal () -// CHECK:STDOUT: %.loc16_9.2: type = converted %.loc16_9.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_tuple.type} [concrete = constants.%struct_type.a] -// CHECK:STDOUT: %NonInstance1.ref: type = name_ref NonInstance1, file.%NonInstance1.decl [concrete = constants.%NonInstance1.type] -// CHECK:STDOUT: %F1.ref: %NonInstance1.assoc_type = name_ref F1, @NonInstance1.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @F1.1(constants.%Self) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @F1.1(constants.%NonInstance1.facet) {} -// CHECK:STDOUT: // CHECK:STDOUT: --- core.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -279,6 +202,83 @@ fn InstanceCallFail() { // CHECK:STDOUT: // CHECK:STDOUT: specific @ImplicitAs(%Dest.loc3_22.2) {} // CHECK:STDOUT: +// CHECK:STDOUT: --- fail_todo_non-instance_success.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %NonInstance1.type: type = facet_type <@NonInstance1> [concrete] +// CHECK:STDOUT: %Self: %NonInstance1.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %F1.type.163: type = fn_type @F1.1 [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %F1.b1f: %F1.type.163 = struct_value () [concrete] +// CHECK:STDOUT: %NonInstance1.assoc_type: type = assoc_entity_type %NonInstance1.type [concrete] +// CHECK:STDOUT: %assoc0: %NonInstance1.assoc_type = assoc_entity element0, @NonInstance1.%F1.decl [concrete] +// CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_tuple.type} [concrete] +// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%F1.decl) [concrete] +// CHECK:STDOUT: %F1.type.d4a: type = fn_type @F1.2 [concrete] +// CHECK:STDOUT: %F1.c75: %F1.type.d4a = struct_value () [concrete] +// CHECK:STDOUT: %NonInstance1.facet: %NonInstance1.type = facet_value %struct_type.a, %impl_witness [concrete] +// CHECK:STDOUT: %NonInstanceCall1.type: type = fn_type @NonInstanceCall1 [concrete] +// CHECK:STDOUT: %NonInstanceCall1: %NonInstanceCall1.type = struct_value () [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .NonInstance1 = %NonInstance1.decl +// CHECK:STDOUT: .NonInstanceCall1 = %NonInstanceCall1.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %NonInstance1.decl: type = interface_decl @NonInstance1 [concrete = constants.%NonInstance1.type] {} {} +// CHECK:STDOUT: impl_decl @impl [concrete] {} { +// CHECK:STDOUT: %.loc7_12.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc7_12.2: type = converted %.loc7_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_tuple.type} [concrete = constants.%struct_type.a] +// CHECK:STDOUT: %NonInstance1.ref: type = name_ref NonInstance1, file.%NonInstance1.decl [concrete = constants.%NonInstance1.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%F1.decl) [concrete = constants.%impl_witness] +// CHECK:STDOUT: %NonInstanceCall1.decl: %NonInstanceCall1.type = fn_decl @NonInstanceCall1 [concrete = constants.%NonInstanceCall1] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @NonInstance1 { +// CHECK:STDOUT: %Self: %NonInstance1.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] +// CHECK:STDOUT: %F1.decl: %F1.type.163 = fn_decl @F1.1 [concrete = constants.%F1.b1f] {} {} +// CHECK:STDOUT: %assoc0: %NonInstance1.assoc_type = assoc_entity element0, %F1.decl [concrete = constants.%assoc0] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: .F1 = %assoc0 +// CHECK:STDOUT: witness = (%F1.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl: %struct_type.a as %NonInstance1.ref { +// CHECK:STDOUT: %F1.decl: %F1.type.d4a = fn_decl @F1.2 [concrete = constants.%F1.c75] {} {} +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .F1 = %F1.decl +// CHECK:STDOUT: witness = file.%impl_witness +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @F1.1(@NonInstance1.%Self: %NonInstance1.type) { +// CHECK:STDOUT: fn(); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F1.2() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @NonInstanceCall1() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc16_9.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc16_9.2: type = converted %.loc16_9.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_tuple.type} [concrete = constants.%struct_type.a] +// CHECK:STDOUT: %NonInstance1.ref: type = name_ref NonInstance1, file.%NonInstance1.decl [concrete = constants.%NonInstance1.type] +// CHECK:STDOUT: %F1.ref: %NonInstance1.assoc_type = name_ref F1, @NonInstance1.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @F1.1(constants.%Self) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @F1.1(constants.%NonInstance1.facet) {} +// CHECK:STDOUT: // CHECK:STDOUT: --- todo_fail_non-instance.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { diff --git a/toolchain/check/testdata/impl/no_prelude/import_compound.carbon b/toolchain/check/testdata/impl/no_prelude/import_compound.carbon index 0a21aacc7ddc1..085bd71a19c4e 100644 --- a/toolchain/check/testdata/impl/no_prelude/import_compound.carbon +++ b/toolchain/check/testdata/impl/no_prelude/import_compound.carbon @@ -8,6 +8,13 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/no_prelude/import_compound.carbon +// --- core.carbon +package Core; + +interface ImplicitAs(Dest:! type) { + fn Convert[self: Self]() -> Dest; +} + // --- lib.carbon library "[[@TEST_NAME]]"; @@ -40,13 +47,6 @@ fn NonInstanceCallImport() { {.i: ()}.(NonInstance.F)(); } -// --- core.carbon -package Core; - -interface ImplicitAs(Dest:! type) { - fn Convert[self: Self]() -> Dest; -} - // --- todo_fail_import_non-instance.carbon library "[[@TEST_NAME]]"; @@ -94,6 +94,102 @@ fn InstanceCallImportFail() { {.i: ()}.(Instance.G)(); } +// 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.loc3_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: %Dest.param_patt: type = value_param_pattern %Dest.patt.loc3_22.1, runtime_param [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.param: type = value_param runtime_param +// CHECK:STDOUT: %Dest.loc3_22.1: type = bind_symbolic_name Dest, 0, %Dest.param [symbolic = %Dest.loc3_22.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc3_22.1: type) { +// CHECK:STDOUT: %Dest.loc3_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc3_22.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc3_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc3_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.loc3_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.loc4_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc4_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.loc4_20.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: @Convert.%Dest (%Dest) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Convert.%Dest (%Dest) = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc3_22.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc4_20.1: type = splice_block %.loc4_20.3 [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %.loc4_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, %.loc4_20.2 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc4_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc4_20.3: type = converted %Self.ref, %Self.as_type.loc4_20.2 [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.%Dest (%Dest) = out_param runtime_param1 +// CHECK:STDOUT: %return: ref @Convert.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc4_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc4_35.2 (constants.%assoc0)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc4_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert(@ImplicitAs.%Dest.loc3_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.loc4_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type)]() -> @Convert.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc3_22.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc3_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.loc4_20.1 => constants.%Self.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(%Dest.loc3_22.2) {} +// CHECK:STDOUT: // CHECK:STDOUT: --- lib.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -310,102 +406,6 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// 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.loc3_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)] -// CHECK:STDOUT: %Dest.param_patt: type = value_param_pattern %Dest.patt.loc3_22.1, runtime_param [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.param: type = value_param runtime_param -// CHECK:STDOUT: %Dest.loc3_22.1: type = bind_symbolic_name Dest, 0, %Dest.param [symbolic = %Dest.loc3_22.2 (constants.%Dest)] -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc3_22.1: type) { -// CHECK:STDOUT: %Dest.loc3_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc3_22.2 (constants.%Dest)] -// CHECK:STDOUT: %Dest.patt.loc3_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc3_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.loc3_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.loc4_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc4_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.loc4_20.1 (%Self.as_type) = binding_pattern self -// CHECK:STDOUT: %self.param_patt: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: @Convert.%Dest (%Dest) = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: @Convert.%Dest (%Dest) = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc3_22.1 [symbolic = %Dest (constants.%Dest)] -// CHECK:STDOUT: %self.param: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = value_param runtime_param0 -// CHECK:STDOUT: %.loc4_20.1: type = splice_block %.loc4_20.3 [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] { -// CHECK:STDOUT: %.loc4_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, %.loc4_20.2 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc4_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc4_20.3: type = converted %Self.ref, %Self.as_type.loc4_20.2 [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = bind_name self, %self.param -// CHECK:STDOUT: %return.param: ref @Convert.%Dest (%Dest) = out_param runtime_param1 -// CHECK:STDOUT: %return: ref @Convert.%Dest (%Dest) = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %assoc0.loc4_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc4_35.2 (constants.%assoc0)] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .Dest = -// CHECK:STDOUT: .Convert = %assoc0.loc4_35.1 -// CHECK:STDOUT: witness = (%Convert.decl) -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert(@ImplicitAs.%Dest.loc3_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.loc4_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type)]() -> @Convert.%Dest (%Dest); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { -// CHECK:STDOUT: %Dest.loc3_22.2 => constants.%Dest -// CHECK:STDOUT: %Dest.patt.loc3_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.loc4_20.1 => constants.%Self.as_type -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(%Dest.loc3_22.2) {} -// CHECK:STDOUT: // CHECK:STDOUT: --- todo_fail_import_non-instance.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { diff --git a/toolchain/check/testdata/impl/no_prelude/interface_args.carbon b/toolchain/check/testdata/impl/no_prelude/interface_args.carbon index 4585350889e3b..94744229ff416 100644 --- a/toolchain/check/testdata/impl/no_prelude/interface_args.carbon +++ b/toolchain/check/testdata/impl/no_prelude/interface_args.carbon @@ -8,6 +8,13 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/no_prelude/interface_args.carbon +// --- core.carbon +package Core; + +interface ImplicitAs(Dest:! type) { + fn Convert[self: Self]() -> Dest; +} + // --- action.carbon library "[[@TEST_NAME]]"; @@ -76,13 +83,6 @@ fn InstanceB(a: A) -> B { return a.(Factory(B).Method)(); } -// --- core.carbon -package Core; - -interface ImplicitAs(Dest:! type) { - fn Convert[self: Self]() -> Dest; -} - // --- fail_factory.impl.carbon impl library "[[@TEST_NAME]]"; @@ -107,6 +107,102 @@ fn InstanceC(a: A) -> C { return a.(Factory(C).Method)(); } +// 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.loc3_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: %Dest.param_patt: type = value_param_pattern %Dest.patt.loc3_22.1, runtime_param [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.param: type = value_param runtime_param +// CHECK:STDOUT: %Dest.loc3_22.1: type = bind_symbolic_name Dest, 0, %Dest.param [symbolic = %Dest.loc3_22.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc3_22.1: type) { +// CHECK:STDOUT: %Dest.loc3_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc3_22.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc3_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc3_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.loc3_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.loc4_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc4_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.loc4_20.1 (%Self.as_type) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: @Convert.%Dest (%Dest) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Convert.%Dest (%Dest) = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc3_22.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc4_20.1: type = splice_block %.loc4_20.3 [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %.loc4_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, %.loc4_20.2 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc4_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc4_20.3: type = converted %Self.ref, %Self.as_type.loc4_20.2 [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.%Dest (%Dest) = out_param runtime_param1 +// CHECK:STDOUT: %return: ref @Convert.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc4_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc4_35.2 (constants.%assoc0)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc4_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert(@ImplicitAs.%Dest.loc3_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.loc4_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type)]() -> @Convert.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc3_22.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc3_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.loc4_20.1 => constants.%Self.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(%Dest.loc3_22.2) {} +// CHECK:STDOUT: // CHECK:STDOUT: --- action.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -1130,102 +1226,6 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %Self.as_type => constants.%Self.as_type // CHECK:STDOUT: } // CHECK:STDOUT: -// 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.loc3_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)] -// CHECK:STDOUT: %Dest.param_patt: type = value_param_pattern %Dest.patt.loc3_22.1, runtime_param [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.param: type = value_param runtime_param -// CHECK:STDOUT: %Dest.loc3_22.1: type = bind_symbolic_name Dest, 0, %Dest.param [symbolic = %Dest.loc3_22.2 (constants.%Dest)] -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc3_22.1: type) { -// CHECK:STDOUT: %Dest.loc3_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc3_22.2 (constants.%Dest)] -// CHECK:STDOUT: %Dest.patt.loc3_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc3_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.loc3_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.loc4_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc4_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.loc4_20.1 (%Self.as_type) = binding_pattern self -// CHECK:STDOUT: %self.param_patt: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: @Convert.%Dest (%Dest) = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: @Convert.%Dest (%Dest) = out_param_pattern %return.patt, runtime_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc3_22.1 [symbolic = %Dest (constants.%Dest)] -// CHECK:STDOUT: %self.param: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = value_param runtime_param0 -// CHECK:STDOUT: %.loc4_20.1: type = splice_block %.loc4_20.3 [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] { -// CHECK:STDOUT: %.loc4_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, %.loc4_20.2 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc4_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc4_20.3: type = converted %Self.ref, %Self.as_type.loc4_20.2 [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = bind_name self, %self.param -// CHECK:STDOUT: %return.param: ref @Convert.%Dest (%Dest) = out_param runtime_param1 -// CHECK:STDOUT: %return: ref @Convert.%Dest (%Dest) = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %assoc0.loc4_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc4_35.2 (constants.%assoc0)] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .Dest = -// CHECK:STDOUT: .Convert = %assoc0.loc4_35.1 -// CHECK:STDOUT: witness = (%Convert.decl) -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert(@ImplicitAs.%Dest.loc3_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.loc4_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type)]() -> @Convert.%Dest (%Dest); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { -// CHECK:STDOUT: %Dest.loc3_22.2 => constants.%Dest -// CHECK:STDOUT: %Dest.patt.loc3_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.loc4_20.1 => constants.%Self.as_type -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(%Dest.loc3_22.2) {} -// CHECK:STDOUT: // CHECK:STDOUT: --- fail_factory.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { From dbd2b7fa672da07ec0f65b9bdb8434772c7a9327 Mon Sep 17 00:00:00 2001 From: Josh L Date: Tue, 4 Mar 2025 01:23:24 +0000 Subject: [PATCH 8/8] autoupdate --- .../testdata/facet/no_prelude/combine.carbon | 2 +- .../no_prelude/compound_member_access.carbon | 233 +++++++++++------- .../no_prelude/fail_member_lookup.carbon | 2 +- 3 files changed, 146 insertions(+), 91 deletions(-) diff --git a/toolchain/check/testdata/facet/no_prelude/combine.carbon b/toolchain/check/testdata/facet/no_prelude/combine.carbon index 91369a2a34c3e..c5d13589ea6a0 100644 --- a/toolchain/check/testdata/facet/no_prelude/combine.carbon +++ b/toolchain/check/testdata/facet/no_prelude/combine.carbon @@ -192,7 +192,7 @@ fn F() { // CHECK:STDERR: fn H[T:! A & B](t: T) { // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: - // CHECK:STDERR: fail_todo_generic_combine.carbon:[[@LINE+10]]:3: error: cannot implicitly convert from `type` to `A & B` [ImplicitAsConversionFailure] + // CHECK:STDERR: fail_todo_generic_combine.carbon:[[@LINE+10]]:3: error: cannot implicitly convert value of type `type` to `A & B` [ImplicitAsConversionFailure] // CHECK:STDERR: H({} as C); // CHECK:STDERR: ^~~~~~~~~~ // CHECK:STDERR: fail_todo_generic_combine.carbon:[[@LINE+7]]:3: note: type `type` does not implement interface `Core.ImplicitAs(A & B)` [MissingImplInMemberAccessNote] diff --git a/toolchain/check/testdata/interface/no_prelude/compound_member_access.carbon b/toolchain/check/testdata/interface/no_prelude/compound_member_access.carbon index ca503243a74f2..3ed4043c342bf 100644 --- a/toolchain/check/testdata/interface/no_prelude/compound_member_access.carbon +++ b/toolchain/check/testdata/interface/no_prelude/compound_member_access.carbon @@ -77,10 +77,6 @@ interface K2 { // Simple member access allows this. // TODO: This is not expected to fail. fn Simple3(T:! K2, x: T) { - // CHECK:STDERR: fail_caller_instance_interface_not.carbon:[[@LINE+4]]:3: error: type `T` does not support qualified expressions [QualifiedExprUnsupported] - // CHECK:STDERR: x.Q2(); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: x.Q2(); } @@ -105,16 +101,8 @@ interface L1 { // Simple member access. // TODO: This is not expected to fail. fn Simple4(T:! L1, x: T) { - // CHECK:STDERR: fail_todo_instance.carbon:[[@LINE+4]]:3: error: type `T` does not support qualified expressions [QualifiedExprUnsupported] - // CHECK:STDERR: x.R1(); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: x.R1(); var xcopy: T = x; - // CHECK:STDERR: fail_todo_instance.carbon:[[@LINE+4]]:3: error: type `T` does not support qualified expressions [QualifiedExprUnsupported] - // CHECK:STDERR: xcopy.S1(); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: xcopy.S1(); } @@ -812,6 +800,7 @@ fn Works() { // CHECK:STDOUT: %K2.type: type = facet_type <@K2> [concrete] // CHECK:STDOUT: %Self: %K2.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %Q2.type: type = fn_type @Q2 [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Q2: %Q2.type = struct_value () [concrete] // CHECK:STDOUT: %K2.assoc_type: type = assoc_entity_type %K2.type [concrete] // CHECK:STDOUT: %assoc0: %K2.assoc_type = assoc_entity element0, @K2.%Q2.decl [concrete] @@ -821,6 +810,11 @@ fn Works() { // CHECK:STDOUT: %Simple3.type: type = fn_type @Simple3 [concrete] // CHECK:STDOUT: %Simple3: %Simple3.type = struct_value () [concrete] // CHECK:STDOUT: %require_complete.022e81.1: = require_complete_type %T.as_type [symbolic] +// CHECK:STDOUT: %T.as_wit: = facet_access_witness %T [symbolic] +// CHECK:STDOUT: %K2.facet: %K2.type = facet_value %T.as_type, %T.as_wit [symbolic] +// CHECK:STDOUT: %.813: type = fn_type_with_self_type %Q2.type, %K2.facet [symbolic] +// CHECK:STDOUT: %impl.elem0: %.813 = impl_witness_access %T.as_wit, element0 [symbolic] +// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Q2(%K2.facet) [symbolic] // CHECK:STDOUT: %V: %K2.type = bind_symbolic_name V, 0 [symbolic] // CHECK:STDOUT: %V.patt: %K2.type = symbolic_binding_pattern V, 0 [symbolic] // CHECK:STDOUT: %V.as_type: type = facet_access_type %V [symbolic] @@ -862,21 +856,21 @@ fn Works() { // CHECK:STDOUT: %x: @Simple3.%T.as_type.loc11_23.2 (%T.as_type) = bind_name x, %x.param // CHECK:STDOUT: } // CHECK:STDOUT: %Compound3.decl: %Compound3.type = fn_decl @Compound3 [concrete = constants.%Compound3] { -// CHECK:STDOUT: %V.patt.loc21_14.1: %K2.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc21_14.2 (constants.%V.patt)] -// CHECK:STDOUT: %V.param_patt: %K2.type = value_param_pattern %V.patt.loc21_14.1, runtime_param [symbolic = %V.patt.loc21_14.2 (constants.%V.patt)] -// CHECK:STDOUT: %y.patt: @Compound3.%V.as_type.loc21_25.2 (%V.as_type) = binding_pattern y -// CHECK:STDOUT: %y.param_patt: @Compound3.%V.as_type.loc21_25.2 (%V.as_type) = value_param_pattern %y.patt, runtime_param0 +// CHECK:STDOUT: %V.patt.loc17_14.1: %K2.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc17_14.2 (constants.%V.patt)] +// CHECK:STDOUT: %V.param_patt: %K2.type = value_param_pattern %V.patt.loc17_14.1, runtime_param [symbolic = %V.patt.loc17_14.2 (constants.%V.patt)] +// CHECK:STDOUT: %y.patt: @Compound3.%V.as_type.loc17_25.2 (%V.as_type) = binding_pattern y +// CHECK:STDOUT: %y.param_patt: @Compound3.%V.as_type.loc17_25.2 (%V.as_type) = value_param_pattern %y.patt, runtime_param0 // CHECK:STDOUT: } { // CHECK:STDOUT: %V.param: %K2.type = value_param runtime_param -// CHECK:STDOUT: %K2.ref.loc21: type = name_ref K2, file.%K2.decl [concrete = constants.%K2.type] -// CHECK:STDOUT: %V.loc21_14.1: %K2.type = bind_symbolic_name V, 0, %V.param [symbolic = %V.loc21_14.2 (constants.%V)] -// CHECK:STDOUT: %y.param: @Compound3.%V.as_type.loc21_25.2 (%V.as_type) = value_param runtime_param0 -// CHECK:STDOUT: %.loc21_25.1: type = splice_block %.loc21_25.2 [symbolic = %V.as_type.loc21_25.2 (constants.%V.as_type)] { -// CHECK:STDOUT: %V.ref: %K2.type = name_ref V, %V.loc21_14.1 [symbolic = %V.loc21_14.2 (constants.%V)] -// CHECK:STDOUT: %V.as_type.loc21_25.1: type = facet_access_type %V.ref [symbolic = %V.as_type.loc21_25.2 (constants.%V.as_type)] -// CHECK:STDOUT: %.loc21_25.2: type = converted %V.ref, %V.as_type.loc21_25.1 [symbolic = %V.as_type.loc21_25.2 (constants.%V.as_type)] +// CHECK:STDOUT: %K2.ref.loc17: type = name_ref K2, file.%K2.decl [concrete = constants.%K2.type] +// CHECK:STDOUT: %V.loc17_14.1: %K2.type = bind_symbolic_name V, 0, %V.param [symbolic = %V.loc17_14.2 (constants.%V)] +// CHECK:STDOUT: %y.param: @Compound3.%V.as_type.loc17_25.2 (%V.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc17_25.1: type = splice_block %.loc17_25.2 [symbolic = %V.as_type.loc17_25.2 (constants.%V.as_type)] { +// CHECK:STDOUT: %V.ref: %K2.type = name_ref V, %V.loc17_14.1 [symbolic = %V.loc17_14.2 (constants.%V)] +// CHECK:STDOUT: %V.as_type.loc17_25.1: type = facet_access_type %V.ref [symbolic = %V.as_type.loc17_25.2 (constants.%V.as_type)] +// CHECK:STDOUT: %.loc17_25.2: type = converted %V.ref, %V.as_type.loc17_25.1 [symbolic = %V.as_type.loc17_25.2 (constants.%V.as_type)] // CHECK:STDOUT: } -// CHECK:STDOUT: %y: @Compound3.%V.as_type.loc21_25.2 (%V.as_type) = bind_name y, %y.param +// CHECK:STDOUT: %y: @Compound3.%V.as_type.loc17_25.2 (%V.as_type) = bind_name y, %y.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -902,26 +896,38 @@ fn Works() { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete: = require_complete_type @Simple3.%T.as_type.loc11_23.2 (%T.as_type) [symbolic = %require_complete (constants.%require_complete.022e81.1)] +// CHECK:STDOUT: %T.as_wit.loc12_4.2: = facet_access_witness %T.loc11_12.2 [symbolic = %T.as_wit.loc12_4.2 (constants.%T.as_wit)] +// CHECK:STDOUT: %K2.facet: %K2.type = facet_value %T.as_type.loc11_23.2, %T.as_wit.loc12_4.2 [symbolic = %K2.facet (constants.%K2.facet)] +// CHECK:STDOUT: %.loc12_4.2: type = fn_type_with_self_type constants.%Q2.type, %K2.facet [symbolic = %.loc12_4.2 (constants.%.813)] +// CHECK:STDOUT: %impl.elem0.loc12_4.2: @Simple3.%.loc12_4.2 (%.813) = impl_witness_access %T.as_wit.loc12_4.2, element0 [symbolic = %impl.elem0.loc12_4.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %specific_fn.loc12_4.2: = specific_function %impl.elem0.loc12_4.2, @Q2(%K2.facet) [symbolic = %specific_fn.loc12_4.2 (constants.%specific_fn)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%T.param_patt: %K2.type, %x.param_patt: @Simple3.%T.as_type.loc11_23.2 (%T.as_type)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.ref: @Simple3.%T.as_type.loc11_23.2 (%T.as_type) = name_ref x, %x +// CHECK:STDOUT: %Q2.ref: %K2.assoc_type = name_ref Q2, @K2.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %T.as_type.loc12: type = facet_access_type constants.%T [symbolic = %T.as_type.loc11_23.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc12_4.1: type = converted constants.%T, %T.as_type.loc12 [symbolic = %T.as_type.loc11_23.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_wit.loc12_4.1: = facet_access_witness constants.%T [symbolic = %T.as_wit.loc12_4.2 (constants.%T.as_wit)] +// CHECK:STDOUT: %impl.elem0.loc12_4.1: @Simple3.%.loc12_4.2 (%.813) = impl_witness_access %T.as_wit.loc12_4.1, element0 [symbolic = %impl.elem0.loc12_4.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %specific_fn.loc12_4.1: = specific_function %impl.elem0.loc12_4.1, @Q2(constants.%K2.facet) [symbolic = %specific_fn.loc12_4.2 (constants.%specific_fn)] +// CHECK:STDOUT: %Q2.call: init %empty_tuple.type = call %specific_fn.loc12_4.1() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Compound3(%V.loc21_14.1: %K2.type) { -// CHECK:STDOUT: %V.loc21_14.2: %K2.type = bind_symbolic_name V, 0 [symbolic = %V.loc21_14.2 (constants.%V)] -// CHECK:STDOUT: %V.patt.loc21_14.2: %K2.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc21_14.2 (constants.%V.patt)] -// CHECK:STDOUT: %V.as_type.loc21_25.2: type = facet_access_type %V.loc21_14.2 [symbolic = %V.as_type.loc21_25.2 (constants.%V.as_type)] +// CHECK:STDOUT: generic fn @Compound3(%V.loc17_14.1: %K2.type) { +// CHECK:STDOUT: %V.loc17_14.2: %K2.type = bind_symbolic_name V, 0 [symbolic = %V.loc17_14.2 (constants.%V)] +// CHECK:STDOUT: %V.patt.loc17_14.2: %K2.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc17_14.2 (constants.%V.patt)] +// CHECK:STDOUT: %V.as_type.loc17_25.2: type = facet_access_type %V.loc17_14.2 [symbolic = %V.as_type.loc17_25.2 (constants.%V.as_type)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type @Compound3.%V.as_type.loc21_25.2 (%V.as_type) [symbolic = %require_complete (constants.%require_complete.022e81.2)] +// CHECK:STDOUT: %require_complete: = require_complete_type @Compound3.%V.as_type.loc17_25.2 (%V.as_type) [symbolic = %require_complete (constants.%require_complete.022e81.2)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%V.param_patt: %K2.type, %y.param_patt: @Compound3.%V.as_type.loc21_25.2 (%V.as_type)) { +// CHECK:STDOUT: fn(%V.param_patt: %K2.type, %y.param_patt: @Compound3.%V.as_type.loc17_25.2 (%V.as_type)) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %y.ref: @Compound3.%V.as_type.loc21_25.2 (%V.as_type) = name_ref y, %y -// CHECK:STDOUT: %K2.ref.loc26: type = name_ref K2, file.%K2.decl [concrete = constants.%K2.type] +// CHECK:STDOUT: %y.ref: @Compound3.%V.as_type.loc17_25.2 (%V.as_type) = name_ref y, %y +// CHECK:STDOUT: %K2.ref.loc22: type = name_ref K2, file.%K2.decl [concrete = constants.%K2.type] // CHECK:STDOUT: %Q2.ref: %K2.assoc_type = name_ref Q2, @K2.%assoc0 [concrete = constants.%assoc0] // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -935,10 +941,14 @@ fn Works() { // CHECK:STDOUT: %T.as_type.loc11_23.2 => constants.%T.as_type // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: specific @Q2(constants.%K2.facet) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Q2(@Simple3.%K2.facet) {} +// CHECK:STDOUT: // CHECK:STDOUT: specific @Compound3(constants.%V) { -// CHECK:STDOUT: %V.loc21_14.2 => constants.%V -// CHECK:STDOUT: %V.patt.loc21_14.2 => constants.%V -// CHECK:STDOUT: %V.as_type.loc21_25.2 => constants.%V.as_type +// CHECK:STDOUT: %V.loc17_14.2 => constants.%V +// CHECK:STDOUT: %V.patt.loc17_14.2 => constants.%V +// CHECK:STDOUT: %V.as_type.loc17_25.2 => constants.%V.as_type // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_todo_instance.carbon @@ -948,10 +958,11 @@ fn Works() { // CHECK:STDOUT: %Self: %L1.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] // CHECK:STDOUT: %R1.type: type = fn_type @R1 [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %R1: %R1.type = struct_value () [concrete] // CHECK:STDOUT: %L1.assoc_type: type = assoc_entity_type %L1.type [concrete] // CHECK:STDOUT: %assoc0: %L1.assoc_type = assoc_entity element0, @L1.%R1.decl [concrete] -// CHECK:STDOUT: %ptr: type = ptr_type %Self.as_type [symbolic] +// CHECK:STDOUT: %ptr.72f01d.1: type = ptr_type %Self.as_type [symbolic] // CHECK:STDOUT: %S1.type: type = fn_type @S1 [concrete] // CHECK:STDOUT: %S1: %S1.type = struct_value () [concrete] // CHECK:STDOUT: %assoc1: %L1.assoc_type = assoc_entity element1, @L1.%S1.decl [concrete] @@ -961,6 +972,14 @@ fn Works() { // CHECK:STDOUT: %Simple4.type: type = fn_type @Simple4 [concrete] // CHECK:STDOUT: %Simple4: %Simple4.type = struct_value () [concrete] // CHECK:STDOUT: %require_complete.97cd40.1: = require_complete_type %T.as_type [symbolic] +// CHECK:STDOUT: %T.as_wit: = facet_access_witness %T [symbolic] +// CHECK:STDOUT: %L1.facet: %L1.type = facet_value %T.as_type, %T.as_wit [symbolic] +// CHECK:STDOUT: %.1e8: type = fn_type_with_self_type %R1.type, %L1.facet [symbolic] +// CHECK:STDOUT: %impl.elem0: %.1e8 = impl_witness_access %T.as_wit, element0 [symbolic] +// CHECK:STDOUT: %.d0e: type = fn_type_with_self_type %S1.type, %L1.facet [symbolic] +// CHECK:STDOUT: %impl.elem1: %.d0e = impl_witness_access %T.as_wit, element1 [symbolic] +// CHECK:STDOUT: %ptr.72f01d.2: type = ptr_type %T.as_type [symbolic] +// CHECK:STDOUT: %require_complete.932: = require_complete_type %ptr.72f01d.2 [symbolic] // CHECK:STDOUT: %V: %L1.type = bind_symbolic_name V, 0 [symbolic] // CHECK:STDOUT: %V.patt: %L1.type = symbolic_binding_pattern V, 0 [symbolic] // CHECK:STDOUT: %V.as_type: type = facet_access_type %V [symbolic] @@ -994,21 +1013,21 @@ fn Works() { // CHECK:STDOUT: %x: @Simple4.%T.as_type.loc10_23.2 (%T.as_type) = bind_name x, %x.param // CHECK:STDOUT: } // CHECK:STDOUT: %Compound4.decl: %Compound4.type = fn_decl @Compound4 [concrete = constants.%Compound4] { -// CHECK:STDOUT: %V.patt.loc25_14.1: %L1.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc25_14.2 (constants.%V.patt)] -// CHECK:STDOUT: %V.param_patt: %L1.type = value_param_pattern %V.patt.loc25_14.1, runtime_param [symbolic = %V.patt.loc25_14.2 (constants.%V.patt)] -// CHECK:STDOUT: %y.patt: @Compound4.%V.as_type.loc25_25.2 (%V.as_type) = binding_pattern y -// CHECK:STDOUT: %y.param_patt: @Compound4.%V.as_type.loc25_25.2 (%V.as_type) = value_param_pattern %y.patt, runtime_param0 +// CHECK:STDOUT: %V.patt.loc17_14.1: %L1.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc17_14.2 (constants.%V.patt)] +// CHECK:STDOUT: %V.param_patt: %L1.type = value_param_pattern %V.patt.loc17_14.1, runtime_param [symbolic = %V.patt.loc17_14.2 (constants.%V.patt)] +// CHECK:STDOUT: %y.patt: @Compound4.%V.as_type.loc17_25.2 (%V.as_type) = binding_pattern y +// CHECK:STDOUT: %y.param_patt: @Compound4.%V.as_type.loc17_25.2 (%V.as_type) = value_param_pattern %y.patt, runtime_param0 // CHECK:STDOUT: } { // CHECK:STDOUT: %V.param: %L1.type = value_param runtime_param -// CHECK:STDOUT: %L1.ref.loc25: type = name_ref L1, file.%L1.decl [concrete = constants.%L1.type] -// CHECK:STDOUT: %V.loc25_14.1: %L1.type = bind_symbolic_name V, 0, %V.param [symbolic = %V.loc25_14.2 (constants.%V)] -// CHECK:STDOUT: %y.param: @Compound4.%V.as_type.loc25_25.2 (%V.as_type) = value_param runtime_param0 -// CHECK:STDOUT: %.loc25_25.1: type = splice_block %.loc25_25.2 [symbolic = %V.as_type.loc25_25.2 (constants.%V.as_type)] { -// CHECK:STDOUT: %V.ref.loc25: %L1.type = name_ref V, %V.loc25_14.1 [symbolic = %V.loc25_14.2 (constants.%V)] -// CHECK:STDOUT: %V.as_type.loc25_25.1: type = facet_access_type %V.ref.loc25 [symbolic = %V.as_type.loc25_25.2 (constants.%V.as_type)] -// CHECK:STDOUT: %.loc25_25.2: type = converted %V.ref.loc25, %V.as_type.loc25_25.1 [symbolic = %V.as_type.loc25_25.2 (constants.%V.as_type)] +// CHECK:STDOUT: %L1.ref.loc17: type = name_ref L1, file.%L1.decl [concrete = constants.%L1.type] +// CHECK:STDOUT: %V.loc17_14.1: %L1.type = bind_symbolic_name V, 0, %V.param [symbolic = %V.loc17_14.2 (constants.%V)] +// CHECK:STDOUT: %y.param: @Compound4.%V.as_type.loc17_25.2 (%V.as_type) = value_param runtime_param0 +// CHECK:STDOUT: %.loc17_25.1: type = splice_block %.loc17_25.2 [symbolic = %V.as_type.loc17_25.2 (constants.%V.as_type)] { +// CHECK:STDOUT: %V.ref.loc17: %L1.type = name_ref V, %V.loc17_14.1 [symbolic = %V.loc17_14.2 (constants.%V)] +// CHECK:STDOUT: %V.as_type.loc17_25.1: type = facet_access_type %V.ref.loc17 [symbolic = %V.as_type.loc17_25.2 (constants.%V.as_type)] +// CHECK:STDOUT: %.loc17_25.2: type = converted %V.ref.loc17, %V.as_type.loc17_25.1 [symbolic = %V.as_type.loc17_25.2 (constants.%V.as_type)] // CHECK:STDOUT: } -// CHECK:STDOUT: %y: @Compound4.%V.as_type.loc25_25.2 (%V.as_type) = bind_name y, %y.param +// CHECK:STDOUT: %y: @Compound4.%V.as_type.loc17_25.2 (%V.as_type) = bind_name y, %y.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1028,18 +1047,18 @@ fn Works() { // CHECK:STDOUT: } // CHECK:STDOUT: %assoc0: %L1.assoc_type = assoc_entity element0, %R1.decl [concrete = constants.%assoc0] // CHECK:STDOUT: %S1.decl: %S1.type = fn_decl @S1 [concrete = constants.%S1] { -// CHECK:STDOUT: %self.patt: @S1.%ptr.loc5_24.1 (%ptr) = binding_pattern self -// CHECK:STDOUT: %self.param_patt: @S1.%ptr.loc5_24.1 (%ptr) = value_param_pattern %self.patt, runtime_param0 +// CHECK:STDOUT: %self.patt: @S1.%ptr.loc5_24.1 (%ptr.72f01d.1) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @S1.%ptr.loc5_24.1 (%ptr.72f01d.1) = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %.loc5_9: auto = addr_pattern %self.param_patt // CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: @S1.%ptr.loc5_24.1 (%ptr) = value_param runtime_param0 -// CHECK:STDOUT: %.loc5_24.1: type = splice_block %ptr.loc5_24.2 [symbolic = %ptr.loc5_24.1 (constants.%ptr)] { +// CHECK:STDOUT: %self.param: @S1.%ptr.loc5_24.1 (%ptr.72f01d.1) = value_param runtime_param0 +// CHECK:STDOUT: %.loc5_24.1: type = splice_block %ptr.loc5_24.2 [symbolic = %ptr.loc5_24.1 (constants.%ptr.72f01d.1)] { // CHECK:STDOUT: %Self.ref: %L1.type = name_ref Self, @L1.%Self [symbolic = %Self (constants.%Self)] // CHECK:STDOUT: %Self.as_type.loc5_24.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_24.1 (constants.%Self.as_type)] // CHECK:STDOUT: %.loc5_24.2: type = converted %Self.ref, %Self.as_type.loc5_24.2 [symbolic = %Self.as_type.loc5_24.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %ptr.loc5_24.2: type = ptr_type %Self.as_type [symbolic = %ptr.loc5_24.1 (constants.%ptr)] +// CHECK:STDOUT: %ptr.loc5_24.2: type = ptr_type %Self.as_type [symbolic = %ptr.loc5_24.1 (constants.%ptr.72f01d.1)] // CHECK:STDOUT: } -// CHECK:STDOUT: %self: @S1.%ptr.loc5_24.1 (%ptr) = bind_name self, %self.param +// CHECK:STDOUT: %self: @S1.%ptr.loc5_24.1 (%ptr.72f01d.1) = bind_name self, %self.param // CHECK:STDOUT: } // CHECK:STDOUT: %assoc1: %L1.assoc_type = assoc_entity element1, %S1.decl [concrete = constants.%assoc1] // CHECK:STDOUT: @@ -1060,9 +1079,9 @@ fn Works() { // CHECK:STDOUT: generic fn @S1(@L1.%Self: %L1.type) { // CHECK:STDOUT: %Self: %L1.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)] // CHECK:STDOUT: %Self.as_type.loc5_24.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_24.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %ptr.loc5_24.1: type = ptr_type @S1.%Self.as_type.loc5_24.1 (%Self.as_type) [symbolic = %ptr.loc5_24.1 (constants.%ptr)] +// CHECK:STDOUT: %ptr.loc5_24.1: type = ptr_type @S1.%Self.as_type.loc5_24.1 (%Self.as_type) [symbolic = %ptr.loc5_24.1 (constants.%ptr.72f01d.1)] // CHECK:STDOUT: -// CHECK:STDOUT: fn[addr %self.param_patt: @S1.%ptr.loc5_24.1 (%ptr)](); +// CHECK:STDOUT: fn[addr %self.param_patt: @S1.%ptr.loc5_24.1 (%ptr.72f01d.1)](); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @Simple4(%T.loc10_12.1: %L1.type) { @@ -1071,57 +1090,82 @@ fn Works() { // CHECK:STDOUT: %T.as_type.loc10_23.2: type = facet_access_type %T.loc10_12.2 [symbolic = %T.as_type.loc10_23.2 (constants.%T.as_type)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type @Simple4.%T.as_type.loc10_23.2 (%T.as_type) [symbolic = %require_complete (constants.%require_complete.97cd40.1)] +// CHECK:STDOUT: %require_complete.loc10: = require_complete_type @Simple4.%T.as_type.loc10_23.2 (%T.as_type) [symbolic = %require_complete.loc10 (constants.%require_complete.97cd40.1)] +// CHECK:STDOUT: %T.as_wit.loc11_4.2: = facet_access_witness %T.loc10_12.2 [symbolic = %T.as_wit.loc11_4.2 (constants.%T.as_wit)] +// CHECK:STDOUT: %L1.facet: %L1.type = facet_value %T.as_type.loc10_23.2, %T.as_wit.loc11_4.2 [symbolic = %L1.facet (constants.%L1.facet)] +// CHECK:STDOUT: %.loc11_4.2: type = fn_type_with_self_type constants.%R1.type, %L1.facet [symbolic = %.loc11_4.2 (constants.%.1e8)] +// CHECK:STDOUT: %impl.elem0.loc11_4.2: @Simple4.%.loc11_4.2 (%.1e8) = impl_witness_access %T.as_wit.loc11_4.2, element0 [symbolic = %impl.elem0.loc11_4.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %.loc13_8.2: type = fn_type_with_self_type constants.%S1.type, %L1.facet [symbolic = %.loc13_8.2 (constants.%.d0e)] +// CHECK:STDOUT: %impl.elem1.loc13_8.2: @Simple4.%.loc13_8.2 (%.d0e) = impl_witness_access %T.as_wit.loc11_4.2, element1 [symbolic = %impl.elem1.loc13_8.2 (constants.%impl.elem1)] +// CHECK:STDOUT: %ptr: type = ptr_type @Simple4.%T.as_type.loc10_23.2 (%T.as_type) [symbolic = %ptr (constants.%ptr.72f01d.2)] +// CHECK:STDOUT: %require_complete.loc13: = require_complete_type @Simple4.%ptr (%ptr.72f01d.2) [symbolic = %require_complete.loc13 (constants.%require_complete.932)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%T.param_patt: %L1.type, %x.param_patt: @Simple4.%T.as_type.loc10_23.2 (%T.as_type)) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %x.ref.loc15: @Simple4.%T.as_type.loc10_23.2 (%T.as_type) = name_ref x, %x +// CHECK:STDOUT: %x.ref.loc11: @Simple4.%T.as_type.loc10_23.2 (%T.as_type) = name_ref x, %x +// CHECK:STDOUT: %R1.ref: %L1.assoc_type = name_ref R1, @L1.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %T.as_type.loc11: type = facet_access_type constants.%T [symbolic = %T.as_type.loc10_23.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc11_4.1: type = converted constants.%T, %T.as_type.loc11 [symbolic = %T.as_type.loc10_23.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_wit.loc11_4.1: = facet_access_witness constants.%T [symbolic = %T.as_wit.loc11_4.2 (constants.%T.as_wit)] +// CHECK:STDOUT: %impl.elem0.loc11_4.1: @Simple4.%.loc11_4.2 (%.1e8) = impl_witness_access %T.as_wit.loc11_4.1, element0 [symbolic = %impl.elem0.loc11_4.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %bound_method.loc11: = bound_method %x.ref.loc11, %impl.elem0.loc11_4.1 +// CHECK:STDOUT: %specific_fn.loc11: = specific_function %bound_method.loc11, @R1(constants.%L1.facet) +// CHECK:STDOUT: %R1.call: init %empty_tuple.type = call %specific_fn.loc11(%x.ref.loc11) // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %xcopy.patt: @Simple4.%T.as_type.loc10_23.2 (%T.as_type) = binding_pattern xcopy -// CHECK:STDOUT: %.loc16_3: @Simple4.%T.as_type.loc10_23.2 (%T.as_type) = var_pattern %xcopy.patt +// CHECK:STDOUT: %.loc12_3: @Simple4.%T.as_type.loc10_23.2 (%T.as_type) = var_pattern %xcopy.patt // CHECK:STDOUT: } // CHECK:STDOUT: %xcopy.var: ref @Simple4.%T.as_type.loc10_23.2 (%T.as_type) = var xcopy -// CHECK:STDOUT: %x.ref.loc16: @Simple4.%T.as_type.loc10_23.2 (%T.as_type) = name_ref x, %x -// CHECK:STDOUT: assign %xcopy.var, %x.ref.loc16 -// CHECK:STDOUT: %.loc16_14.1: type = splice_block %.loc16_14.2 [symbolic = %T.as_type.loc10_23.2 (constants.%T.as_type)] { -// CHECK:STDOUT: %T.ref.loc16: %L1.type = name_ref T, %T.loc10_12.1 [symbolic = %T.loc10_12.2 (constants.%T)] -// CHECK:STDOUT: %T.as_type.loc16: type = facet_access_type %T.ref.loc16 [symbolic = %T.as_type.loc10_23.2 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc16_14.2: type = converted %T.ref.loc16, %T.as_type.loc16 [symbolic = %T.as_type.loc10_23.2 (constants.%T.as_type)] +// CHECK:STDOUT: %x.ref.loc12: @Simple4.%T.as_type.loc10_23.2 (%T.as_type) = name_ref x, %x +// CHECK:STDOUT: assign %xcopy.var, %x.ref.loc12 +// CHECK:STDOUT: %.loc12_14.1: type = splice_block %.loc12_14.2 [symbolic = %T.as_type.loc10_23.2 (constants.%T.as_type)] { +// CHECK:STDOUT: %T.ref.loc12: %L1.type = name_ref T, %T.loc10_12.1 [symbolic = %T.loc10_12.2 (constants.%T)] +// CHECK:STDOUT: %T.as_type.loc12: type = facet_access_type %T.ref.loc12 [symbolic = %T.as_type.loc10_23.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc12_14.2: type = converted %T.ref.loc12, %T.as_type.loc12 [symbolic = %T.as_type.loc10_23.2 (constants.%T.as_type)] // CHECK:STDOUT: } // CHECK:STDOUT: %xcopy: ref @Simple4.%T.as_type.loc10_23.2 (%T.as_type) = bind_name xcopy, %xcopy.var // CHECK:STDOUT: %xcopy.ref: ref @Simple4.%T.as_type.loc10_23.2 (%T.as_type) = name_ref xcopy, %xcopy +// CHECK:STDOUT: %S1.ref: %L1.assoc_type = name_ref S1, @L1.%assoc1 [concrete = constants.%assoc1] +// CHECK:STDOUT: %T.as_type.loc13: type = facet_access_type constants.%T [symbolic = %T.as_type.loc10_23.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc13_8.1: type = converted constants.%T, %T.as_type.loc13 [symbolic = %T.as_type.loc10_23.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_wit.loc13: = facet_access_witness constants.%T [symbolic = %T.as_wit.loc11_4.2 (constants.%T.as_wit)] +// CHECK:STDOUT: %impl.elem1.loc13_8.1: @Simple4.%.loc13_8.2 (%.d0e) = impl_witness_access %T.as_wit.loc13, element1 [symbolic = %impl.elem1.loc13_8.2 (constants.%impl.elem1)] +// CHECK:STDOUT: %bound_method.loc13: = bound_method %xcopy.ref, %impl.elem1.loc13_8.1 +// CHECK:STDOUT: %specific_fn.loc13: = specific_function %bound_method.loc13, @S1(constants.%L1.facet) +// CHECK:STDOUT: %addr: @Simple4.%ptr (%ptr.72f01d.2) = addr_of %xcopy.ref +// CHECK:STDOUT: %S1.call: init %empty_tuple.type = call %specific_fn.loc13(%addr) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Compound4(%V.loc25_14.1: %L1.type) { -// CHECK:STDOUT: %V.loc25_14.2: %L1.type = bind_symbolic_name V, 0 [symbolic = %V.loc25_14.2 (constants.%V)] -// CHECK:STDOUT: %V.patt.loc25_14.2: %L1.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc25_14.2 (constants.%V.patt)] -// CHECK:STDOUT: %V.as_type.loc25_25.2: type = facet_access_type %V.loc25_14.2 [symbolic = %V.as_type.loc25_25.2 (constants.%V.as_type)] +// CHECK:STDOUT: generic fn @Compound4(%V.loc17_14.1: %L1.type) { +// CHECK:STDOUT: %V.loc17_14.2: %L1.type = bind_symbolic_name V, 0 [symbolic = %V.loc17_14.2 (constants.%V)] +// CHECK:STDOUT: %V.patt.loc17_14.2: %L1.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc17_14.2 (constants.%V.patt)] +// CHECK:STDOUT: %V.as_type.loc17_25.2: type = facet_access_type %V.loc17_14.2 [symbolic = %V.as_type.loc17_25.2 (constants.%V.as_type)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type @Compound4.%V.as_type.loc25_25.2 (%V.as_type) [symbolic = %require_complete (constants.%require_complete.97cd40.2)] +// CHECK:STDOUT: %require_complete: = require_complete_type @Compound4.%V.as_type.loc17_25.2 (%V.as_type) [symbolic = %require_complete (constants.%require_complete.97cd40.2)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%V.param_patt: %L1.type, %y.param_patt: @Compound4.%V.as_type.loc25_25.2 (%V.as_type)) { +// CHECK:STDOUT: fn(%V.param_patt: %L1.type, %y.param_patt: @Compound4.%V.as_type.loc17_25.2 (%V.as_type)) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %y.ref.loc30: @Compound4.%V.as_type.loc25_25.2 (%V.as_type) = name_ref y, %y -// CHECK:STDOUT: %L1.ref.loc30: type = name_ref L1, file.%L1.decl [concrete = constants.%L1.type] +// CHECK:STDOUT: %y.ref.loc22: @Compound4.%V.as_type.loc17_25.2 (%V.as_type) = name_ref y, %y +// CHECK:STDOUT: %L1.ref.loc22: type = name_ref L1, file.%L1.decl [concrete = constants.%L1.type] // CHECK:STDOUT: %R1.ref: %L1.assoc_type = name_ref R1, @L1.%assoc0 [concrete = constants.%assoc0] // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %ycopy.patt: @Compound4.%V.as_type.loc25_25.2 (%V.as_type) = binding_pattern ycopy -// CHECK:STDOUT: %.loc31_3: @Compound4.%V.as_type.loc25_25.2 (%V.as_type) = var_pattern %ycopy.patt +// CHECK:STDOUT: %ycopy.patt: @Compound4.%V.as_type.loc17_25.2 (%V.as_type) = binding_pattern ycopy +// CHECK:STDOUT: %.loc23_3: @Compound4.%V.as_type.loc17_25.2 (%V.as_type) = var_pattern %ycopy.patt // CHECK:STDOUT: } -// CHECK:STDOUT: %ycopy.var: ref @Compound4.%V.as_type.loc25_25.2 (%V.as_type) = var ycopy -// CHECK:STDOUT: %y.ref.loc31: @Compound4.%V.as_type.loc25_25.2 (%V.as_type) = name_ref y, %y -// CHECK:STDOUT: assign %ycopy.var, %y.ref.loc31 -// CHECK:STDOUT: %.loc31_14.1: type = splice_block %.loc31_14.2 [symbolic = %V.as_type.loc25_25.2 (constants.%V.as_type)] { -// CHECK:STDOUT: %V.ref.loc31: %L1.type = name_ref V, %V.loc25_14.1 [symbolic = %V.loc25_14.2 (constants.%V)] -// CHECK:STDOUT: %V.as_type.loc31: type = facet_access_type %V.ref.loc31 [symbolic = %V.as_type.loc25_25.2 (constants.%V.as_type)] -// CHECK:STDOUT: %.loc31_14.2: type = converted %V.ref.loc31, %V.as_type.loc31 [symbolic = %V.as_type.loc25_25.2 (constants.%V.as_type)] +// CHECK:STDOUT: %ycopy.var: ref @Compound4.%V.as_type.loc17_25.2 (%V.as_type) = var ycopy +// CHECK:STDOUT: %y.ref.loc23: @Compound4.%V.as_type.loc17_25.2 (%V.as_type) = name_ref y, %y +// CHECK:STDOUT: assign %ycopy.var, %y.ref.loc23 +// CHECK:STDOUT: %.loc23_14.1: type = splice_block %.loc23_14.2 [symbolic = %V.as_type.loc17_25.2 (constants.%V.as_type)] { +// CHECK:STDOUT: %V.ref.loc23: %L1.type = name_ref V, %V.loc17_14.1 [symbolic = %V.loc17_14.2 (constants.%V)] +// CHECK:STDOUT: %V.as_type.loc23: type = facet_access_type %V.ref.loc23 [symbolic = %V.as_type.loc17_25.2 (constants.%V.as_type)] +// CHECK:STDOUT: %.loc23_14.2: type = converted %V.ref.loc23, %V.as_type.loc23 [symbolic = %V.as_type.loc17_25.2 (constants.%V.as_type)] // CHECK:STDOUT: } -// CHECK:STDOUT: %ycopy: ref @Compound4.%V.as_type.loc25_25.2 (%V.as_type) = bind_name ycopy, %ycopy.var -// CHECK:STDOUT: %ycopy.ref: ref @Compound4.%V.as_type.loc25_25.2 (%V.as_type) = name_ref ycopy, %ycopy -// CHECK:STDOUT: %L1.ref.loc36: type = name_ref L1, file.%L1.decl [concrete = constants.%L1.type] +// CHECK:STDOUT: %ycopy: ref @Compound4.%V.as_type.loc17_25.2 (%V.as_type) = bind_name ycopy, %ycopy.var +// CHECK:STDOUT: %ycopy.ref: ref @Compound4.%V.as_type.loc17_25.2 (%V.as_type) = name_ref ycopy, %ycopy +// CHECK:STDOUT: %L1.ref.loc28: type = name_ref L1, file.%L1.decl [concrete = constants.%L1.type] // CHECK:STDOUT: %S1.ref: %L1.assoc_type = name_ref S1, @L1.%assoc1 [concrete = constants.%assoc1] // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -1135,7 +1179,7 @@ fn Works() { // CHECK:STDOUT: specific @S1(constants.%Self) { // CHECK:STDOUT: %Self => constants.%Self // CHECK:STDOUT: %Self.as_type.loc5_24.1 => constants.%Self.as_type -// CHECK:STDOUT: %ptr.loc5_24.1 => constants.%ptr +// CHECK:STDOUT: %ptr.loc5_24.1 => constants.%ptr.72f01d.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Simple4(constants.%T) { @@ -1144,10 +1188,21 @@ fn Works() { // CHECK:STDOUT: %T.as_type.loc10_23.2 => constants.%T.as_type // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: specific @R1(constants.%L1.facet) { +// CHECK:STDOUT: %Self => constants.%L1.facet +// CHECK:STDOUT: %Self.as_type.loc4_15.1 => constants.%T.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @S1(constants.%L1.facet) { +// CHECK:STDOUT: %Self => constants.%L1.facet +// CHECK:STDOUT: %Self.as_type.loc5_24.1 => constants.%T.as_type +// CHECK:STDOUT: %ptr.loc5_24.1 => constants.%ptr.72f01d.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: specific @Compound4(constants.%V) { -// CHECK:STDOUT: %V.loc25_14.2 => constants.%V -// CHECK:STDOUT: %V.patt.loc25_14.2 => constants.%V -// CHECK:STDOUT: %V.as_type.loc25_25.2 => constants.%V.as_type +// CHECK:STDOUT: %V.loc17_14.2 => constants.%V +// CHECK:STDOUT: %V.patt.loc17_14.2 => constants.%V +// CHECK:STDOUT: %V.as_type.loc17_25.2 => constants.%V.as_type // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_interface_instance_caller_not.carbon diff --git a/toolchain/check/testdata/interface/no_prelude/fail_member_lookup.carbon b/toolchain/check/testdata/interface/no_prelude/fail_member_lookup.carbon index 5e48095c927c8..e1c4725ffa172 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_member_lookup.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_member_lookup.carbon @@ -33,7 +33,7 @@ fn F() { // CHECK:STDERR: Interface.F(); - // CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+7]]:10: error: cannot implicitly convert from `` to `type` [ImplicitAsConversionFailure] + // CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+7]]:10: error: cannot implicitly convert value of type `` to `type` [ImplicitAsConversionFailure] // CHECK:STDERR: var v: Interface.T; // CHECK:STDERR: ^~~~~~~~~~~ // CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+4]]:10: note: type `` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote]