diff --git a/toolchain/check/testdata/builtin_conversions/no_prelude/fail_todo_convert_facet_value_to_narrowed_facet_type.carbon b/toolchain/check/testdata/builtin_conversions/no_prelude/fail_todo_convert_facet_value_to_narrowed_facet_type.carbon index 63537a9159196..0ac6f529b5031 100644 --- a/toolchain/check/testdata/builtin_conversions/no_prelude/fail_todo_convert_facet_value_to_narrowed_facet_type.carbon +++ b/toolchain/check/testdata/builtin_conversions/no_prelude/fail_todo_convert_facet_value_to_narrowed_facet_type.carbon @@ -16,6 +16,14 @@ interface ImplicitAs(T:! type) { fn Convert[self: Self]() -> T; } +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"; +} + // --- fail_todo_convert_to_narrowed_facet_type.carbon library "[[@TEST_NAME]]"; @@ -27,9 +35,15 @@ interface Animal {} fn Feed[T:! Eats](e: T) {} -// CHECK:STDERR: fail_todo_convert_to_narrowed_facet_type.carbon:[[@LINE+4]]:21: error: name `Core.BitAnd` implicitly referenced here, but not found [CoreNameNotFound] +// CHECK:STDERR: fail_todo_convert_to_narrowed_facet_type.carbon:[[@LINE+10]]:44: error: cannot implicitly convert value of type `type` to `Eats` [ImplicitAsConversionFailure] // CHECK:STDERR: fn HandleAnimal[T:! Animal & Eats](a: T) { Feed(a); } -// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_todo_convert_to_narrowed_facet_type.carbon:[[@LINE+7]]:44: note: type `type` does not implement interface `Core.ImplicitAs(Eats)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fn HandleAnimal[T:! Animal & Eats](a: T) { Feed(a); } +// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_todo_convert_to_narrowed_facet_type.carbon:[[@LINE-8]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] +// CHECK:STDERR: fn Feed[T:! Eats](e: T) {} +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fn HandleAnimal[T:! Animal & Eats](a: T) { Feed(a); } @@ -41,23 +55,45 @@ fn HandleAnimal[T:! Animal & Eats](a: T) { Feed(a); } // 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(%T)> [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: %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: type = fn_type @Convert, @ImplicitAs(%T) [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: %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: %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: .ImplicitAs = %ImplicitAs.decl +// CHECK:STDOUT: .BitAnd = %BitAnd.decl // CHECK:STDOUT: } // CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { // CHECK:STDOUT: %T.patt.loc4_22.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_22.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %T.loc4_22.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_22.2 (constants.%T)] // CHECK:STDOUT: } +// CHECK:STDOUT: %BitAnd.decl: type = interface_decl @BitAnd [concrete = constants.%BitAnd.type] {} {} +// CHECK:STDOUT: impl_decl @impl [concrete] { +// CHECK:STDOUT: %T.patt.loc12_14.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc12_14.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc12_14.1 [symbolic = %T.loc12_14.2 (constants.%T)] +// CHECK:STDOUT: %BitAnd.ref: type = name_ref BitAnd, file.%BitAnd.decl [concrete = constants.%BitAnd.type] +// CHECK:STDOUT: %T.loc12_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc12_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 @ImplicitAs(%T.loc4_22.1: type) { @@ -66,33 +102,33 @@ fn HandleAnimal[T:! Animal & Eats](a: T) { Feed(a); } // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%T.loc4_22.2)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.07f)] -// CHECK:STDOUT: %Self.2: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] +// CHECK:STDOUT: %Self.2: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.0f3)] // CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%T.loc4_22.2) [symbolic = %Convert.type (constants.%Convert.type)] // CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type) = struct_value () [symbolic = %Convert (constants.%Convert)] // CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type)] -// CHECK:STDOUT: %assoc0.loc5_32.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc5_32.2 (constants.%assoc0)] +// CHECK:STDOUT: %assoc0.loc5_32.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc5_32.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)] +// 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) = fn_decl @Convert [symbolic = @ImplicitAs.%Convert (constants.%Convert)] { -// CHECK:STDOUT: %self.patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = binding_pattern self -// CHECK:STDOUT: %self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = value_param_pattern %self.patt, call_param0 +// CHECK:STDOUT: %self.patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type.419) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type.419) = value_param_pattern %self.patt, call_param0 // CHECK:STDOUT: %return.patt: @Convert.%T (%T) = return_slot_pattern // CHECK:STDOUT: %return.param_patt: @Convert.%T (%T) = out_param_pattern %return.patt, call_param1 // CHECK:STDOUT: } { // CHECK:STDOUT: %T.ref: type = name_ref T, @ImplicitAs.%T.loc4_22.1 [symbolic = %T (constants.%T)] -// CHECK:STDOUT: %self.param: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc5_20.1: type = splice_block %.loc5_20.3 [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] { -// CHECK:STDOUT: %.loc5_20.2: @Convert.%ImplicitAs.type (%ImplicitAs.type.07f) = specific_constant @ImplicitAs.%Self.1, @ImplicitAs(constants.%T) [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.ref: @Convert.%ImplicitAs.type (%ImplicitAs.type.07f) = name_ref Self, %.loc5_20.2 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc5_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc5_20.3: type = converted %Self.ref, %Self.as_type.loc5_20.2 [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %self.param: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type.419) = value_param call_param0 +// CHECK:STDOUT: %.loc5_20.1: type = splice_block %.loc5_20.3 [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type.419)] { +// CHECK:STDOUT: %.loc5_20.2: @Convert.%ImplicitAs.type (%ImplicitAs.type.07f) = specific_constant @ImplicitAs.%Self.1, @ImplicitAs(constants.%T) [symbolic = %Self (constants.%Self.0f3)] +// CHECK:STDOUT: %Self.ref: @Convert.%ImplicitAs.type (%ImplicitAs.type.07f) = name_ref Self, %.loc5_20.2 [symbolic = %Self (constants.%Self.0f3)] +// CHECK:STDOUT: %Self.as_type.loc5_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: %.loc5_20.3: type = converted %Self.ref, %Self.as_type.loc5_20.2 [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type.419)] // CHECK:STDOUT: } -// CHECK:STDOUT: %self: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = bind_name self, %self.param +// CHECK:STDOUT: %self: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type.419) = bind_name self, %self.param // CHECK:STDOUT: %return.param: ref @Convert.%T (%T) = out_param call_param1 // CHECK:STDOUT: %return: ref @Convert.%T (%T) = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %assoc0.loc5_32.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc5_32.2 (constants.%assoc0)] +// CHECK:STDOUT: %assoc0.loc5_32.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc5_32.2 (constants.%assoc0.a50)] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self.1 @@ -102,13 +138,102 @@ fn HandleAnimal[T:! Animal & Eats](a: T) { Feed(a); } // 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.loc9_15.1 (%Self.as_type.560) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Op.1.%Self.as_type.loc9_15.1 (%Self.as_type.560) = value_param_pattern %self.patt, call_param0 +// CHECK:STDOUT: %other.patt: @Op.1.%Self.as_type.loc9_15.1 (%Self.as_type.560) = binding_pattern other +// CHECK:STDOUT: %other.param_patt: @Op.1.%Self.as_type.loc9_15.1 (%Self.as_type.560) = value_param_pattern %other.patt, call_param1 +// CHECK:STDOUT: %return.patt: @Op.1.%Self.as_type.loc9_15.1 (%Self.as_type.560) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Op.1.%Self.as_type.loc9_15.1 (%Self.as_type.560) = out_param_pattern %return.patt, call_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Self.ref.loc9_37: %BitAnd.type = name_ref Self, @BitAnd.%Self [symbolic = %Self (constants.%Self.e44)] +// CHECK:STDOUT: %Self.as_type.loc9_37: type = facet_access_type %Self.ref.loc9_37 [symbolic = %Self.as_type.loc9_15.1 (constants.%Self.as_type.560)] +// CHECK:STDOUT: %.loc9_37: type = converted %Self.ref.loc9_37, %Self.as_type.loc9_37 [symbolic = %Self.as_type.loc9_15.1 (constants.%Self.as_type.560)] +// CHECK:STDOUT: %self.param: @Op.1.%Self.as_type.loc9_15.1 (%Self.as_type.560) = value_param call_param0 +// CHECK:STDOUT: %.loc9_15.1: type = splice_block %.loc9_15.2 [symbolic = %Self.as_type.loc9_15.1 (constants.%Self.as_type.560)] { +// CHECK:STDOUT: %Self.ref.loc9_15: %BitAnd.type = name_ref Self, @BitAnd.%Self [symbolic = %Self (constants.%Self.e44)] +// CHECK:STDOUT: %Self.as_type.loc9_15.2: type = facet_access_type %Self.ref.loc9_15 [symbolic = %Self.as_type.loc9_15.1 (constants.%Self.as_type.560)] +// CHECK:STDOUT: %.loc9_15.2: type = converted %Self.ref.loc9_15, %Self.as_type.loc9_15.2 [symbolic = %Self.as_type.loc9_15.1 (constants.%Self.as_type.560)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Op.1.%Self.as_type.loc9_15.1 (%Self.as_type.560) = bind_name self, %self.param +// CHECK:STDOUT: %other.param: @Op.1.%Self.as_type.loc9_15.1 (%Self.as_type.560) = value_param call_param1 +// CHECK:STDOUT: %.loc9_28.1: type = splice_block %.loc9_28.2 [symbolic = %Self.as_type.loc9_15.1 (constants.%Self.as_type.560)] { +// CHECK:STDOUT: %Self.ref.loc9_28: %BitAnd.type = name_ref Self, @BitAnd.%Self [symbolic = %Self (constants.%Self.e44)] +// CHECK:STDOUT: %Self.as_type.loc9_28: type = facet_access_type %Self.ref.loc9_28 [symbolic = %Self.as_type.loc9_15.1 (constants.%Self.as_type.560)] +// CHECK:STDOUT: %.loc9_28.2: type = converted %Self.ref.loc9_28, %Self.as_type.loc9_28 [symbolic = %Self.as_type.loc9_15.1 (constants.%Self.as_type.560)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %other: @Op.1.%Self.as_type.loc9_15.1 (%Self.as_type.560) = bind_name other, %other.param +// CHECK:STDOUT: %return.param: ref @Op.1.%Self.as_type.loc9_15.1 (%Self.as_type.560) = out_param call_param2 +// CHECK:STDOUT: %return: ref @Op.1.%Self.as_type.loc9_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.loc12_14.1: type) { +// CHECK:STDOUT: %T.loc12_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc12_14.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc12_14.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc12_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %impl_witness: = impl_witness (%Op.decl), @impl(%T.loc12_14.2) [symbolic = %impl_witness (constants.%impl_witness)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Op.type: type = fn_type @Op.2, @impl(%T.loc12_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.loc12_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, call_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, call_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, call_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Self.ref.loc13_37: type = name_ref Self, @impl.%T.ref [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %self.param: @Op.2.%T (%T) = value_param call_param0 +// CHECK:STDOUT: %Self.ref.loc13_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 call_param1 +// CHECK:STDOUT: %Self.ref.loc13_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 call_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(@ImplicitAs.%T.loc4_22.1: type, @ImplicitAs.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f)) { // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%T)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.07f)] -// CHECK:STDOUT: %Self: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc5_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.0f3)] +// CHECK:STDOUT: %Self.as_type.loc5_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type.419)] // CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type)]() -> @Convert.%T (%T); +// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type.419)]() -> @Convert.%T (%T); +// 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.loc9_15.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_15.1 (constants.%Self.as_type.560)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Op.1.%Self.as_type.loc9_15.1 (%Self.as_type.560)](%other.param_patt: @Op.1.%Self.as_type.loc9_15.1 (%Self.as_type.560)) -> @Op.1.%Self.as_type.loc9_15.1 (%Self.as_type.560); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Op.2(@impl.%T.loc12_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 @ImplicitAs(constants.%T) { @@ -116,17 +241,39 @@ fn HandleAnimal[T:! Animal & Eats](a: T) { Feed(a); } // CHECK:STDOUT: %T.patt.loc4_22.2 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Convert(constants.%T, constants.%Self) { +// CHECK:STDOUT: specific @Convert(constants.%T, constants.%Self.0f3) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.07f -// CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.as_type.loc5_20.1 => constants.%Self.as_type +// CHECK:STDOUT: %Self => constants.%Self.0f3 +// CHECK:STDOUT: %Self.as_type.loc5_20.1 => constants.%Self.as_type.419 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @ImplicitAs(@Convert.%T) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @ImplicitAs(%T.loc4_22.2) {} // CHECK:STDOUT: +// CHECK:STDOUT: specific @Op.1(constants.%Self.e44) { +// CHECK:STDOUT: %Self => constants.%Self.e44 +// CHECK:STDOUT: %Self.as_type.loc9_15.1 => constants.%Self.as_type.560 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl(constants.%T) { +// CHECK:STDOUT: %T.loc12_14.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc12_14.2 => constants.%T +// CHECK:STDOUT: %impl_witness => constants.%impl_witness +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl(%T.loc12_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.loc9_15.1 => constants.%T +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_todo_convert_to_narrowed_facet_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -134,22 +281,78 @@ fn HandleAnimal[T:! Animal & Eats](a: T) { Feed(a); } // CHECK:STDOUT: %Self.1b5: %Eats.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %Animal.type: type = facet_type <@Animal> [concrete] // CHECK:STDOUT: %Self.fd4: %Animal.type = bind_symbolic_name Self, 0 [symbolic] -// CHECK:STDOUT: %T: %Eats.type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.1b5: %Eats.type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %T.patt.6be: %Eats.type = symbolic_binding_pattern T, 0 [symbolic] -// CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic] +// CHECK:STDOUT: %T.as_type.27d: type = facet_access_type %T.1b5 [symbolic] // CHECK:STDOUT: %Feed.type: type = fn_type @Feed [concrete] // CHECK:STDOUT: %Feed: %Feed.type = struct_value () [concrete] -// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type [symbolic] -// CHECK:STDOUT: %T.patt.e01: = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %require_complete.c75: = require_complete_type %T.as_type.27d [symbolic] +// 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: %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.db8: = impl_witness (imports.%Core.import_ref.1e6), @impl(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.type.f99: type = fn_type @Op.1, @impl(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.05a: %Op.type.f99 = struct_value () [symbolic] +// CHECK:STDOUT: %require_complete.4ae: = require_complete_type %T.8b3 [symbolic] +// CHECK:STDOUT: %impl_witness.3ea: = impl_witness (imports.%Core.import_ref.1e6), @impl(type) [concrete] +// CHECK:STDOUT: %impl_witness.b81: = impl_witness (imports.%Core.import_ref.bd4), @impl(%T.8b3) [symbolic] +// CHECK:STDOUT: %Op.type.eb8: type = fn_type @Op.1, @impl(type) [concrete] +// CHECK:STDOUT: %Op.444: %Op.type.eb8 = struct_value () [concrete] +// CHECK:STDOUT: %complete_type: = complete_type_witness type [concrete] +// CHECK:STDOUT: %Op.type.27a: type = fn_type @Op.2 [concrete] +// CHECK:STDOUT: %Self.as_type.19f: 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 %Animal.type, %Op.444 [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.bound, @Op.1(type) [concrete] +// CHECK:STDOUT: %facet_type: type = facet_type <@Eats & @Animal> [concrete] +// CHECK:STDOUT: %T.ec1: %facet_type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.patt.cdd: %facet_type = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %T.as_type.3bf: type = facet_access_type %T.ec1 [symbolic] // CHECK:STDOUT: %HandleAnimal.type: type = fn_type @HandleAnimal [concrete] // CHECK:STDOUT: %HandleAnimal: %HandleAnimal.type = struct_value () [concrete] +// CHECK:STDOUT: %require_complete.680: = require_complete_type %T.as_type.3bf [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.d62: type = facet_type <@ImplicitAs, @ImplicitAs(%T.8b3)> [symbolic] +// CHECK:STDOUT: %Self.519: %ImplicitAs.type.d62 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Convert.type.275: type = fn_type @Convert, @ImplicitAs(%T.8b3) [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.af9: type = facet_type <@ImplicitAs, @ImplicitAs(%Eats.type)> [concrete] +// CHECK:STDOUT: %Convert.type.9a9: type = fn_type @Convert, @ImplicitAs(%Eats.type) [concrete] +// CHECK:STDOUT: %Convert.35d: %Convert.type.9a9 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.assoc_type.9a7: type = assoc_entity_type %ImplicitAs.type.af9 [concrete] +// CHECK:STDOUT: %assoc0.152: %ImplicitAs.assoc_type.9a7 = 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 = +// 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, inst59 [no loc], unloaded +// CHECK:STDOUT: %Core.import_ref.08d: %BitAnd.assoc_type = import_ref Core//default, loc9_41, loaded [concrete = constants.%assoc0.a63] +// CHECK:STDOUT: %Core.Op = import_ref Core//default, Op, unloaded +// CHECK:STDOUT: %Core.import_ref.51c: = import_ref Core//default, loc12_36, loaded [symbolic = @impl.%impl_witness (constants.%impl_witness.b81)] +// CHECK:STDOUT: %Core.import_ref.5ab3ec.1: type = import_ref Core//default, loc12_14, loaded [symbolic = @impl.%T (constants.%T.8b3)] +// CHECK:STDOUT: %Core.import_ref.583: type = import_ref Core//default, loc12_24, loaded [symbolic = @impl.%T (constants.%T.8b3)] +// CHECK:STDOUT: %Core.import_ref.9c1: type = import_ref Core//default, loc12_29, loaded [concrete = constants.%BitAnd.type] +// CHECK:STDOUT: %Core.import_ref.1e6: @impl.%Op.type (%Op.type.f99) = import_ref Core//default, loc13_42, loaded [symbolic = @impl.%Op (constants.%Op.05a)] +// CHECK:STDOUT: %Core.import_ref.5ab3ec.2: type = import_ref Core//default, loc12_14, loaded [symbolic = @impl.%T (constants.%T.8b3)] +// CHECK:STDOUT: %Core.import_ref.040: %BitAnd.type = import_ref Core//default, inst59 [no loc], loaded [symbolic = constants.%Self.25f] +// CHECK:STDOUT: %Core.import_ref.5ab3ec.3: type = import_ref Core//default, loc4_22, loaded [symbolic = @ImplicitAs.%T (constants.%T.8b3)] +// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst24 [no loc], unloaded +// CHECK:STDOUT: %Core.import_ref.630: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = import_ref Core//default, loc5_32, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.43db8b.2)] +// CHECK:STDOUT: %Core.Convert = import_ref Core//default, Convert, unloaded +// CHECK:STDOUT: %Core.import_ref.5ab3ec.4: type = import_ref Core//default, loc4_22, loaded [symbolic = @ImplicitAs.%T (constants.%T.8b3)] +// CHECK:STDOUT: %Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) = import_ref Core//default, inst24 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] +// CHECK:STDOUT: %Core.import_ref.207961.1 = import_ref Core//default, loc5_32, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -165,32 +368,42 @@ fn HandleAnimal[T:! Animal & Eats](a: T) { Feed(a); } // CHECK:STDOUT: %Animal.decl: type = interface_decl @Animal [concrete = constants.%Animal.type] {} {} // CHECK:STDOUT: %Feed.decl: %Feed.type = fn_decl @Feed [concrete = constants.%Feed] { // CHECK:STDOUT: %T.patt.loc9_9.1: %Eats.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_9.2 (constants.%T.patt.6be)] -// CHECK:STDOUT: %e.patt: @Feed.%T.as_type.loc9_22.2 (%T.as_type) = binding_pattern e -// CHECK:STDOUT: %e.param_patt: @Feed.%T.as_type.loc9_22.2 (%T.as_type) = value_param_pattern %e.patt, call_param0 +// CHECK:STDOUT: %e.patt: @Feed.%T.as_type.loc9_22.2 (%T.as_type.27d) = binding_pattern e +// CHECK:STDOUT: %e.param_patt: @Feed.%T.as_type.loc9_22.2 (%T.as_type.27d) = value_param_pattern %e.patt, call_param0 // CHECK:STDOUT: } { // CHECK:STDOUT: %Eats.ref: type = name_ref Eats, file.%Eats.decl [concrete = constants.%Eats.type] -// CHECK:STDOUT: %T.loc9_9.1: %Eats.type = bind_symbolic_name T, 0 [symbolic = %T.loc9_9.2 (constants.%T)] -// CHECK:STDOUT: %e.param: @Feed.%T.as_type.loc9_22.2 (%T.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc9_22.1: type = splice_block %.loc9_22.2 [symbolic = %T.as_type.loc9_22.2 (constants.%T.as_type)] { -// CHECK:STDOUT: %T.ref: %Eats.type = name_ref T, %T.loc9_9.1 [symbolic = %T.loc9_9.2 (constants.%T)] -// CHECK:STDOUT: %T.as_type.loc9_22.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc9_22.2 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc9_22.2: type = converted %T.ref, %T.as_type.loc9_22.1 [symbolic = %T.as_type.loc9_22.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.loc9_9.1: %Eats.type = bind_symbolic_name T, 0 [symbolic = %T.loc9_9.2 (constants.%T.1b5)] +// CHECK:STDOUT: %e.param: @Feed.%T.as_type.loc9_22.2 (%T.as_type.27d) = value_param call_param0 +// CHECK:STDOUT: %.loc9_22.1: type = splice_block %.loc9_22.2 [symbolic = %T.as_type.loc9_22.2 (constants.%T.as_type.27d)] { +// CHECK:STDOUT: %T.ref: %Eats.type = name_ref T, %T.loc9_9.1 [symbolic = %T.loc9_9.2 (constants.%T.1b5)] +// CHECK:STDOUT: %T.as_type.loc9_22.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc9_22.2 (constants.%T.as_type.27d)] +// CHECK:STDOUT: %.loc9_22.2: type = converted %T.ref, %T.as_type.loc9_22.1 [symbolic = %T.as_type.loc9_22.2 (constants.%T.as_type.27d)] // CHECK:STDOUT: } -// CHECK:STDOUT: %e: @Feed.%T.as_type.loc9_22.2 (%T.as_type) = bind_name e, %e.param +// CHECK:STDOUT: %e: @Feed.%T.as_type.loc9_22.2 (%T.as_type.27d) = bind_name e, %e.param // CHECK:STDOUT: } // CHECK:STDOUT: %HandleAnimal.decl: %HandleAnimal.type = fn_decl @HandleAnimal [concrete = constants.%HandleAnimal] { -// CHECK:STDOUT: %T.patt.loc15_17.1: = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_17.2 (constants.%T.patt.e01)] -// CHECK:STDOUT: %a.patt: = binding_pattern a -// CHECK:STDOUT: %a.param_patt: = value_param_pattern %a.patt, call_param0 [concrete = ] +// CHECK:STDOUT: %T.patt.loc21_17.1: %facet_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc21_17.2 (constants.%T.patt.cdd)] +// CHECK:STDOUT: %a.patt: @HandleAnimal.%T.as_type.loc21_39.2 (%T.as_type.3bf) = binding_pattern a +// CHECK:STDOUT: %a.param_patt: @HandleAnimal.%T.as_type.loc21_39.2 (%T.as_type.3bf) = value_param_pattern %a.patt, call_param0 // CHECK:STDOUT: } { -// CHECK:STDOUT: %.1: = splice_block [concrete = ] { +// CHECK:STDOUT: %.loc21_28.1: type = splice_block %.loc21_28.3 [concrete = constants.%facet_type] { // CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] // CHECK:STDOUT: %Eats.ref: type = name_ref Eats, file.%Eats.decl [concrete = constants.%Eats.type] +// CHECK:STDOUT: %impl.elem0: %.d4d = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] +// CHECK:STDOUT: %bound_method: = bound_method %Animal.ref, %impl.elem0 [concrete = constants.%Op.bound] +// CHECK:STDOUT: %specific_fn: = specific_function %bound_method, @Op.1(type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %type.and: init type = call %specific_fn(%Animal.ref, %Eats.ref) [concrete = constants.%facet_type] +// CHECK:STDOUT: %.loc21_28.2: type = value_of_initializer %type.and [concrete = constants.%facet_type] +// CHECK:STDOUT: %.loc21_28.3: type = converted %type.and, %.loc21_28.2 [concrete = constants.%facet_type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T: = bind_symbolic_name T, 0 [concrete = ] -// CHECK:STDOUT: %a.param: = value_param call_param0 -// CHECK:STDOUT: %T.ref: = name_ref T, %T [concrete = ] -// CHECK:STDOUT: %a: = bind_name a, %a.param +// CHECK:STDOUT: %T.loc21_17.1: %facet_type = bind_symbolic_name T, 0 [symbolic = %T.loc21_17.2 (constants.%T.ec1)] +// CHECK:STDOUT: %a.param: @HandleAnimal.%T.as_type.loc21_39.2 (%T.as_type.3bf) = value_param call_param0 +// CHECK:STDOUT: %.loc21_39.1: type = splice_block %.loc21_39.2 [symbolic = %T.as_type.loc21_39.2 (constants.%T.as_type.3bf)] { +// CHECK:STDOUT: %T.ref: %facet_type = name_ref T, %T.loc21_17.1 [symbolic = %T.loc21_17.2 (constants.%T.ec1)] +// CHECK:STDOUT: %T.as_type.loc21_39.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc21_39.2 (constants.%T.as_type.3bf)] +// CHECK:STDOUT: %.loc21_39.2: type = converted %T.ref, %T.as_type.loc21_39.1 [symbolic = %T.as_type.loc21_39.2 (constants.%T.as_type.3bf)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: @HandleAnimal.%T.as_type.loc21_39.2 (%T.as_type.3bf) = bind_name a, %a.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -210,40 +423,176 @@ fn HandleAnimal[T:! Animal & Eats](a: T) { Feed(a); } // CHECK:STDOUT: witness = () // 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.5ab3ec.3: 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: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%T)> [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(%T) [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: generic impl @impl(imports.%Core.import_ref.5ab3ec.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.1e6), @impl(%T) [symbolic = %impl_witness (constants.%impl_witness.db8)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Op.type: type = fn_type @Op.1, @impl(%T) [symbolic = %Op.type (constants.%Op.type.f99)] +// CHECK:STDOUT: %Op: @impl.%Op.type (%Op.type.f99) = struct_value () [symbolic = %Op (constants.%Op.05a)] +// 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.583 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: generic fn @Feed(%T.loc9_9.1: %Eats.type) { -// CHECK:STDOUT: %T.loc9_9.2: %Eats.type = bind_symbolic_name T, 0 [symbolic = %T.loc9_9.2 (constants.%T)] +// CHECK:STDOUT: %T.loc9_9.2: %Eats.type = bind_symbolic_name T, 0 [symbolic = %T.loc9_9.2 (constants.%T.1b5)] // CHECK:STDOUT: %T.patt.loc9_9.2: %Eats.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_9.2 (constants.%T.patt.6be)] -// CHECK:STDOUT: %T.as_type.loc9_22.2: type = facet_access_type %T.loc9_9.2 [symbolic = %T.as_type.loc9_22.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_type.loc9_22.2: type = facet_access_type %T.loc9_9.2 [symbolic = %T.as_type.loc9_22.2 (constants.%T.as_type.27d)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type @Feed.%T.as_type.loc9_22.2 (%T.as_type) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type @Feed.%T.as_type.loc9_22.2 (%T.as_type.27d) [symbolic = %require_complete (constants.%require_complete.c75)] // CHECK:STDOUT: -// CHECK:STDOUT: fn[%T.patt.loc9_9.1: %Eats.type](%e.param_patt: @Feed.%T.as_type.loc9_22.2 (%T.as_type)) { +// CHECK:STDOUT: fn[%T.patt.loc9_9.1: %Eats.type](%e.param_patt: @Feed.%T.as_type.loc9_22.2 (%T.as_type.27d)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @HandleAnimal(%T: ) { -// CHECK:STDOUT: %T.patt.loc15_17.2: = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_17.2 (constants.%T.patt.e01)] +// CHECK:STDOUT: generic fn @Op.1(imports.%Core.import_ref.5ab3ec.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[%T.patt.loc15_17.1: ](%a.param_patt: ) { +// CHECK:STDOUT: fn[%self.param_patt: @Op.1.%T (%T.8b3)](%other.param_patt: @Op.1.%T (%T.8b3)) -> @Op.1.%T (%T.8b3) = "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.19f)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Op.2.%Self.as_type (%Self.as_type.19f)](%other.param_patt: @Op.2.%Self.as_type (%Self.as_type.19f)) -> @Op.2.%Self.as_type (%Self.as_type.19f); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @HandleAnimal(%T.loc21_17.1: %facet_type) { +// CHECK:STDOUT: %T.loc21_17.2: %facet_type = bind_symbolic_name T, 0 [symbolic = %T.loc21_17.2 (constants.%T.ec1)] +// CHECK:STDOUT: %T.patt.loc21_17.2: %facet_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc21_17.2 (constants.%T.patt.cdd)] +// CHECK:STDOUT: %T.as_type.loc21_39.2: type = facet_access_type %T.loc21_17.2 [symbolic = %T.as_type.loc21_39.2 (constants.%T.as_type.3bf)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @HandleAnimal.%T.as_type.loc21_39.2 (%T.as_type.3bf) [symbolic = %require_complete (constants.%require_complete.680)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%T.patt.loc21_17.1: %facet_type](%a.param_patt: @HandleAnimal.%T.as_type.loc21_39.2 (%T.as_type.3bf)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Feed.ref: %Feed.type = name_ref Feed, file.%Feed.decl [concrete = constants.%Feed] -// CHECK:STDOUT: %a.ref: = name_ref a, %a [concrete = ] +// CHECK:STDOUT: %a.ref: @HandleAnimal.%T.as_type.loc21_39.2 (%T.as_type.3bf) = name_ref a, %a +// CHECK:STDOUT: %.loc21_50: %Eats.type = converted constants.%T.as_type.3bf, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Feed(constants.%T) { -// CHECK:STDOUT: %T.loc9_9.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc9_9.2 => constants.%T -// CHECK:STDOUT: %T.as_type.loc9_22.2 => constants.%T.as_type +// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.5ab3ec.4: type, imports.%Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62)) [from "core.carbon"] { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T.8b3)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%T)> [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.%T (%T.8b3); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Feed(constants.%T.1b5) { +// CHECK:STDOUT: %T.loc9_9.2 => constants.%T.1b5 +// CHECK:STDOUT: %T.patt.loc9_9.2 => constants.%T.1b5 +// CHECK:STDOUT: %T.as_type.loc9_22.2 => constants.%T.as_type.27d +// 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.db8 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl(%T) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Op.1(constants.%T.8b3) { +// CHECK:STDOUT: %T => constants.%T.8b3 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @HandleAnimal() { -// CHECK:STDOUT: %T.patt.loc15_17.2 => +// CHECK:STDOUT: specific @impl(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 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Op.2(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 @Op.1(type) { +// CHECK:STDOUT: %T => type +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @HandleAnimal(constants.%T.ec1) { +// CHECK:STDOUT: %T.loc21_17.2 => constants.%T.ec1 +// CHECK:STDOUT: %T.patt.loc21_17.2 => constants.%T.ec1 +// CHECK:STDOUT: %T.as_type.loc21_39.2 => constants.%T.as_type.3bf +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%T.8b3) { +// CHECK:STDOUT: %T => constants.%T.8b3 +// CHECK:STDOUT: %T.patt => constants.%T.8b3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(%T) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@Convert.%T) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert(constants.%T.8b3, constants.%Self.519) { +// CHECK:STDOUT: %T => constants.%T.8b3 +// 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.%Eats.type) { +// CHECK:STDOUT: %T => constants.%Eats.type +// CHECK:STDOUT: %T.patt => constants.%Eats.type +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.af9 +// CHECK:STDOUT: %Self => constants.%Self.519 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.9a9 +// CHECK:STDOUT: %Convert => constants.%Convert.35d +// CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.9a7 +// CHECK:STDOUT: %assoc0 => constants.%assoc0.152 // CHECK:STDOUT: } // CHECK:STDOUT: