From d8d2da4ea0246b2bdddaa4bdcb19190d63a23d23 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 17 Mar 2025 11:27:41 -0400 Subject: [PATCH] Make conversion tests into min_prelude tests (#5106) Avoid duplicating a `Core` package into each test, point them to //toolchain/testing/min_prelude/convert.carbon which we add in this PR with the As and ImplicitAs interfaces. Move the tests of facet conversions from builtin_conversions/ to facet/ and the test of deducing through a member access into deduce/. This eliminates the check/testdata/builtin_conversions/ directory, which was making it hard to find where tests are for facet conversions. Now we have one fewer place, and facet/ seems to be a fine home for them. --- .../convert_class_type_to_facet_type.carbon | 120 -- ...rt_class_value_to_facet_value_value.carbon | 261 ---- .../convert_facet_value_to_itself.carbon | 281 ----- ...t_facet_value_value_to_blanket_impl.carbon | 330 ----- ..._value_to_generic_facet_value_value.carbon | 630 ---------- ...convert_facet_value_value_to_itself.carbon | 322 ----- .../no_prelude/convert_interface.carbon | 97 -- ...convert_facet_value_to_missing_impl.carbon | 345 ------ .../value_with_type_through_access.carbon | 4 +- .../convert_class_type_to_facet_type.carbon | 307 +++++ ...t_class_type_to_generic_facet_value.carbon | 565 +++++---- ...rt_class_value_to_facet_value_value.carbon | 332 +++++ ..._value_to_generic_facet_value_value.carbon | 1085 +++++++++-------- ...t_value_as_type_knows_original_type.carbon | 523 ++++---- .../convert_facet_value_to_facet_value.carbon | 4 +- .../convert_facet_value_to_itself.carbon | 352 ++++++ ..._facet_value_to_narrowed_facet_type.carbon | 4 +- ...t_facet_value_value_to_blanket_impl.carbon | 401 ++++++ ..._value_to_generic_facet_value_value.carbon | 701 +++++++++++ ...convert_facet_value_value_to_itself.carbon | 393 ++++++ .../min_prelude/convert_interface.carbon | 284 +++++ ...t_class_type_to_generic_facet_value.carbon | 403 +++--- ...t_value_shouldnt_know_concrete_type.carbon | 425 ++++--- ...convert_facet_value_to_missing_impl.carbon | 416 +++++++ ...l_convert_type_erased_type_to_facet.carbon | 415 +++---- ...uction_uses_runtime_type_conversion.carbon | 453 ++++--- toolchain/testing/min_prelude/convert.carbon | 15 + 27 files changed, 5266 insertions(+), 4202 deletions(-) delete mode 100644 toolchain/check/testdata/builtin_conversions/no_prelude/convert_class_type_to_facet_type.carbon delete mode 100644 toolchain/check/testdata/builtin_conversions/no_prelude/convert_class_value_to_facet_value_value.carbon delete mode 100644 toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_to_itself.carbon delete mode 100644 toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_value_to_blanket_impl.carbon delete mode 100644 toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_value_to_generic_facet_value_value.carbon delete mode 100644 toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_value_to_itself.carbon delete mode 100644 toolchain/check/testdata/builtin_conversions/no_prelude/convert_interface.carbon delete mode 100644 toolchain/check/testdata/builtin_conversions/no_prelude/fail_convert_facet_value_to_missing_impl.carbon rename toolchain/check/testdata/{builtin_conversions => deduce}/value_with_type_through_access.carbon (99%) create mode 100644 toolchain/check/testdata/facet/min_prelude/convert_class_type_to_facet_type.carbon rename toolchain/check/testdata/{builtin_conversions/no_prelude => facet/min_prelude}/convert_class_type_to_generic_facet_value.carbon (53%) create mode 100644 toolchain/check/testdata/facet/min_prelude/convert_class_value_to_facet_value_value.carbon rename toolchain/check/testdata/{builtin_conversions/no_prelude => facet/min_prelude}/convert_class_value_to_generic_facet_value_value.carbon (52%) rename toolchain/check/testdata/{builtin_conversions/no_prelude => facet/min_prelude}/convert_facet_value_as_type_knows_original_type.carbon (68%) rename toolchain/check/testdata/{builtin_conversions => facet}/min_prelude/convert_facet_value_to_facet_value.carbon (99%) create mode 100644 toolchain/check/testdata/facet/min_prelude/convert_facet_value_to_itself.carbon rename toolchain/check/testdata/{builtin_conversions => facet}/min_prelude/convert_facet_value_to_narrowed_facet_type.carbon (99%) create mode 100644 toolchain/check/testdata/facet/min_prelude/convert_facet_value_value_to_blanket_impl.carbon create mode 100644 toolchain/check/testdata/facet/min_prelude/convert_facet_value_value_to_generic_facet_value_value.carbon create mode 100644 toolchain/check/testdata/facet/min_prelude/convert_facet_value_value_to_itself.carbon create mode 100644 toolchain/check/testdata/facet/min_prelude/convert_interface.carbon rename toolchain/check/testdata/{builtin_conversions/no_prelude => facet/min_prelude}/fail_convert_class_type_to_generic_facet_value.carbon (55%) rename toolchain/check/testdata/{builtin_conversions/no_prelude => facet/min_prelude}/fail_convert_facet_value_shouldnt_know_concrete_type.carbon (75%) create mode 100644 toolchain/check/testdata/facet/min_prelude/fail_convert_facet_value_to_missing_impl.carbon rename toolchain/check/testdata/{builtin_conversions/no_prelude => facet/min_prelude}/fail_convert_type_erased_type_to_facet.carbon (75%) rename toolchain/check/testdata/{builtin_conversions/no_prelude => facet/min_prelude}/fail_deduction_uses_runtime_type_conversion.carbon (55%) create mode 100644 toolchain/testing/min_prelude/convert.carbon diff --git a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_class_type_to_facet_type.carbon b/toolchain/check/testdata/builtin_conversions/no_prelude/convert_class_type_to_facet_type.carbon deleted file mode 100644 index aa82ff5d9b4b..000000000000 --- a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_class_type_to_facet_type.carbon +++ /dev/null @@ -1,120 +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/builtin_conversions/no_prelude/convert_class_type_to_facet_type.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtin_conversions/no_prelude/convert_class_type_to_facet_type.carbon - -interface Animal {} - -class Goat {} -impl Goat as Animal {} - -fn WalkAnimal(A:! Animal) {} - -fn F() { - WalkAnimal(Goat); -} - -// CHECK:STDOUT: --- convert_class_type_to_facet_type.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Animal.type: type = facet_type <@Animal> [concrete] -// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic] -// CHECK:STDOUT: %Goat: type = class_type @Goat [concrete] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %impl_witness: = impl_witness () [concrete] -// CHECK:STDOUT: %A: %Animal.type = bind_symbolic_name A, 0 [symbolic] -// CHECK:STDOUT: %A.patt: %Animal.type = symbolic_binding_pattern A, 0 [symbolic] -// CHECK:STDOUT: %WalkAnimal.type: type = fn_type @WalkAnimal [concrete] -// CHECK:STDOUT: %WalkAnimal: %WalkAnimal.type = struct_value () [concrete] -// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] -// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] -// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value %Goat, (%impl_witness) [concrete] -// CHECK:STDOUT: %WalkAnimal.specific_fn: = specific_function %WalkAnimal, @WalkAnimal(%Animal.facet) [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Animal = %Animal.decl -// CHECK:STDOUT: .Goat = %Goat.decl -// CHECK:STDOUT: .WalkAnimal = %WalkAnimal.decl -// CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Animal.decl: type = interface_decl @Animal [concrete = constants.%Animal.type] {} {} -// CHECK:STDOUT: %Goat.decl: type = class_decl @Goat [concrete = constants.%Goat] {} {} -// CHECK:STDOUT: impl_decl @impl [concrete] {} { -// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] -// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %impl_witness: = impl_witness () [concrete = constants.%impl_witness] -// CHECK:STDOUT: %WalkAnimal.decl: %WalkAnimal.type = fn_decl @WalkAnimal [concrete = constants.%WalkAnimal] { -// CHECK:STDOUT: %A.patt.loc16_15.1: %Animal.type = symbolic_binding_pattern A, 0 [symbolic = %A.patt.loc16_15.2 (constants.%A.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: %A.loc16_15.1: %Animal.type = bind_symbolic_name A, 0 [symbolic = %A.loc16_15.2 (constants.%A)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: interface @Animal { -// CHECK:STDOUT: %Self: %Animal.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: impl @impl: %Goat.ref as %Animal.ref { -// CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = file.%impl_witness -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @Goat { -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type] -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%Goat -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @WalkAnimal(%A.loc16_15.1: %Animal.type) { -// CHECK:STDOUT: %A.loc16_15.2: %Animal.type = bind_symbolic_name A, 0 [symbolic = %A.loc16_15.2 (constants.%A)] -// CHECK:STDOUT: %A.patt.loc16_15.2: %Animal.type = symbolic_binding_pattern A, 0 [symbolic = %A.patt.loc16_15.2 (constants.%A.patt)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%A.patt.loc16_15.1: %Animal.type) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @F() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %WalkAnimal.ref: %WalkAnimal.type = name_ref WalkAnimal, file.%WalkAnimal.decl [concrete = constants.%WalkAnimal] -// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] -// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness) [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %.loc19: %Animal.type = converted %Goat.ref, %Animal.facet [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %WalkAnimal.specific_fn: = specific_function %WalkAnimal.ref, @WalkAnimal(constants.%Animal.facet) [concrete = constants.%WalkAnimal.specific_fn] -// CHECK:STDOUT: %WalkAnimal.call: init %empty_tuple.type = call %WalkAnimal.specific_fn() -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @WalkAnimal(constants.%A) { -// CHECK:STDOUT: %A.loc16_15.2 => constants.%A -// CHECK:STDOUT: %A.patt.loc16_15.2 => constants.%A -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @WalkAnimal(constants.%Animal.facet) { -// CHECK:STDOUT: %A.loc16_15.2 => constants.%Animal.facet -// CHECK:STDOUT: %A.patt.loc16_15.2 => constants.%Animal.facet -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_class_value_to_facet_value_value.carbon b/toolchain/check/testdata/builtin_conversions/no_prelude/convert_class_value_to_facet_value_value.carbon deleted file mode 100644 index 25c18f13a9d3..000000000000 --- a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_class_value_to_facet_value_value.carbon +++ /dev/null @@ -1,261 +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/builtin_conversions/no_prelude/convert_class_value_to_facet_value_value.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtin_conversions/no_prelude/convert_class_value_to_facet_value_value.carbon - -// --- core.carbon - -package Core; - -interface ImplicitAs(T:! type) { - fn Convert[self: Self]() -> T; -} - -// --- convert_class_value_to_facet_value_value.carbon - -library "[[@TEST_NAME]]"; - -import Core; - -interface Animal {} - -fn WalkAnimal[T:! Animal](a: T) {} - -class Goat {} -impl Goat as Animal {} - -fn F() { - WalkAnimal({} as Goat); -} - -// CHECK:STDOUT: --- core.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] -// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 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(%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: %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: } -// 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: %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: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(%T.loc4_22.1: type) { -// CHECK:STDOUT: %T.loc4_22.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_22.2 (constants.%T)] -// CHECK:STDOUT: %T.patt.loc4_22.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_22.2 (constants.%T.patt)] -// 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: %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: -// CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %Convert.decl: @ImplicitAs.%Convert.type (%Convert.type) = fn_decl @Convert [symbolic = @ImplicitAs.%Convert (constants.%Convert)] { -// CHECK:STDOUT: %self.patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = binding_pattern self -// CHECK:STDOUT: %self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = value_param_pattern %self.patt, call_param0 -// CHECK:STDOUT: %return.patt: @Convert.%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: } -// CHECK:STDOUT: %self: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = 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: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .T = -// CHECK:STDOUT: .Convert = %assoc0.loc5_32.1 -// CHECK:STDOUT: witness = (%Convert.decl) -// 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: -// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type)]() -> @Convert.%T (%T); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(constants.%T) { -// CHECK:STDOUT: %T.loc4_22.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc4_22.2 => constants.%T -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Convert(constants.%T, constants.%Self) { -// 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: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(@Convert.%T) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(%T.loc4_22.2) {} -// CHECK:STDOUT: -// CHECK:STDOUT: --- convert_class_value_to_facet_value_value.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Animal.type: type = facet_type <@Animal> [concrete] -// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic] -// CHECK:STDOUT: %T: %Animal.type = bind_symbolic_name T, 0 [symbolic] -// CHECK:STDOUT: %T.patt: %Animal.type = symbolic_binding_pattern T, 0 [symbolic] -// CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic] -// CHECK:STDOUT: %WalkAnimal.type: type = fn_type @WalkAnimal [concrete] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %WalkAnimal: %WalkAnimal.type = struct_value () [concrete] -// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type [symbolic] -// CHECK:STDOUT: %Goat: type = class_type @Goat [concrete] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %impl_witness: = impl_witness () [concrete] -// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] -// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] -// CHECK:STDOUT: %Goat.val: %Goat = struct_value () [concrete] -// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value %Goat, (%impl_witness) [concrete] -// CHECK:STDOUT: %WalkAnimal.specific_fn: = specific_function %WalkAnimal, @WalkAnimal(%Animal.facet) [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: import Core//default -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Animal = %Animal.decl -// CHECK:STDOUT: .WalkAnimal = %WalkAnimal.decl -// CHECK:STDOUT: .Goat = %Goat.decl -// CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Animal.decl: type = interface_decl @Animal [concrete = constants.%Animal.type] {} {} -// CHECK:STDOUT: %WalkAnimal.decl: %WalkAnimal.type = fn_decl @WalkAnimal [concrete = constants.%WalkAnimal] { -// CHECK:STDOUT: %T.patt.loc8_15.1: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %a.patt: @WalkAnimal.%T.as_type.loc8_30.2 (%T.as_type) = binding_pattern a -// CHECK:STDOUT: %a.param_patt: @WalkAnimal.%T.as_type.loc8_30.2 (%T.as_type) = value_param_pattern %a.patt, call_param0 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: %T.loc8_15.1: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc8_15.2 (constants.%T)] -// CHECK:STDOUT: %a.param: @WalkAnimal.%T.as_type.loc8_30.2 (%T.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc8_30.1: type = splice_block %.loc8_30.2 [symbolic = %T.as_type.loc8_30.2 (constants.%T.as_type)] { -// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc8_15.1 [symbolic = %T.loc8_15.2 (constants.%T)] -// CHECK:STDOUT: %T.as_type.loc8_30.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc8_30.2 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc8_30.2: type = converted %T.ref, %T.as_type.loc8_30.1 [symbolic = %T.as_type.loc8_30.2 (constants.%T.as_type)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: @WalkAnimal.%T.as_type.loc8_30.2 (%T.as_type) = bind_name a, %a.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Goat.decl: type = class_decl @Goat [concrete = constants.%Goat] {} {} -// CHECK:STDOUT: impl_decl @impl [concrete] {} { -// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] -// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %impl_witness: = impl_witness () [concrete = constants.%impl_witness] -// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: interface @Animal { -// CHECK:STDOUT: %Self: %Animal.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: impl @impl: %Goat.ref as %Animal.ref { -// CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = file.%impl_witness -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @Goat { -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type] -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%Goat -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @WalkAnimal(%T.loc8_15.1: %Animal.type) { -// CHECK:STDOUT: %T.loc8_15.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc8_15.2 (constants.%T)] -// CHECK:STDOUT: %T.patt.loc8_15.2: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.as_type.loc8_30.2: type = facet_access_type %T.loc8_15.2 [symbolic = %T.as_type.loc8_30.2 (constants.%T.as_type)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type @WalkAnimal.%T.as_type.loc8_30.2 (%T.as_type) [symbolic = %require_complete (constants.%require_complete)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%T.patt.loc8_15.1: %Animal.type](%a.param_patt: @WalkAnimal.%T.as_type.loc8_30.2 (%T.as_type)) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @F() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %WalkAnimal.ref: %WalkAnimal.type = name_ref WalkAnimal, file.%WalkAnimal.decl [concrete = constants.%WalkAnimal] -// CHECK:STDOUT: %.loc14_15.1: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] -// CHECK:STDOUT: %.loc14_15.2: ref %Goat = temporary_storage -// CHECK:STDOUT: %.loc14_15.3: init %Goat = class_init (), %.loc14_15.2 [concrete = constants.%Goat.val] -// CHECK:STDOUT: %.loc14_15.4: ref %Goat = temporary %.loc14_15.2, %.loc14_15.3 -// CHECK:STDOUT: %.loc14_17.1: ref %Goat = converted %.loc14_15.1, %.loc14_15.4 -// CHECK:STDOUT: %Animal.facet.loc14_24.1: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness) [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %.loc14_24.1: %Animal.type = converted constants.%Goat, %Animal.facet.loc14_24.1 [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %Animal.facet.loc14_24.2: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness) [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %.loc14_24.2: %Animal.type = converted constants.%Goat, %Animal.facet.loc14_24.2 [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %WalkAnimal.specific_fn: = specific_function %WalkAnimal.ref, @WalkAnimal(constants.%Animal.facet) [concrete = constants.%WalkAnimal.specific_fn] -// CHECK:STDOUT: %.loc14_17.2: %Goat = bind_value %.loc14_17.1 -// CHECK:STDOUT: %WalkAnimal.call: init %empty_tuple.type = call %WalkAnimal.specific_fn(%.loc14_17.2) -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @WalkAnimal(constants.%T) { -// CHECK:STDOUT: %T.loc8_15.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc8_15.2 => constants.%T -// CHECK:STDOUT: %T.as_type.loc8_30.2 => constants.%T.as_type -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @WalkAnimal(constants.%Animal.facet) { -// CHECK:STDOUT: %T.loc8_15.2 => constants.%Animal.facet -// CHECK:STDOUT: %T.patt.loc8_15.2 => constants.%Animal.facet -// CHECK:STDOUT: %T.as_type.loc8_30.2 => constants.%Goat -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete => constants.%complete_type -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_to_itself.carbon b/toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_to_itself.carbon deleted file mode 100644 index 616c0b8babca..000000000000 --- a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_to_itself.carbon +++ /dev/null @@ -1,281 +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/builtin_conversions/no_prelude/convert_facet_value_to_itself.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_to_itself.carbon - -// --- core.carbon - -package Core; - -interface ImplicitAs(Dest:! type) { - fn Convert[self: Self]() -> Dest; -} - -// --- a.carbon - -library "[[@TEST_NAME]]"; - -import Core; - -interface Animal {} - -fn FeedAnimal(T:! Animal) {} - -fn HandleAnimal(T:! Animal) { FeedAnimal(T); } - -class Goat {} -impl Goat as Animal {} - -fn F() { - HandleAnimal(Goat); -} - -// CHECK:STDOUT: --- core.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic] -// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic] -// CHECK:STDOUT: %ImplicitAs.type.96f: type = generic_interface_type @ImplicitAs [concrete] -// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.96f = struct_value () [concrete] -// CHECK:STDOUT: %ImplicitAs.type.07f: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic] -// CHECK:STDOUT: %Self: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] -// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic] -// CHECK:STDOUT: %Convert: %Convert.type = struct_value () [symbolic] -// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type %ImplicitAs.type.07f [symbolic] -// CHECK:STDOUT: %assoc0: %ImplicitAs.assoc_type = assoc_entity element0, @ImplicitAs.%Convert.decl [symbolic] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { -// CHECK:STDOUT: %Dest.patt.loc4_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc4_22.2 (constants.%Dest.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.loc4_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc4_22.2 (constants.%Dest)] -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc4_22.1: type) { -// CHECK:STDOUT: %Dest.loc4_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc4_22.2 (constants.%Dest)] -// CHECK:STDOUT: %Dest.patt.loc4_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc4_22.2 (constants.%Dest.patt)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc4_22.2)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.07f)] -// CHECK:STDOUT: %Self.2: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest.loc4_22.2) [symbolic = %Convert.type (constants.%Convert.type)] -// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type) = struct_value () [symbolic = %Convert (constants.%Convert)] -// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type)] -// CHECK:STDOUT: %assoc0.loc5_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc5_35.2 (constants.%assoc0)] -// CHECK:STDOUT: -// CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %Convert.decl: @ImplicitAs.%Convert.type (%Convert.type) = fn_decl @Convert [symbolic = @ImplicitAs.%Convert (constants.%Convert)] { -// CHECK:STDOUT: %self.patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = binding_pattern self -// CHECK:STDOUT: %self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = value_param_pattern %self.patt, call_param0 -// CHECK:STDOUT: %return.patt: @Convert.%Dest (%Dest) = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: @Convert.%Dest (%Dest) = out_param_pattern %return.patt, call_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc4_22.1 [symbolic = %Dest (constants.%Dest)] -// CHECK:STDOUT: %self.param: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc5_20.1: type = splice_block %.loc5_20.3 [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] { -// CHECK:STDOUT: %.loc5_20.2: @Convert.%ImplicitAs.type (%ImplicitAs.type.07f) = specific_constant @ImplicitAs.%Self.1, @ImplicitAs(constants.%Dest) [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.ref: @Convert.%ImplicitAs.type (%ImplicitAs.type.07f) = name_ref Self, %.loc5_20.2 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc5_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc5_20.3: type = converted %Self.ref, %Self.as_type.loc5_20.2 [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = bind_name self, %self.param -// CHECK:STDOUT: %return.param: ref @Convert.%Dest (%Dest) = out_param call_param1 -// CHECK:STDOUT: %return: ref @Convert.%Dest (%Dest) = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %assoc0.loc5_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc5_35.2 (constants.%assoc0)] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .Dest = -// CHECK:STDOUT: .Convert = %assoc0.loc5_35.1 -// CHECK:STDOUT: witness = (%Convert.decl) -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert(@ImplicitAs.%Dest.loc4_22.1: type, @ImplicitAs.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f)) { -// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.07f)] -// CHECK:STDOUT: %Self: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc5_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type)]() -> @Convert.%Dest (%Dest); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { -// CHECK:STDOUT: %Dest.loc4_22.2 => constants.%Dest -// CHECK:STDOUT: %Dest.patt.loc4_22.2 => constants.%Dest -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self) { -// CHECK:STDOUT: %Dest => constants.%Dest -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.07f -// CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.as_type.loc5_20.1 => constants.%Self.as_type -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(%Dest.loc4_22.2) {} -// CHECK:STDOUT: -// CHECK:STDOUT: --- a.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Animal.type: type = facet_type <@Animal> [concrete] -// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic] -// CHECK:STDOUT: %T: %Animal.type = bind_symbolic_name T, 0 [symbolic] -// CHECK:STDOUT: %T.patt: %Animal.type = symbolic_binding_pattern T, 0 [symbolic] -// CHECK:STDOUT: %FeedAnimal.type: type = fn_type @FeedAnimal [concrete] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %FeedAnimal: %FeedAnimal.type = struct_value () [concrete] -// CHECK:STDOUT: %HandleAnimal.type: type = fn_type @HandleAnimal [concrete] -// CHECK:STDOUT: %HandleAnimal: %HandleAnimal.type = struct_value () [concrete] -// CHECK:STDOUT: %FeedAnimal.specific_fn.ec8: = specific_function %FeedAnimal, @FeedAnimal(%T) [symbolic] -// CHECK:STDOUT: %Goat: type = class_type @Goat [concrete] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %impl_witness: = impl_witness () [concrete] -// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] -// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] -// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value %Goat, (%impl_witness) [concrete] -// CHECK:STDOUT: %HandleAnimal.specific_fn: = specific_function %HandleAnimal, @HandleAnimal(%Animal.facet) [concrete] -// CHECK:STDOUT: %FeedAnimal.specific_fn.5d0: = specific_function %FeedAnimal, @FeedAnimal(%Animal.facet) [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: import Core//default -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Animal = %Animal.decl -// CHECK:STDOUT: .FeedAnimal = %FeedAnimal.decl -// CHECK:STDOUT: .HandleAnimal = %HandleAnimal.decl -// CHECK:STDOUT: .Goat = %Goat.decl -// CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Animal.decl: type = interface_decl @Animal [concrete = constants.%Animal.type] {} {} -// CHECK:STDOUT: %FeedAnimal.decl: %FeedAnimal.type = fn_decl @FeedAnimal [concrete = constants.%FeedAnimal] { -// CHECK:STDOUT: %T.patt.loc8_15.1: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_15.2 (constants.%T.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: %T.loc8_15.1: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc8_15.2 (constants.%T)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %HandleAnimal.decl: %HandleAnimal.type = fn_decl @HandleAnimal [concrete = constants.%HandleAnimal] { -// CHECK:STDOUT: %T.patt.loc10_17.1: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_17.2 (constants.%T.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: %T.loc10_17.1: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc10_17.2 (constants.%T)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %Goat.decl: type = class_decl @Goat [concrete = constants.%Goat] {} {} -// CHECK:STDOUT: impl_decl @impl [concrete] {} { -// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] -// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %impl_witness: = impl_witness () [concrete = constants.%impl_witness] -// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: interface @Animal { -// CHECK:STDOUT: %Self: %Animal.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: impl @impl: %Goat.ref as %Animal.ref { -// CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = file.%impl_witness -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @Goat { -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type] -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%Goat -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @FeedAnimal(%T.loc8_15.1: %Animal.type) { -// CHECK:STDOUT: %T.loc8_15.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc8_15.2 (constants.%T)] -// CHECK:STDOUT: %T.patt.loc8_15.2: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_15.2 (constants.%T.patt)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%T.patt.loc8_15.1: %Animal.type) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @HandleAnimal(%T.loc10_17.1: %Animal.type) { -// CHECK:STDOUT: %T.loc10_17.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc10_17.2 (constants.%T)] -// CHECK:STDOUT: %T.patt.loc10_17.2: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_17.2 (constants.%T.patt)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %FeedAnimal.specific_fn.loc10_31.2: = specific_function constants.%FeedAnimal, @FeedAnimal(%T.loc10_17.2) [symbolic = %FeedAnimal.specific_fn.loc10_31.2 (constants.%FeedAnimal.specific_fn.ec8)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%T.patt.loc10_17.1: %Animal.type) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %FeedAnimal.ref: %FeedAnimal.type = name_ref FeedAnimal, file.%FeedAnimal.decl [concrete = constants.%FeedAnimal] -// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc10_17.1 [symbolic = %T.loc10_17.2 (constants.%T)] -// CHECK:STDOUT: %FeedAnimal.specific_fn.loc10_31.1: = specific_function %FeedAnimal.ref, @FeedAnimal(constants.%T) [symbolic = %FeedAnimal.specific_fn.loc10_31.2 (constants.%FeedAnimal.specific_fn.ec8)] -// CHECK:STDOUT: %FeedAnimal.call: init %empty_tuple.type = call %FeedAnimal.specific_fn.loc10_31.1() -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @F() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %HandleAnimal.ref: %HandleAnimal.type = name_ref HandleAnimal, file.%HandleAnimal.decl [concrete = constants.%HandleAnimal] -// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] -// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness) [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %.loc16: %Animal.type = converted %Goat.ref, %Animal.facet [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %HandleAnimal.specific_fn: = specific_function %HandleAnimal.ref, @HandleAnimal(constants.%Animal.facet) [concrete = constants.%HandleAnimal.specific_fn] -// CHECK:STDOUT: %HandleAnimal.call: init %empty_tuple.type = call %HandleAnimal.specific_fn() -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @FeedAnimal(constants.%T) { -// CHECK:STDOUT: %T.loc8_15.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc8_15.2 => constants.%T -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @HandleAnimal(constants.%T) { -// CHECK:STDOUT: %T.loc10_17.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc10_17.2 => constants.%T -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @FeedAnimal(@HandleAnimal.%T.loc10_17.2) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @HandleAnimal(constants.%Animal.facet) { -// CHECK:STDOUT: %T.loc10_17.2 => constants.%Animal.facet -// CHECK:STDOUT: %T.patt.loc10_17.2 => constants.%Animal.facet -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %FeedAnimal.specific_fn.loc10_31.2 => constants.%FeedAnimal.specific_fn.5d0 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @FeedAnimal(constants.%Animal.facet) { -// CHECK:STDOUT: %T.loc8_15.2 => constants.%Animal.facet -// CHECK:STDOUT: %T.patt.loc8_15.2 => constants.%Animal.facet -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_value_to_blanket_impl.carbon b/toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_value_to_blanket_impl.carbon deleted file mode 100644 index cb61d1202698..000000000000 --- a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_value_to_blanket_impl.carbon +++ /dev/null @@ -1,330 +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/builtin_conversions/no_prelude/convert_facet_value_value_to_blanket_impl.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_value_to_blanket_impl.carbon - -// --- core.carbon - -package Core; - -interface ImplicitAs(T:! type) { - fn Convert[self: Self]() -> T; -} - -// --- convert_facet_value_value_to_blanket_impl.carbon - -library "[[@TEST_NAME]]"; - -import Core; - -interface Eats {} -interface Animal {} - -impl forall [A:! Animal] A as Eats {} - -fn Feed[T:! Eats](e: T) {} - -fn HandleAnimal[T:! Animal](a: T) { Feed(a); } - -// CHECK:STDOUT: --- core.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] -// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 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(%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: %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: } -// 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: %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: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(%T.loc4_22.1: type) { -// CHECK:STDOUT: %T.loc4_22.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_22.2 (constants.%T)] -// CHECK:STDOUT: %T.patt.loc4_22.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_22.2 (constants.%T.patt)] -// 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: %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: -// CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %Convert.decl: @ImplicitAs.%Convert.type (%Convert.type) = fn_decl @Convert [symbolic = @ImplicitAs.%Convert (constants.%Convert)] { -// CHECK:STDOUT: %self.patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = binding_pattern self -// CHECK:STDOUT: %self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = value_param_pattern %self.patt, call_param0 -// CHECK:STDOUT: %return.patt: @Convert.%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: } -// CHECK:STDOUT: %self: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = 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: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .T = -// CHECK:STDOUT: .Convert = %assoc0.loc5_32.1 -// CHECK:STDOUT: witness = (%Convert.decl) -// 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: -// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type)]() -> @Convert.%T (%T); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(constants.%T) { -// CHECK:STDOUT: %T.loc4_22.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc4_22.2 => constants.%T -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Convert(constants.%T, constants.%Self) { -// 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: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(@Convert.%T) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(%T.loc4_22.2) {} -// CHECK:STDOUT: -// CHECK:STDOUT: --- convert_facet_value_value_to_blanket_impl.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Eats.type: type = facet_type <@Eats> [concrete] -// 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: %A: %Animal.type = bind_symbolic_name A, 0 [symbolic] -// CHECK:STDOUT: %A.patt: %Animal.type = symbolic_binding_pattern A, 0 [symbolic] -// CHECK:STDOUT: %A.as_type: type = facet_access_type %A [symbolic] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %impl_witness.11010a.1: = impl_witness (), @impl(%A) [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.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.c75: = require_complete_type %T.as_type.27d [symbolic] -// CHECK:STDOUT: %T.fd4: %Animal.type = bind_symbolic_name T, 0 [symbolic] -// CHECK:STDOUT: %T.patt.a9c: %Animal.type = symbolic_binding_pattern T, 0 [symbolic] -// CHECK:STDOUT: %T.as_type.2ad: type = facet_access_type %T.fd4 [symbolic] -// CHECK:STDOUT: %HandleAnimal.type: type = fn_type @HandleAnimal [concrete] -// CHECK:STDOUT: %HandleAnimal: %HandleAnimal.type = struct_value () [concrete] -// CHECK:STDOUT: %require_complete.234: = require_complete_type %T.as_type.2ad [symbolic] -// CHECK:STDOUT: %impl_witness.11010a.2: = impl_witness (), @impl(%T.fd4) [symbolic] -// CHECK:STDOUT: %Eats.facet: %Eats.type = facet_value %T.as_type.2ad, (%impl_witness.11010a.2) [symbolic] -// CHECK:STDOUT: %Feed.specific_fn: = specific_function %Feed, @Feed(%Eats.facet) [symbolic] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: import Core//default -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Eats = %Eats.decl -// CHECK:STDOUT: .Animal = %Animal.decl -// CHECK:STDOUT: .Feed = %Feed.decl -// CHECK:STDOUT: .HandleAnimal = %HandleAnimal.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Eats.decl: type = interface_decl @Eats [concrete = constants.%Eats.type] {} {} -// CHECK:STDOUT: %Animal.decl: type = interface_decl @Animal [concrete = constants.%Animal.type] {} {} -// CHECK:STDOUT: impl_decl @impl [concrete] { -// CHECK:STDOUT: %A.patt.loc9_14.1: %Animal.type = symbolic_binding_pattern A, 0 [symbolic = %A.patt.loc9_14.2 (constants.%A.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %A.ref: %Animal.type = name_ref A, %A.loc9_14.1 [symbolic = %A.loc9_14.2 (constants.%A)] -// CHECK:STDOUT: %A.as_type.loc9_26.1: type = facet_access_type %A.ref [symbolic = %A.as_type.loc9_26.2 (constants.%A.as_type)] -// CHECK:STDOUT: %.loc9: type = converted %A.ref, %A.as_type.loc9_26.1 [symbolic = %A.as_type.loc9_26.2 (constants.%A.as_type)] -// CHECK:STDOUT: %Eats.ref: type = name_ref Eats, file.%Eats.decl [concrete = constants.%Eats.type] -// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: %A.loc9_14.1: %Animal.type = bind_symbolic_name A, 0 [symbolic = %A.loc9_14.2 (constants.%A)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %impl_witness: = impl_witness (), @impl(constants.%A) [symbolic = @impl.%impl_witness (constants.%impl_witness.11010a.1)] -// CHECK:STDOUT: %Feed.decl: %Feed.type = fn_decl @Feed [concrete = constants.%Feed] { -// CHECK:STDOUT: %T.patt.loc11_9.1: %Eats.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_9.2 (constants.%T.patt.6be)] -// CHECK:STDOUT: %e.patt: @Feed.%T.as_type.loc11_22.2 (%T.as_type.27d) = binding_pattern e -// CHECK:STDOUT: %e.param_patt: @Feed.%T.as_type.loc11_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.loc11_9.1: %Eats.type = bind_symbolic_name T, 0 [symbolic = %T.loc11_9.2 (constants.%T.1b5)] -// CHECK:STDOUT: %e.param: @Feed.%T.as_type.loc11_22.2 (%T.as_type.27d) = value_param call_param0 -// CHECK:STDOUT: %.loc11_22.1: type = splice_block %.loc11_22.2 [symbolic = %T.as_type.loc11_22.2 (constants.%T.as_type.27d)] { -// CHECK:STDOUT: %T.ref: %Eats.type = name_ref T, %T.loc11_9.1 [symbolic = %T.loc11_9.2 (constants.%T.1b5)] -// CHECK:STDOUT: %T.as_type.loc11_22.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc11_22.2 (constants.%T.as_type.27d)] -// CHECK:STDOUT: %.loc11_22.2: type = converted %T.ref, %T.as_type.loc11_22.1 [symbolic = %T.as_type.loc11_22.2 (constants.%T.as_type.27d)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %e: @Feed.%T.as_type.loc11_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.loc13_17.1: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc13_17.2 (constants.%T.patt.a9c)] -// CHECK:STDOUT: %a.patt: @HandleAnimal.%T.as_type.loc13_32.2 (%T.as_type.2ad) = binding_pattern a -// CHECK:STDOUT: %a.param_patt: @HandleAnimal.%T.as_type.loc13_32.2 (%T.as_type.2ad) = value_param_pattern %a.patt, call_param0 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: %T.loc13_17.1: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc13_17.2 (constants.%T.fd4)] -// CHECK:STDOUT: %a.param: @HandleAnimal.%T.as_type.loc13_32.2 (%T.as_type.2ad) = value_param call_param0 -// CHECK:STDOUT: %.loc13_32.1: type = splice_block %.loc13_32.2 [symbolic = %T.as_type.loc13_32.2 (constants.%T.as_type.2ad)] { -// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc13_17.1 [symbolic = %T.loc13_17.2 (constants.%T.fd4)] -// CHECK:STDOUT: %T.as_type.loc13_32.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc13_32.2 (constants.%T.as_type.2ad)] -// CHECK:STDOUT: %.loc13_32.2: type = converted %T.ref, %T.as_type.loc13_32.1 [symbolic = %T.as_type.loc13_32.2 (constants.%T.as_type.2ad)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: @HandleAnimal.%T.as_type.loc13_32.2 (%T.as_type.2ad) = bind_name a, %a.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: interface @Eats { -// CHECK:STDOUT: %Self: %Eats.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1b5] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: witness = () -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: interface @Animal { -// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.fd4] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: witness = () -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic impl @impl(%A.loc9_14.1: %Animal.type) { -// CHECK:STDOUT: %A.loc9_14.2: %Animal.type = bind_symbolic_name A, 0 [symbolic = %A.loc9_14.2 (constants.%A)] -// CHECK:STDOUT: %A.patt.loc9_14.2: %Animal.type = symbolic_binding_pattern A, 0 [symbolic = %A.patt.loc9_14.2 (constants.%A.patt)] -// CHECK:STDOUT: %A.as_type.loc9_26.2: type = facet_access_type %A.loc9_14.2 [symbolic = %A.as_type.loc9_26.2 (constants.%A.as_type)] -// CHECK:STDOUT: %impl_witness: = impl_witness (), @impl(%A.loc9_14.2) [symbolic = %impl_witness (constants.%impl_witness.11010a.1)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: -// CHECK:STDOUT: impl: %.loc9 as %Eats.ref { -// CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = file.%impl_witness -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Feed(%T.loc11_9.1: %Eats.type) { -// CHECK:STDOUT: %T.loc11_9.2: %Eats.type = bind_symbolic_name T, 0 [symbolic = %T.loc11_9.2 (constants.%T.1b5)] -// CHECK:STDOUT: %T.patt.loc11_9.2: %Eats.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_9.2 (constants.%T.patt.6be)] -// CHECK:STDOUT: %T.as_type.loc11_22.2: type = facet_access_type %T.loc11_9.2 [symbolic = %T.as_type.loc11_22.2 (constants.%T.as_type.27d)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type @Feed.%T.as_type.loc11_22.2 (%T.as_type.27d) [symbolic = %require_complete (constants.%require_complete.c75)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%T.patt.loc11_9.1: %Eats.type](%e.param_patt: @Feed.%T.as_type.loc11_22.2 (%T.as_type.27d)) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @HandleAnimal(%T.loc13_17.1: %Animal.type) { -// CHECK:STDOUT: %T.loc13_17.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc13_17.2 (constants.%T.fd4)] -// CHECK:STDOUT: %T.patt.loc13_17.2: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc13_17.2 (constants.%T.patt.a9c)] -// CHECK:STDOUT: %T.as_type.loc13_32.2: type = facet_access_type %T.loc13_17.2 [symbolic = %T.as_type.loc13_32.2 (constants.%T.as_type.2ad)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type @HandleAnimal.%T.as_type.loc13_32.2 (%T.as_type.2ad) [symbolic = %require_complete (constants.%require_complete.234)] -// CHECK:STDOUT: %impl_witness: = impl_witness (), @impl(%T.loc13_17.2) [symbolic = %impl_witness (constants.%impl_witness.11010a.2)] -// CHECK:STDOUT: %Eats.facet.loc13_43.3: %Eats.type = facet_value %T.as_type.loc13_32.2, (%impl_witness) [symbolic = %Eats.facet.loc13_43.3 (constants.%Eats.facet)] -// CHECK:STDOUT: %Feed.specific_fn.loc13_37.2: = specific_function constants.%Feed, @Feed(%Eats.facet.loc13_43.3) [symbolic = %Feed.specific_fn.loc13_37.2 (constants.%Feed.specific_fn)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%T.patt.loc13_17.1: %Animal.type](%a.param_patt: @HandleAnimal.%T.as_type.loc13_32.2 (%T.as_type.2ad)) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Feed.ref: %Feed.type = name_ref Feed, file.%Feed.decl [concrete = constants.%Feed] -// CHECK:STDOUT: %a.ref: @HandleAnimal.%T.as_type.loc13_32.2 (%T.as_type.2ad) = name_ref a, %a -// CHECK:STDOUT: %.loc13_43.1: %Animal.type = converted constants.%T.as_type.2ad, constants.%T.fd4 [symbolic = %T.loc13_17.2 (constants.%T.fd4)] -// CHECK:STDOUT: %Eats.facet.loc13_43.1: %Eats.type = facet_value constants.%T.as_type.2ad, (constants.%impl_witness.11010a.2) [symbolic = %Eats.facet.loc13_43.3 (constants.%Eats.facet)] -// CHECK:STDOUT: %.loc13_43.2: %Eats.type = converted constants.%T.as_type.2ad, %Eats.facet.loc13_43.1 [symbolic = %Eats.facet.loc13_43.3 (constants.%Eats.facet)] -// CHECK:STDOUT: %.loc13_43.3: %Animal.type = converted constants.%T.as_type.2ad, constants.%T.fd4 [symbolic = %T.loc13_17.2 (constants.%T.fd4)] -// CHECK:STDOUT: %Eats.facet.loc13_43.2: %Eats.type = facet_value constants.%T.as_type.2ad, (constants.%impl_witness.11010a.2) [symbolic = %Eats.facet.loc13_43.3 (constants.%Eats.facet)] -// CHECK:STDOUT: %.loc13_43.4: %Eats.type = converted constants.%T.as_type.2ad, %Eats.facet.loc13_43.2 [symbolic = %Eats.facet.loc13_43.3 (constants.%Eats.facet)] -// CHECK:STDOUT: %Feed.specific_fn.loc13_37.1: = specific_function %Feed.ref, @Feed(constants.%Eats.facet) [symbolic = %Feed.specific_fn.loc13_37.2 (constants.%Feed.specific_fn)] -// CHECK:STDOUT: %Feed.call: init %empty_tuple.type = call %Feed.specific_fn.loc13_37.1(%a.ref) -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @impl(constants.%A) { -// CHECK:STDOUT: %A.loc9_14.2 => constants.%A -// CHECK:STDOUT: %A.patt.loc9_14.2 => constants.%A -// CHECK:STDOUT: %A.as_type.loc9_26.2 => constants.%A.as_type -// CHECK:STDOUT: %impl_witness => constants.%impl_witness.11010a.1 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @impl(%A.loc9_14.2) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Feed(constants.%T.1b5) { -// CHECK:STDOUT: %T.loc11_9.2 => constants.%T.1b5 -// CHECK:STDOUT: %T.patt.loc11_9.2 => constants.%T.1b5 -// CHECK:STDOUT: %T.as_type.loc11_22.2 => constants.%T.as_type.27d -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @HandleAnimal(constants.%T.fd4) { -// CHECK:STDOUT: %T.loc13_17.2 => constants.%T.fd4 -// CHECK:STDOUT: %T.patt.loc13_17.2 => constants.%T.fd4 -// CHECK:STDOUT: %T.as_type.loc13_32.2 => constants.%T.as_type.2ad -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @impl(constants.%T.fd4) { -// CHECK:STDOUT: %A.loc9_14.2 => constants.%T.fd4 -// CHECK:STDOUT: %A.patt.loc9_14.2 => constants.%T.fd4 -// CHECK:STDOUT: %A.as_type.loc9_26.2 => constants.%T.as_type.2ad -// CHECK:STDOUT: %impl_witness => constants.%impl_witness.11010a.2 -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Feed(constants.%Eats.facet) { -// CHECK:STDOUT: %T.loc11_9.2 => constants.%Eats.facet -// CHECK:STDOUT: %T.patt.loc11_9.2 => constants.%Eats.facet -// CHECK:STDOUT: %T.as_type.loc11_22.2 => constants.%T.as_type.2ad -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete => constants.%require_complete.234 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @impl(@HandleAnimal.%T.loc13_17.2) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Feed(@HandleAnimal.%Eats.facet.loc13_43.3) {} -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_value_to_generic_facet_value_value.carbon b/toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_value_to_generic_facet_value_value.carbon deleted file mode 100644 index 3d6efefc384c..000000000000 --- a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_value_to_generic_facet_value_value.carbon +++ /dev/null @@ -1,630 +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/builtin_conversions/no_prelude/convert_facet_value_value_to_generic_facet_value_value.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_value_to_generic_facet_value_value.carbon - -// --- core.carbon - -package Core; - -interface ImplicitAs(T:! type) { - fn Convert[self: Self]() -> T; -} - -// --- convert_facet_value_value_to_generic_facet_value_value.carbon - -library "[[@TEST_NAME]]"; - -import Core; - -interface Edible {} - -class Grass {} -impl Grass as Edible {} - -interface Animal {} -interface Eats(Food:! type) {} - -// When answering a query "does Goat impl Animal", we must avoid trying to deduce -// parameters for this impl. Not only is doing so unnecessary, it would start a new -// "does Goat impl Animal" query, leading to a "cycle in impl lookup" error. -impl forall [T:! Animal, U:! Edible] T as Eats(U) {} - -class Goat {} -impl Goat as Animal {} - -fn Feed[Food:! Edible, T:! Eats(Food)](e: T, food: Food) {} -fn HandleAnimal[T:! Animal, Food:! Edible](a: T, food: Food) { Feed(a, food); } - -fn F() { - HandleAnimal({} as Goat, {} as Grass); -} - -// CHECK:STDOUT: --- core.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] -// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 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(%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: %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: } -// 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: %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: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(%T.loc4_22.1: type) { -// CHECK:STDOUT: %T.loc4_22.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_22.2 (constants.%T)] -// CHECK:STDOUT: %T.patt.loc4_22.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_22.2 (constants.%T.patt)] -// 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: %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: -// CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %Convert.decl: @ImplicitAs.%Convert.type (%Convert.type) = fn_decl @Convert [symbolic = @ImplicitAs.%Convert (constants.%Convert)] { -// CHECK:STDOUT: %self.patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = binding_pattern self -// CHECK:STDOUT: %self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = value_param_pattern %self.patt, call_param0 -// CHECK:STDOUT: %return.patt: @Convert.%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: } -// CHECK:STDOUT: %self: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = 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: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .T = -// CHECK:STDOUT: .Convert = %assoc0.loc5_32.1 -// CHECK:STDOUT: witness = (%Convert.decl) -// 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: -// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type)]() -> @Convert.%T (%T); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(constants.%T) { -// CHECK:STDOUT: %T.loc4_22.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc4_22.2 => constants.%T -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Convert(constants.%T, constants.%Self) { -// 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: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(@Convert.%T) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(%T.loc4_22.2) {} -// CHECK:STDOUT: -// CHECK:STDOUT: --- convert_facet_value_value_to_generic_facet_value_value.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Edible.type: type = facet_type <@Edible> [concrete] -// CHECK:STDOUT: %Self.9af: %Edible.type = bind_symbolic_name Self, 0 [symbolic] -// CHECK:STDOUT: %Grass: type = class_type @Grass [concrete] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] -// CHECK:STDOUT: %complete_type.357: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %impl_witness.1bc: = impl_witness () [concrete] -// CHECK:STDOUT: %Animal.type: type = facet_type <@Animal> [concrete] -// CHECK:STDOUT: %Self.fd4: %Animal.type = bind_symbolic_name Self, 0 [symbolic] -// CHECK:STDOUT: %Food.8b3: type = bind_symbolic_name Food, 0 [symbolic] -// CHECK:STDOUT: %Food.patt.e01: type = symbolic_binding_pattern Food, 0 [symbolic] -// CHECK:STDOUT: %Eats.type.ba2: type = generic_interface_type @Eats [concrete] -// CHECK:STDOUT: %Eats.generic: %Eats.type.ba2 = struct_value () [concrete] -// CHECK:STDOUT: %Eats.type.6c0: type = facet_type <@Eats, @Eats(%Food.8b3)> [symbolic] -// CHECK:STDOUT: %Self.4eb: %Eats.type.6c0 = bind_symbolic_name Self, 1 [symbolic] -// CHECK:STDOUT: %T.fd4: %Animal.type = bind_symbolic_name T, 0 [symbolic] -// CHECK:STDOUT: %T.patt.a9c: %Animal.type = symbolic_binding_pattern T, 0 [symbolic] -// CHECK:STDOUT: %U: %Edible.type = bind_symbolic_name U, 1 [symbolic] -// CHECK:STDOUT: %U.patt: %Edible.type = symbolic_binding_pattern U, 1 [symbolic] -// CHECK:STDOUT: %T.as_type.2ad: type = facet_access_type %T.fd4 [symbolic] -// CHECK:STDOUT: %U.as_type: type = facet_access_type %U [symbolic] -// CHECK:STDOUT: %Eats.type.f54c3d.1: type = facet_type <@Eats, @Eats(%U.as_type)> [symbolic] -// CHECK:STDOUT: %require_complete.42532a.1: = require_complete_type %Eats.type.f54c3d.1 [symbolic] -// CHECK:STDOUT: %impl_witness.c7c36b.1: = impl_witness (), @impl.009(%T.fd4, %U) [symbolic] -// CHECK:STDOUT: %Goat: type = class_type @Goat [concrete] -// CHECK:STDOUT: %Food.9af: %Edible.type = bind_symbolic_name Food, 0 [symbolic] -// CHECK:STDOUT: %Food.patt.0b7: %Edible.type = symbolic_binding_pattern Food, 0 [symbolic] -// CHECK:STDOUT: %Food.as_type.952: type = facet_access_type %Food.9af [symbolic] -// CHECK:STDOUT: %Eats.type.b39: type = facet_type <@Eats, @Eats(%Food.as_type.952)> [symbolic] -// CHECK:STDOUT: %T.223: %Eats.type.b39 = bind_symbolic_name T, 1 [symbolic] -// CHECK:STDOUT: %T.patt.f09: %Eats.type.b39 = symbolic_binding_pattern T, 1 [symbolic] -// CHECK:STDOUT: %T.as_type.212: type = facet_access_type %T.223 [symbolic] -// CHECK:STDOUT: %Feed.type: type = fn_type @Feed [concrete] -// CHECK:STDOUT: %Feed: %Feed.type = struct_value () [concrete] -// CHECK:STDOUT: %require_complete.fe6: = require_complete_type %T.as_type.212 [symbolic] -// CHECK:STDOUT: %require_complete.005: = require_complete_type %Food.as_type.952 [symbolic] -// CHECK:STDOUT: %Food.5fe: %Edible.type = bind_symbolic_name Food, 1 [symbolic] -// CHECK:STDOUT: %Food.patt.551: %Edible.type = symbolic_binding_pattern Food, 1 [symbolic] -// CHECK:STDOUT: %Food.as_type.fae: type = facet_access_type %Food.5fe [symbolic] -// CHECK:STDOUT: %HandleAnimal.type: type = fn_type @HandleAnimal [concrete] -// CHECK:STDOUT: %HandleAnimal: %HandleAnimal.type = struct_value () [concrete] -// CHECK:STDOUT: %require_complete.234: = require_complete_type %T.as_type.2ad [symbolic] -// CHECK:STDOUT: %require_complete.444: = require_complete_type %Food.as_type.fae [symbolic] -// CHECK:STDOUT: %Eats.type.f54c3d.2: type = facet_type <@Eats, @Eats(%Food.as_type.fae)> [symbolic] -// CHECK:STDOUT: %require_complete.42532a.2: = require_complete_type %Eats.type.f54c3d.2 [symbolic] -// CHECK:STDOUT: %impl_witness.c7c36b.2: = impl_witness (), @impl.009(%T.fd4, %Food.5fe) [symbolic] -// CHECK:STDOUT: %Eats.facet.97e: %Eats.type.f54c3d.2 = facet_value %T.as_type.2ad, (%impl_witness.c7c36b.2) [symbolic] -// CHECK:STDOUT: %Feed.specific_fn.387: = specific_function %Feed, @Feed(%Food.5fe, %Eats.facet.97e) [symbolic] -// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] -// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] -// CHECK:STDOUT: %Goat.val: %Goat = struct_value () [concrete] -// CHECK:STDOUT: %Grass.val: %Grass = struct_value () [concrete] -// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value %Goat, (%impl_witness.1bc) [concrete] -// CHECK:STDOUT: %Edible.facet: %Edible.type = facet_value %Grass, (%impl_witness.1bc) [concrete] -// CHECK:STDOUT: %HandleAnimal.specific_fn: = specific_function %HandleAnimal, @HandleAnimal(%Animal.facet, %Edible.facet) [concrete] -// CHECK:STDOUT: %Eats.type.1ae: type = facet_type <@Eats, @Eats(%Grass)> [concrete] -// CHECK:STDOUT: %complete_type.004: = complete_type_witness %Eats.type.1ae [concrete] -// CHECK:STDOUT: %impl_witness.4f1: = impl_witness (), @impl.009(%Animal.facet, %Edible.facet) [concrete] -// CHECK:STDOUT: %Eats.facet.fa6: %Eats.type.1ae = facet_value %Goat, (%impl_witness.4f1) [concrete] -// CHECK:STDOUT: %Feed.specific_fn.d82: = specific_function %Feed, @Feed(%Edible.facet, %Eats.facet.fa6) [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: import Core//default -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Edible = %Edible.decl -// CHECK:STDOUT: .Grass = %Grass.decl -// CHECK:STDOUT: .Animal = %Animal.decl -// CHECK:STDOUT: .Eats = %Eats.decl -// CHECK:STDOUT: .Goat = %Goat.decl -// CHECK:STDOUT: .Feed = %Feed.decl -// CHECK:STDOUT: .HandleAnimal = %HandleAnimal.decl -// CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Edible.decl: type = interface_decl @Edible [concrete = constants.%Edible.type] {} {} -// CHECK:STDOUT: %Grass.decl: type = class_decl @Grass [concrete = constants.%Grass] {} {} -// CHECK:STDOUT: impl_decl @impl.592 [concrete] {} { -// CHECK:STDOUT: %Grass.ref: type = name_ref Grass, file.%Grass.decl [concrete = constants.%Grass] -// CHECK:STDOUT: %Edible.ref: type = name_ref Edible, file.%Edible.decl [concrete = constants.%Edible.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %impl_witness.loc9: = impl_witness () [concrete = constants.%impl_witness.1bc] -// CHECK:STDOUT: %Animal.decl: type = interface_decl @Animal [concrete = constants.%Animal.type] {} {} -// CHECK:STDOUT: %Eats.decl: %Eats.type.ba2 = interface_decl @Eats [concrete = constants.%Eats.generic] { -// CHECK:STDOUT: %Food.patt.loc12_16.1: type = symbolic_binding_pattern Food, 0 [symbolic = %Food.patt.loc12_16.2 (constants.%Food.patt.e01)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Food.loc12_16.1: type = bind_symbolic_name Food, 0 [symbolic = %Food.loc12_16.2 (constants.%Food.8b3)] -// CHECK:STDOUT: } -// CHECK:STDOUT: impl_decl @impl.009 [concrete] { -// CHECK:STDOUT: %T.patt.loc17_14.1: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc17_14.2 (constants.%T.patt.a9c)] -// CHECK:STDOUT: %U.patt.loc17_26.1: %Edible.type = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc17_26.2 (constants.%U.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc17_14.1 [symbolic = %T.loc17_14.2 (constants.%T.fd4)] -// CHECK:STDOUT: %T.as_type.loc17_38.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc17_38.2 (constants.%T.as_type.2ad)] -// CHECK:STDOUT: %.loc17_38: type = converted %T.ref, %T.as_type.loc17_38.1 [symbolic = %T.as_type.loc17_38.2 (constants.%T.as_type.2ad)] -// CHECK:STDOUT: %Eats.ref: %Eats.type.ba2 = name_ref Eats, file.%Eats.decl [concrete = constants.%Eats.generic] -// CHECK:STDOUT: %U.ref: %Edible.type = name_ref U, %U.loc17_26.1 [symbolic = %U.loc17_26.2 (constants.%U)] -// CHECK:STDOUT: %U.as_type.loc17_49.1: type = facet_access_type %U.ref [symbolic = %U.as_type.loc17_49.2 (constants.%U.as_type)] -// CHECK:STDOUT: %.loc17_49: type = converted %U.ref, %U.as_type.loc17_49.1 [symbolic = %U.as_type.loc17_49.2 (constants.%U.as_type)] -// CHECK:STDOUT: %Eats.type.loc17_49.1: type = facet_type <@Eats, @Eats(constants.%U.as_type)> [symbolic = %Eats.type.loc17_49.2 (constants.%Eats.type.f54c3d.1)] -// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: %T.loc17_14.1: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc17_14.2 (constants.%T.fd4)] -// CHECK:STDOUT: %Edible.ref: type = name_ref Edible, file.%Edible.decl [concrete = constants.%Edible.type] -// CHECK:STDOUT: %U.loc17_26.1: %Edible.type = bind_symbolic_name U, 1 [symbolic = %U.loc17_26.2 (constants.%U)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %impl_witness.loc17: = impl_witness (), @impl.009(constants.%T.fd4, constants.%U) [symbolic = @impl.009.%impl_witness (constants.%impl_witness.c7c36b.1)] -// CHECK:STDOUT: %Goat.decl: type = class_decl @Goat [concrete = constants.%Goat] {} {} -// CHECK:STDOUT: impl_decl @impl.27e [concrete] {} { -// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] -// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %impl_witness.loc20: = impl_witness () [concrete = constants.%impl_witness.1bc] -// CHECK:STDOUT: %Feed.decl: %Feed.type = fn_decl @Feed [concrete = constants.%Feed] { -// CHECK:STDOUT: %Food.patt.loc22_9.1: %Edible.type = symbolic_binding_pattern Food, 0 [symbolic = %Food.patt.loc22_9.2 (constants.%Food.patt.0b7)] -// CHECK:STDOUT: %T.patt.loc22_24.1: @Feed.%Eats.type.loc22_37.2 (%Eats.type.b39) = symbolic_binding_pattern T, 1 [symbolic = %T.patt.loc22_24.2 (constants.%T.patt.f09)] -// CHECK:STDOUT: %e.patt: @Feed.%T.as_type.loc22_43.2 (%T.as_type.212) = binding_pattern e -// CHECK:STDOUT: %e.param_patt: @Feed.%T.as_type.loc22_43.2 (%T.as_type.212) = value_param_pattern %e.patt, call_param0 -// CHECK:STDOUT: %food.patt: @Feed.%Food.as_type.loc22_37.2 (%Food.as_type.952) = binding_pattern food -// CHECK:STDOUT: %food.param_patt: @Feed.%Food.as_type.loc22_37.2 (%Food.as_type.952) = value_param_pattern %food.patt, call_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Edible.ref: type = name_ref Edible, file.%Edible.decl [concrete = constants.%Edible.type] -// CHECK:STDOUT: %Food.loc22_9.1: %Edible.type = bind_symbolic_name Food, 0 [symbolic = %Food.loc22_9.2 (constants.%Food.9af)] -// CHECK:STDOUT: %.loc22_37.1: type = splice_block %Eats.type.loc22_37.1 [symbolic = %Eats.type.loc22_37.2 (constants.%Eats.type.b39)] { -// CHECK:STDOUT: %Eats.ref: %Eats.type.ba2 = name_ref Eats, file.%Eats.decl [concrete = constants.%Eats.generic] -// CHECK:STDOUT: %Food.ref.loc22_33: %Edible.type = name_ref Food, %Food.loc22_9.1 [symbolic = %Food.loc22_9.2 (constants.%Food.9af)] -// CHECK:STDOUT: %Food.as_type.loc22_37.1: type = facet_access_type %Food.ref.loc22_33 [symbolic = %Food.as_type.loc22_37.2 (constants.%Food.as_type.952)] -// CHECK:STDOUT: %.loc22_37.2: type = converted %Food.ref.loc22_33, %Food.as_type.loc22_37.1 [symbolic = %Food.as_type.loc22_37.2 (constants.%Food.as_type.952)] -// CHECK:STDOUT: %Eats.type.loc22_37.1: type = facet_type <@Eats, @Eats(constants.%Food.as_type.952)> [symbolic = %Eats.type.loc22_37.2 (constants.%Eats.type.b39)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc22_24.1: @Feed.%Eats.type.loc22_37.2 (%Eats.type.b39) = bind_symbolic_name T, 1 [symbolic = %T.loc22_24.2 (constants.%T.223)] -// CHECK:STDOUT: %e.param: @Feed.%T.as_type.loc22_43.2 (%T.as_type.212) = value_param call_param0 -// CHECK:STDOUT: %.loc22_43.1: type = splice_block %.loc22_43.2 [symbolic = %T.as_type.loc22_43.2 (constants.%T.as_type.212)] { -// CHECK:STDOUT: %T.ref: @Feed.%Eats.type.loc22_37.2 (%Eats.type.b39) = name_ref T, %T.loc22_24.1 [symbolic = %T.loc22_24.2 (constants.%T.223)] -// CHECK:STDOUT: %T.as_type.loc22_43.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc22_43.2 (constants.%T.as_type.212)] -// CHECK:STDOUT: %.loc22_43.2: type = converted %T.ref, %T.as_type.loc22_43.1 [symbolic = %T.as_type.loc22_43.2 (constants.%T.as_type.212)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %e: @Feed.%T.as_type.loc22_43.2 (%T.as_type.212) = bind_name e, %e.param -// CHECK:STDOUT: %food.param: @Feed.%Food.as_type.loc22_37.2 (%Food.as_type.952) = value_param call_param1 -// CHECK:STDOUT: %.loc22_52.1: type = splice_block %.loc22_52.2 [symbolic = %Food.as_type.loc22_37.2 (constants.%Food.as_type.952)] { -// CHECK:STDOUT: %Food.ref.loc22_52: %Edible.type = name_ref Food, %Food.loc22_9.1 [symbolic = %Food.loc22_9.2 (constants.%Food.9af)] -// CHECK:STDOUT: %Food.as_type.loc22_52: type = facet_access_type %Food.ref.loc22_52 [symbolic = %Food.as_type.loc22_37.2 (constants.%Food.as_type.952)] -// CHECK:STDOUT: %.loc22_52.2: type = converted %Food.ref.loc22_52, %Food.as_type.loc22_52 [symbolic = %Food.as_type.loc22_37.2 (constants.%Food.as_type.952)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %food: @Feed.%Food.as_type.loc22_37.2 (%Food.as_type.952) = bind_name food, %food.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %HandleAnimal.decl: %HandleAnimal.type = fn_decl @HandleAnimal [concrete = constants.%HandleAnimal] { -// CHECK:STDOUT: %T.patt.loc23_17.1: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc23_17.2 (constants.%T.patt.a9c)] -// CHECK:STDOUT: %Food.patt.loc23_29.1: %Edible.type = symbolic_binding_pattern Food, 1 [symbolic = %Food.patt.loc23_29.2 (constants.%Food.patt.551)] -// CHECK:STDOUT: %a.patt: @HandleAnimal.%T.as_type.loc23_47.2 (%T.as_type.2ad) = binding_pattern a -// CHECK:STDOUT: %a.param_patt: @HandleAnimal.%T.as_type.loc23_47.2 (%T.as_type.2ad) = value_param_pattern %a.patt, call_param0 -// CHECK:STDOUT: %food.patt: @HandleAnimal.%Food.as_type.loc23_56.2 (%Food.as_type.fae) = binding_pattern food -// CHECK:STDOUT: %food.param_patt: @HandleAnimal.%Food.as_type.loc23_56.2 (%Food.as_type.fae) = value_param_pattern %food.patt, call_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: %T.loc23_17.1: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc23_17.2 (constants.%T.fd4)] -// CHECK:STDOUT: %Edible.ref: type = name_ref Edible, file.%Edible.decl [concrete = constants.%Edible.type] -// CHECK:STDOUT: %Food.loc23_29.1: %Edible.type = bind_symbolic_name Food, 1 [symbolic = %Food.loc23_29.2 (constants.%Food.5fe)] -// CHECK:STDOUT: %a.param: @HandleAnimal.%T.as_type.loc23_47.2 (%T.as_type.2ad) = value_param call_param0 -// CHECK:STDOUT: %.loc23_47.1: type = splice_block %.loc23_47.2 [symbolic = %T.as_type.loc23_47.2 (constants.%T.as_type.2ad)] { -// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc23_17.1 [symbolic = %T.loc23_17.2 (constants.%T.fd4)] -// CHECK:STDOUT: %T.as_type.loc23_47.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc23_47.2 (constants.%T.as_type.2ad)] -// CHECK:STDOUT: %.loc23_47.2: type = converted %T.ref, %T.as_type.loc23_47.1 [symbolic = %T.as_type.loc23_47.2 (constants.%T.as_type.2ad)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: @HandleAnimal.%T.as_type.loc23_47.2 (%T.as_type.2ad) = bind_name a, %a.param -// CHECK:STDOUT: %food.param: @HandleAnimal.%Food.as_type.loc23_56.2 (%Food.as_type.fae) = value_param call_param1 -// CHECK:STDOUT: %.loc23_56.1: type = splice_block %.loc23_56.2 [symbolic = %Food.as_type.loc23_56.2 (constants.%Food.as_type.fae)] { -// CHECK:STDOUT: %Food.ref: %Edible.type = name_ref Food, %Food.loc23_29.1 [symbolic = %Food.loc23_29.2 (constants.%Food.5fe)] -// CHECK:STDOUT: %Food.as_type.loc23_56.1: type = facet_access_type %Food.ref [symbolic = %Food.as_type.loc23_56.2 (constants.%Food.as_type.fae)] -// CHECK:STDOUT: %.loc23_56.2: type = converted %Food.ref, %Food.as_type.loc23_56.1 [symbolic = %Food.as_type.loc23_56.2 (constants.%Food.as_type.fae)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %food: @HandleAnimal.%Food.as_type.loc23_56.2 (%Food.as_type.fae) = bind_name food, %food.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: interface @Edible { -// CHECK:STDOUT: %Self: %Edible.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.9af] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: witness = () -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: interface @Animal { -// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.fd4] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: witness = () -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Eats(%Food.loc12_16.1: type) { -// CHECK:STDOUT: %Food.loc12_16.2: type = bind_symbolic_name Food, 0 [symbolic = %Food.loc12_16.2 (constants.%Food.8b3)] -// CHECK:STDOUT: %Food.patt.loc12_16.2: type = symbolic_binding_pattern Food, 0 [symbolic = %Food.patt.loc12_16.2 (constants.%Food.patt.e01)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Eats.type: type = facet_type <@Eats, @Eats(%Food.loc12_16.2)> [symbolic = %Eats.type (constants.%Eats.type.6c0)] -// CHECK:STDOUT: %Self.2: %Eats.type.6c0 = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.4eb)] -// CHECK:STDOUT: -// CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.1: @Eats.%Eats.type (%Eats.type.6c0) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.4eb)] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: witness = () -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: impl @impl.592: %Grass.ref as %Edible.ref { -// CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = file.%impl_witness.loc9 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic impl @impl.009(%T.loc17_14.1: %Animal.type, %U.loc17_26.1: %Edible.type) { -// CHECK:STDOUT: %T.loc17_14.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc17_14.2 (constants.%T.fd4)] -// CHECK:STDOUT: %T.patt.loc17_14.2: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc17_14.2 (constants.%T.patt.a9c)] -// CHECK:STDOUT: %U.loc17_26.2: %Edible.type = bind_symbolic_name U, 1 [symbolic = %U.loc17_26.2 (constants.%U)] -// CHECK:STDOUT: %U.patt.loc17_26.2: %Edible.type = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc17_26.2 (constants.%U.patt)] -// CHECK:STDOUT: %T.as_type.loc17_38.2: type = facet_access_type %T.loc17_14.2 [symbolic = %T.as_type.loc17_38.2 (constants.%T.as_type.2ad)] -// CHECK:STDOUT: %U.as_type.loc17_49.2: type = facet_access_type %U.loc17_26.2 [symbolic = %U.as_type.loc17_49.2 (constants.%U.as_type)] -// CHECK:STDOUT: %Eats.type.loc17_49.2: type = facet_type <@Eats, @Eats(%U.as_type.loc17_49.2)> [symbolic = %Eats.type.loc17_49.2 (constants.%Eats.type.f54c3d.1)] -// CHECK:STDOUT: %require_complete: = require_complete_type @impl.009.%Eats.type.loc17_49.2 (%Eats.type.f54c3d.1) [symbolic = %require_complete (constants.%require_complete.42532a.1)] -// CHECK:STDOUT: %impl_witness: = impl_witness (), @impl.009(%T.loc17_14.2, %U.loc17_26.2) [symbolic = %impl_witness (constants.%impl_witness.c7c36b.1)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: -// CHECK:STDOUT: impl: %.loc17_38 as %Eats.type.loc17_49.1 { -// CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = file.%impl_witness.loc17 -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: impl @impl.27e: %Goat.ref as %Animal.ref { -// CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = file.%impl_witness.loc20 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @Grass { -// 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.%Grass -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @Goat { -// 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.%Goat -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Feed(%Food.loc22_9.1: %Edible.type, %T.loc22_24.1: @Feed.%Eats.type.loc22_37.2 (%Eats.type.b39)) { -// CHECK:STDOUT: %Food.loc22_9.2: %Edible.type = bind_symbolic_name Food, 0 [symbolic = %Food.loc22_9.2 (constants.%Food.9af)] -// CHECK:STDOUT: %Food.patt.loc22_9.2: %Edible.type = symbolic_binding_pattern Food, 0 [symbolic = %Food.patt.loc22_9.2 (constants.%Food.patt.0b7)] -// CHECK:STDOUT: %Food.as_type.loc22_37.2: type = facet_access_type %Food.loc22_9.2 [symbolic = %Food.as_type.loc22_37.2 (constants.%Food.as_type.952)] -// CHECK:STDOUT: %Eats.type.loc22_37.2: type = facet_type <@Eats, @Eats(%Food.as_type.loc22_37.2)> [symbolic = %Eats.type.loc22_37.2 (constants.%Eats.type.b39)] -// CHECK:STDOUT: %T.loc22_24.2: %Eats.type.b39 = bind_symbolic_name T, 1 [symbolic = %T.loc22_24.2 (constants.%T.223)] -// CHECK:STDOUT: %T.patt.loc22_24.2: %Eats.type.b39 = symbolic_binding_pattern T, 1 [symbolic = %T.patt.loc22_24.2 (constants.%T.patt.f09)] -// CHECK:STDOUT: %T.as_type.loc22_43.2: type = facet_access_type %T.loc22_24.2 [symbolic = %T.as_type.loc22_43.2 (constants.%T.as_type.212)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc22_41: = require_complete_type @Feed.%T.as_type.loc22_43.2 (%T.as_type.212) [symbolic = %require_complete.loc22_41 (constants.%require_complete.fe6)] -// CHECK:STDOUT: %require_complete.loc22_50: = require_complete_type @Feed.%Food.as_type.loc22_37.2 (%Food.as_type.952) [symbolic = %require_complete.loc22_50 (constants.%require_complete.005)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%Food.patt.loc22_9.1: %Edible.type, %T.patt.loc22_24.1: @Feed.%Eats.type.loc22_37.2 (%Eats.type.b39)](%e.param_patt: @Feed.%T.as_type.loc22_43.2 (%T.as_type.212), %food.param_patt: @Feed.%Food.as_type.loc22_37.2 (%Food.as_type.952)) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @HandleAnimal(%T.loc23_17.1: %Animal.type, %Food.loc23_29.1: %Edible.type) { -// CHECK:STDOUT: %T.loc23_17.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc23_17.2 (constants.%T.fd4)] -// CHECK:STDOUT: %T.patt.loc23_17.2: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc23_17.2 (constants.%T.patt.a9c)] -// CHECK:STDOUT: %Food.loc23_29.2: %Edible.type = bind_symbolic_name Food, 1 [symbolic = %Food.loc23_29.2 (constants.%Food.5fe)] -// CHECK:STDOUT: %Food.patt.loc23_29.2: %Edible.type = symbolic_binding_pattern Food, 1 [symbolic = %Food.patt.loc23_29.2 (constants.%Food.patt.551)] -// CHECK:STDOUT: %T.as_type.loc23_47.2: type = facet_access_type %T.loc23_17.2 [symbolic = %T.as_type.loc23_47.2 (constants.%T.as_type.2ad)] -// CHECK:STDOUT: %Food.as_type.loc23_56.2: type = facet_access_type %Food.loc23_29.2 [symbolic = %Food.as_type.loc23_56.2 (constants.%Food.as_type.fae)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc23_45: = require_complete_type @HandleAnimal.%T.as_type.loc23_47.2 (%T.as_type.2ad) [symbolic = %require_complete.loc23_45 (constants.%require_complete.234)] -// CHECK:STDOUT: %require_complete.loc23_54: = require_complete_type @HandleAnimal.%Food.as_type.loc23_56.2 (%Food.as_type.fae) [symbolic = %require_complete.loc23_54 (constants.%require_complete.444)] -// CHECK:STDOUT: %Eats.type: type = facet_type <@Eats, @Eats(%Food.as_type.loc23_56.2)> [symbolic = %Eats.type (constants.%Eats.type.f54c3d.2)] -// CHECK:STDOUT: %impl_witness: = impl_witness (), @impl.009(%T.loc23_17.2, %Food.loc23_29.2) [symbolic = %impl_witness (constants.%impl_witness.c7c36b.2)] -// CHECK:STDOUT: %Eats.facet.loc23_76.2: @HandleAnimal.%Eats.type (%Eats.type.f54c3d.2) = facet_value %T.as_type.loc23_47.2, (%impl_witness) [symbolic = %Eats.facet.loc23_76.2 (constants.%Eats.facet.97e)] -// CHECK:STDOUT: %Feed.specific_fn.loc23_64.2: = specific_function constants.%Feed, @Feed(%Food.loc23_29.2, %Eats.facet.loc23_76.2) [symbolic = %Feed.specific_fn.loc23_64.2 (constants.%Feed.specific_fn.387)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%T.patt.loc23_17.1: %Animal.type, %Food.patt.loc23_29.1: %Edible.type](%a.param_patt: @HandleAnimal.%T.as_type.loc23_47.2 (%T.as_type.2ad), %food.param_patt: @HandleAnimal.%Food.as_type.loc23_56.2 (%Food.as_type.fae)) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Feed.ref: %Feed.type = name_ref Feed, file.%Feed.decl [concrete = constants.%Feed] -// CHECK:STDOUT: %a.ref: @HandleAnimal.%T.as_type.loc23_47.2 (%T.as_type.2ad) = name_ref a, %a -// CHECK:STDOUT: %food.ref: @HandleAnimal.%Food.as_type.loc23_56.2 (%Food.as_type.fae) = name_ref food, %food -// CHECK:STDOUT: %.loc23_76.1: %Edible.type = converted constants.%Food.as_type.fae, constants.%Food.5fe [symbolic = %Food.loc23_29.2 (constants.%Food.5fe)] -// CHECK:STDOUT: %.loc23_76.2: %Edible.type = converted constants.%Food.as_type.fae, constants.%Food.5fe [symbolic = %Food.loc23_29.2 (constants.%Food.5fe)] -// CHECK:STDOUT: %.loc23_76.3: %Edible.type = converted constants.%Food.as_type.fae, constants.%Food.5fe [symbolic = %Food.loc23_29.2 (constants.%Food.5fe)] -// CHECK:STDOUT: %.loc23_76.4: %Animal.type = converted constants.%T.as_type.2ad, constants.%T.fd4 [symbolic = %T.loc23_17.2 (constants.%T.fd4)] -// CHECK:STDOUT: %Eats.facet.loc23_76.1: @HandleAnimal.%Eats.type (%Eats.type.f54c3d.2) = facet_value constants.%T.as_type.2ad, (constants.%impl_witness.c7c36b.2) [symbolic = %Eats.facet.loc23_76.2 (constants.%Eats.facet.97e)] -// CHECK:STDOUT: %.loc23_76.5: @HandleAnimal.%Eats.type (%Eats.type.f54c3d.2) = converted constants.%T.as_type.2ad, %Eats.facet.loc23_76.1 [symbolic = %Eats.facet.loc23_76.2 (constants.%Eats.facet.97e)] -// CHECK:STDOUT: %Feed.specific_fn.loc23_64.1: = specific_function %Feed.ref, @Feed(constants.%Food.5fe, constants.%Eats.facet.97e) [symbolic = %Feed.specific_fn.loc23_64.2 (constants.%Feed.specific_fn.387)] -// CHECK:STDOUT: %Feed.call: init %empty_tuple.type = call %Feed.specific_fn.loc23_64.1(%a.ref, %food.ref) -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @F() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %HandleAnimal.ref: %HandleAnimal.type = name_ref HandleAnimal, file.%HandleAnimal.decl [concrete = constants.%HandleAnimal] -// CHECK:STDOUT: %.loc26_17.1: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] -// CHECK:STDOUT: %.loc26_17.2: ref %Goat = temporary_storage -// CHECK:STDOUT: %.loc26_17.3: init %Goat = class_init (), %.loc26_17.2 [concrete = constants.%Goat.val] -// CHECK:STDOUT: %.loc26_17.4: ref %Goat = temporary %.loc26_17.2, %.loc26_17.3 -// CHECK:STDOUT: %.loc26_19.1: ref %Goat = converted %.loc26_17.1, %.loc26_17.4 -// CHECK:STDOUT: %.loc26_29.1: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %Grass.ref: type = name_ref Grass, file.%Grass.decl [concrete = constants.%Grass] -// CHECK:STDOUT: %.loc26_29.2: ref %Grass = temporary_storage -// CHECK:STDOUT: %.loc26_29.3: init %Grass = class_init (), %.loc26_29.2 [concrete = constants.%Grass.val] -// CHECK:STDOUT: %.loc26_29.4: ref %Grass = temporary %.loc26_29.2, %.loc26_29.3 -// CHECK:STDOUT: %.loc26_31.1: ref %Grass = converted %.loc26_29.1, %.loc26_29.4 -// CHECK:STDOUT: %Animal.facet.loc26_39.1: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness.1bc) [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %.loc26_39.1: %Animal.type = converted constants.%Goat, %Animal.facet.loc26_39.1 [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %Animal.facet.loc26_39.2: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness.1bc) [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %.loc26_39.2: %Animal.type = converted constants.%Goat, %Animal.facet.loc26_39.2 [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %Edible.facet.loc26_39.1: %Edible.type = facet_value constants.%Grass, (constants.%impl_witness.1bc) [concrete = constants.%Edible.facet] -// CHECK:STDOUT: %.loc26_39.3: %Edible.type = converted constants.%Grass, %Edible.facet.loc26_39.1 [concrete = constants.%Edible.facet] -// CHECK:STDOUT: %Edible.facet.loc26_39.2: %Edible.type = facet_value constants.%Grass, (constants.%impl_witness.1bc) [concrete = constants.%Edible.facet] -// CHECK:STDOUT: %.loc26_39.4: %Edible.type = converted constants.%Grass, %Edible.facet.loc26_39.2 [concrete = constants.%Edible.facet] -// CHECK:STDOUT: %HandleAnimal.specific_fn: = specific_function %HandleAnimal.ref, @HandleAnimal(constants.%Animal.facet, constants.%Edible.facet) [concrete = constants.%HandleAnimal.specific_fn] -// CHECK:STDOUT: %.loc26_19.2: %Goat = bind_value %.loc26_19.1 -// CHECK:STDOUT: %.loc26_31.2: %Grass = bind_value %.loc26_31.1 -// CHECK:STDOUT: %HandleAnimal.call: init %empty_tuple.type = call %HandleAnimal.specific_fn(%.loc26_19.2, %.loc26_31.2) -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Eats(constants.%Food.8b3) { -// CHECK:STDOUT: %Food.loc12_16.2 => constants.%Food.8b3 -// CHECK:STDOUT: %Food.patt.loc12_16.2 => constants.%Food.8b3 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Eats(%Food.loc12_16.2) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Eats(constants.%U.as_type) { -// CHECK:STDOUT: %Food.loc12_16.2 => constants.%U.as_type -// CHECK:STDOUT: %Food.patt.loc12_16.2 => constants.%U.as_type -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Eats.type => constants.%Eats.type.f54c3d.1 -// CHECK:STDOUT: %Self.2 => constants.%Self.4eb -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @impl.009(constants.%T.fd4, constants.%U) { -// CHECK:STDOUT: %T.loc17_14.2 => constants.%T.fd4 -// CHECK:STDOUT: %T.patt.loc17_14.2 => constants.%T.fd4 -// CHECK:STDOUT: %U.loc17_26.2 => constants.%U -// CHECK:STDOUT: %U.patt.loc17_26.2 => constants.%U -// CHECK:STDOUT: %T.as_type.loc17_38.2 => constants.%T.as_type.2ad -// CHECK:STDOUT: %U.as_type.loc17_49.2 => constants.%U.as_type -// CHECK:STDOUT: %Eats.type.loc17_49.2 => constants.%Eats.type.f54c3d.1 -// CHECK:STDOUT: %require_complete => constants.%require_complete.42532a.1 -// CHECK:STDOUT: %impl_witness => constants.%impl_witness.c7c36b.1 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Eats(@impl.009.%U.as_type.loc17_49.2) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @impl.009(%T.loc17_14.2, %U.loc17_26.2) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Eats(constants.%Food.as_type.952) { -// CHECK:STDOUT: %Food.loc12_16.2 => constants.%Food.as_type.952 -// CHECK:STDOUT: %Food.patt.loc12_16.2 => constants.%Food.as_type.952 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Feed(constants.%Food.9af, constants.%T.223) { -// CHECK:STDOUT: %Food.loc22_9.2 => constants.%Food.9af -// CHECK:STDOUT: %Food.patt.loc22_9.2 => constants.%Food.9af -// CHECK:STDOUT: %Food.as_type.loc22_37.2 => constants.%Food.as_type.952 -// CHECK:STDOUT: %Eats.type.loc22_37.2 => constants.%Eats.type.b39 -// CHECK:STDOUT: %T.loc22_24.2 => constants.%T.223 -// CHECK:STDOUT: %T.patt.loc22_24.2 => constants.%T.223 -// CHECK:STDOUT: %T.as_type.loc22_43.2 => constants.%T.as_type.212 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Eats(@Feed.%Food.as_type.loc22_37.2) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @HandleAnimal(constants.%T.fd4, constants.%Food.5fe) { -// CHECK:STDOUT: %T.loc23_17.2 => constants.%T.fd4 -// CHECK:STDOUT: %T.patt.loc23_17.2 => constants.%T.fd4 -// CHECK:STDOUT: %Food.loc23_29.2 => constants.%Food.5fe -// CHECK:STDOUT: %Food.patt.loc23_29.2 => constants.%Food.5fe -// CHECK:STDOUT: %T.as_type.loc23_47.2 => constants.%T.as_type.2ad -// CHECK:STDOUT: %Food.as_type.loc23_56.2 => constants.%Food.as_type.fae -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Eats(constants.%Food.as_type.fae) { -// CHECK:STDOUT: %Food.loc12_16.2 => constants.%Food.as_type.fae -// CHECK:STDOUT: %Food.patt.loc12_16.2 => constants.%Food.as_type.fae -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @impl.009(constants.%T.fd4, constants.%Food.5fe) { -// CHECK:STDOUT: %T.loc17_14.2 => constants.%T.fd4 -// CHECK:STDOUT: %T.patt.loc17_14.2 => constants.%T.fd4 -// CHECK:STDOUT: %U.loc17_26.2 => constants.%Food.5fe -// CHECK:STDOUT: %U.patt.loc17_26.2 => constants.%Food.5fe -// CHECK:STDOUT: %T.as_type.loc17_38.2 => constants.%T.as_type.2ad -// CHECK:STDOUT: %U.as_type.loc17_49.2 => constants.%Food.as_type.fae -// CHECK:STDOUT: %Eats.type.loc17_49.2 => constants.%Eats.type.f54c3d.2 -// CHECK:STDOUT: %require_complete => constants.%require_complete.42532a.2 -// CHECK:STDOUT: %impl_witness => constants.%impl_witness.c7c36b.2 -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Feed(constants.%Food.5fe, constants.%Eats.facet.97e) { -// CHECK:STDOUT: %Food.loc22_9.2 => constants.%Food.5fe -// CHECK:STDOUT: %Food.patt.loc22_9.2 => constants.%Food.5fe -// CHECK:STDOUT: %Food.as_type.loc22_37.2 => constants.%Food.as_type.fae -// CHECK:STDOUT: %Eats.type.loc22_37.2 => constants.%Eats.type.f54c3d.2 -// CHECK:STDOUT: %T.loc22_24.2 => constants.%Eats.facet.97e -// CHECK:STDOUT: %T.patt.loc22_24.2 => constants.%Eats.facet.97e -// CHECK:STDOUT: %T.as_type.loc22_43.2 => constants.%T.as_type.2ad -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc22_41 => constants.%require_complete.234 -// CHECK:STDOUT: %require_complete.loc22_50 => constants.%require_complete.444 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Eats(@HandleAnimal.%Food.as_type.loc23_56.2) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @impl.009(@HandleAnimal.%T.loc23_17.2, @HandleAnimal.%Food.loc23_29.2) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Feed(@HandleAnimal.%Food.loc23_29.2, @HandleAnimal.%Eats.facet.loc23_76.2) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @HandleAnimal(constants.%Animal.facet, constants.%Edible.facet) { -// CHECK:STDOUT: %T.loc23_17.2 => constants.%Animal.facet -// CHECK:STDOUT: %T.patt.loc23_17.2 => constants.%Animal.facet -// CHECK:STDOUT: %Food.loc23_29.2 => constants.%Edible.facet -// CHECK:STDOUT: %Food.patt.loc23_29.2 => constants.%Edible.facet -// CHECK:STDOUT: %T.as_type.loc23_47.2 => constants.%Goat -// CHECK:STDOUT: %Food.as_type.loc23_56.2 => constants.%Grass -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc23_45 => constants.%complete_type.357 -// CHECK:STDOUT: %require_complete.loc23_54 => constants.%complete_type.357 -// CHECK:STDOUT: %Eats.type => constants.%Eats.type.1ae -// CHECK:STDOUT: %impl_witness => constants.%impl_witness.4f1 -// CHECK:STDOUT: %Eats.facet.loc23_76.2 => constants.%Eats.facet.fa6 -// CHECK:STDOUT: %Feed.specific_fn.loc23_64.2 => constants.%Feed.specific_fn.d82 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Eats(constants.%Grass) { -// CHECK:STDOUT: %Food.loc12_16.2 => constants.%Grass -// CHECK:STDOUT: %Food.patt.loc12_16.2 => constants.%Grass -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Eats.type => constants.%Eats.type.1ae -// CHECK:STDOUT: %Self.2 => constants.%Self.4eb -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @impl.009(constants.%Animal.facet, constants.%Edible.facet) { -// CHECK:STDOUT: %T.loc17_14.2 => constants.%Animal.facet -// CHECK:STDOUT: %T.patt.loc17_14.2 => constants.%Animal.facet -// CHECK:STDOUT: %U.loc17_26.2 => constants.%Edible.facet -// CHECK:STDOUT: %U.patt.loc17_26.2 => constants.%Edible.facet -// CHECK:STDOUT: %T.as_type.loc17_38.2 => constants.%Goat -// CHECK:STDOUT: %U.as_type.loc17_49.2 => constants.%Grass -// CHECK:STDOUT: %Eats.type.loc17_49.2 => constants.%Eats.type.1ae -// CHECK:STDOUT: %require_complete => constants.%complete_type.004 -// CHECK:STDOUT: %impl_witness => constants.%impl_witness.4f1 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Feed(constants.%Edible.facet, constants.%Eats.facet.fa6) { -// CHECK:STDOUT: %Food.loc22_9.2 => constants.%Edible.facet -// CHECK:STDOUT: %Food.patt.loc22_9.2 => constants.%Edible.facet -// CHECK:STDOUT: %Food.as_type.loc22_37.2 => constants.%Grass -// CHECK:STDOUT: %Eats.type.loc22_37.2 => constants.%Eats.type.1ae -// CHECK:STDOUT: %T.loc22_24.2 => constants.%Eats.facet.fa6 -// CHECK:STDOUT: %T.patt.loc22_24.2 => constants.%Eats.facet.fa6 -// CHECK:STDOUT: %T.as_type.loc22_43.2 => constants.%Goat -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_value_to_itself.carbon b/toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_value_to_itself.carbon deleted file mode 100644 index 91b57ec47300..000000000000 --- a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_value_to_itself.carbon +++ /dev/null @@ -1,322 +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/builtin_conversions/no_prelude/convert_facet_value_value_to_itself.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_value_to_itself.carbon - -// --- core.carbon - -package Core; - -interface ImplicitAs(Dest:! type) { - fn Convert[self: Self]() -> Dest; -} - -// --- a.carbon - -library "[[@TEST_NAME]]"; - -import Core; - -interface Animal {} - -fn FeedAnimal[T:! Animal](a: T) {} - -fn HandleAnimal[T:! Animal](a: T) { FeedAnimal(a); } - -class Goat {} -impl Goat as Animal {} - -fn F() { - HandleAnimal({} as Goat); -} - -// CHECK:STDOUT: --- core.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic] -// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic] -// CHECK:STDOUT: %ImplicitAs.type.96f: type = generic_interface_type @ImplicitAs [concrete] -// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.96f = struct_value () [concrete] -// CHECK:STDOUT: %ImplicitAs.type.07f: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic] -// CHECK:STDOUT: %Self: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] -// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic] -// CHECK:STDOUT: %Convert: %Convert.type = struct_value () [symbolic] -// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type %ImplicitAs.type.07f [symbolic] -// CHECK:STDOUT: %assoc0: %ImplicitAs.assoc_type = assoc_entity element0, @ImplicitAs.%Convert.decl [symbolic] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { -// CHECK:STDOUT: %Dest.patt.loc4_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc4_22.2 (constants.%Dest.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.loc4_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc4_22.2 (constants.%Dest)] -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc4_22.1: type) { -// CHECK:STDOUT: %Dest.loc4_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc4_22.2 (constants.%Dest)] -// CHECK:STDOUT: %Dest.patt.loc4_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc4_22.2 (constants.%Dest.patt)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc4_22.2)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.07f)] -// CHECK:STDOUT: %Self.2: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest.loc4_22.2) [symbolic = %Convert.type (constants.%Convert.type)] -// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type) = struct_value () [symbolic = %Convert (constants.%Convert)] -// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type)] -// CHECK:STDOUT: %assoc0.loc5_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc5_35.2 (constants.%assoc0)] -// CHECK:STDOUT: -// CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %Convert.decl: @ImplicitAs.%Convert.type (%Convert.type) = fn_decl @Convert [symbolic = @ImplicitAs.%Convert (constants.%Convert)] { -// CHECK:STDOUT: %self.patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = binding_pattern self -// CHECK:STDOUT: %self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = value_param_pattern %self.patt, call_param0 -// CHECK:STDOUT: %return.patt: @Convert.%Dest (%Dest) = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: @Convert.%Dest (%Dest) = out_param_pattern %return.patt, call_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc4_22.1 [symbolic = %Dest (constants.%Dest)] -// CHECK:STDOUT: %self.param: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc5_20.1: type = splice_block %.loc5_20.3 [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] { -// CHECK:STDOUT: %.loc5_20.2: @Convert.%ImplicitAs.type (%ImplicitAs.type.07f) = specific_constant @ImplicitAs.%Self.1, @ImplicitAs(constants.%Dest) [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.ref: @Convert.%ImplicitAs.type (%ImplicitAs.type.07f) = name_ref Self, %.loc5_20.2 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc5_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc5_20.3: type = converted %Self.ref, %Self.as_type.loc5_20.2 [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = bind_name self, %self.param -// CHECK:STDOUT: %return.param: ref @Convert.%Dest (%Dest) = out_param call_param1 -// CHECK:STDOUT: %return: ref @Convert.%Dest (%Dest) = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %assoc0.loc5_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc5_35.2 (constants.%assoc0)] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .Dest = -// CHECK:STDOUT: .Convert = %assoc0.loc5_35.1 -// CHECK:STDOUT: witness = (%Convert.decl) -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert(@ImplicitAs.%Dest.loc4_22.1: type, @ImplicitAs.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f)) { -// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.07f)] -// CHECK:STDOUT: %Self: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc5_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type)]() -> @Convert.%Dest (%Dest); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { -// CHECK:STDOUT: %Dest.loc4_22.2 => constants.%Dest -// CHECK:STDOUT: %Dest.patt.loc4_22.2 => constants.%Dest -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self) { -// CHECK:STDOUT: %Dest => constants.%Dest -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.07f -// CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.as_type.loc5_20.1 => constants.%Self.as_type -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(%Dest.loc4_22.2) {} -// CHECK:STDOUT: -// CHECK:STDOUT: --- a.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Animal.type: type = facet_type <@Animal> [concrete] -// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic] -// CHECK:STDOUT: %T: %Animal.type = bind_symbolic_name T, 0 [symbolic] -// CHECK:STDOUT: %T.patt: %Animal.type = symbolic_binding_pattern T, 0 [symbolic] -// CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic] -// CHECK:STDOUT: %FeedAnimal.type: type = fn_type @FeedAnimal [concrete] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %FeedAnimal: %FeedAnimal.type = struct_value () [concrete] -// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type [symbolic] -// CHECK:STDOUT: %HandleAnimal.type: type = fn_type @HandleAnimal [concrete] -// CHECK:STDOUT: %HandleAnimal: %HandleAnimal.type = struct_value () [concrete] -// CHECK:STDOUT: %FeedAnimal.specific_fn.ec8: = specific_function %FeedAnimal, @FeedAnimal(%T) [symbolic] -// CHECK:STDOUT: %Goat: type = class_type @Goat [concrete] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %impl_witness: = impl_witness () [concrete] -// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] -// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] -// CHECK:STDOUT: %Goat.val: %Goat = struct_value () [concrete] -// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value %Goat, (%impl_witness) [concrete] -// CHECK:STDOUT: %HandleAnimal.specific_fn: = specific_function %HandleAnimal, @HandleAnimal(%Animal.facet) [concrete] -// CHECK:STDOUT: %FeedAnimal.specific_fn.5d0: = specific_function %FeedAnimal, @FeedAnimal(%Animal.facet) [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: import Core//default -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Animal = %Animal.decl -// CHECK:STDOUT: .FeedAnimal = %FeedAnimal.decl -// CHECK:STDOUT: .HandleAnimal = %HandleAnimal.decl -// CHECK:STDOUT: .Goat = %Goat.decl -// CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Animal.decl: type = interface_decl @Animal [concrete = constants.%Animal.type] {} {} -// CHECK:STDOUT: %FeedAnimal.decl: %FeedAnimal.type = fn_decl @FeedAnimal [concrete = constants.%FeedAnimal] { -// CHECK:STDOUT: %T.patt.loc8_15.1: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %a.patt: @FeedAnimal.%T.as_type.loc8_30.2 (%T.as_type) = binding_pattern a -// CHECK:STDOUT: %a.param_patt: @FeedAnimal.%T.as_type.loc8_30.2 (%T.as_type) = value_param_pattern %a.patt, call_param0 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: %T.loc8_15.1: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc8_15.2 (constants.%T)] -// CHECK:STDOUT: %a.param: @FeedAnimal.%T.as_type.loc8_30.2 (%T.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc8_30.1: type = splice_block %.loc8_30.2 [symbolic = %T.as_type.loc8_30.2 (constants.%T.as_type)] { -// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc8_15.1 [symbolic = %T.loc8_15.2 (constants.%T)] -// CHECK:STDOUT: %T.as_type.loc8_30.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc8_30.2 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc8_30.2: type = converted %T.ref, %T.as_type.loc8_30.1 [symbolic = %T.as_type.loc8_30.2 (constants.%T.as_type)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: @FeedAnimal.%T.as_type.loc8_30.2 (%T.as_type) = bind_name a, %a.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %HandleAnimal.decl: %HandleAnimal.type = fn_decl @HandleAnimal [concrete = constants.%HandleAnimal] { -// CHECK:STDOUT: %T.patt.loc10_17.1: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_17.2 (constants.%T.patt)] -// CHECK:STDOUT: %a.patt: @HandleAnimal.%T.as_type.loc10_32.2 (%T.as_type) = binding_pattern a -// CHECK:STDOUT: %a.param_patt: @HandleAnimal.%T.as_type.loc10_32.2 (%T.as_type) = value_param_pattern %a.patt, call_param0 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: %T.loc10_17.1: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc10_17.2 (constants.%T)] -// CHECK:STDOUT: %a.param: @HandleAnimal.%T.as_type.loc10_32.2 (%T.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc10_32.1: type = splice_block %.loc10_32.2 [symbolic = %T.as_type.loc10_32.2 (constants.%T.as_type)] { -// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc10_17.1 [symbolic = %T.loc10_17.2 (constants.%T)] -// CHECK:STDOUT: %T.as_type.loc10_32.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc10_32.2 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc10_32.2: type = converted %T.ref, %T.as_type.loc10_32.1 [symbolic = %T.as_type.loc10_32.2 (constants.%T.as_type)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: @HandleAnimal.%T.as_type.loc10_32.2 (%T.as_type) = bind_name a, %a.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Goat.decl: type = class_decl @Goat [concrete = constants.%Goat] {} {} -// CHECK:STDOUT: impl_decl @impl [concrete] {} { -// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] -// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %impl_witness: = impl_witness () [concrete = constants.%impl_witness] -// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: interface @Animal { -// CHECK:STDOUT: %Self: %Animal.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: impl @impl: %Goat.ref as %Animal.ref { -// CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = file.%impl_witness -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @Goat { -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type] -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%Goat -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @FeedAnimal(%T.loc8_15.1: %Animal.type) { -// CHECK:STDOUT: %T.loc8_15.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc8_15.2 (constants.%T)] -// CHECK:STDOUT: %T.patt.loc8_15.2: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.as_type.loc8_30.2: type = facet_access_type %T.loc8_15.2 [symbolic = %T.as_type.loc8_30.2 (constants.%T.as_type)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type @FeedAnimal.%T.as_type.loc8_30.2 (%T.as_type) [symbolic = %require_complete (constants.%require_complete)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%T.patt.loc8_15.1: %Animal.type](%a.param_patt: @FeedAnimal.%T.as_type.loc8_30.2 (%T.as_type)) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @HandleAnimal(%T.loc10_17.1: %Animal.type) { -// CHECK:STDOUT: %T.loc10_17.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc10_17.2 (constants.%T)] -// CHECK:STDOUT: %T.patt.loc10_17.2: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_17.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.as_type.loc10_32.2: type = facet_access_type %T.loc10_17.2 [symbolic = %T.as_type.loc10_32.2 (constants.%T.as_type)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type @HandleAnimal.%T.as_type.loc10_32.2 (%T.as_type) [symbolic = %require_complete (constants.%require_complete)] -// CHECK:STDOUT: %FeedAnimal.specific_fn.loc10_37.2: = specific_function constants.%FeedAnimal, @FeedAnimal(%T.loc10_17.2) [symbolic = %FeedAnimal.specific_fn.loc10_37.2 (constants.%FeedAnimal.specific_fn.ec8)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%T.patt.loc10_17.1: %Animal.type](%a.param_patt: @HandleAnimal.%T.as_type.loc10_32.2 (%T.as_type)) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %FeedAnimal.ref: %FeedAnimal.type = name_ref FeedAnimal, file.%FeedAnimal.decl [concrete = constants.%FeedAnimal] -// CHECK:STDOUT: %a.ref: @HandleAnimal.%T.as_type.loc10_32.2 (%T.as_type) = name_ref a, %a -// CHECK:STDOUT: %.loc10_49.1: %Animal.type = converted constants.%T.as_type, constants.%T [symbolic = %T.loc10_17.2 (constants.%T)] -// CHECK:STDOUT: %.loc10_49.2: %Animal.type = converted constants.%T.as_type, constants.%T [symbolic = %T.loc10_17.2 (constants.%T)] -// CHECK:STDOUT: %FeedAnimal.specific_fn.loc10_37.1: = specific_function %FeedAnimal.ref, @FeedAnimal(constants.%T) [symbolic = %FeedAnimal.specific_fn.loc10_37.2 (constants.%FeedAnimal.specific_fn.ec8)] -// CHECK:STDOUT: %FeedAnimal.call: init %empty_tuple.type = call %FeedAnimal.specific_fn.loc10_37.1(%a.ref) -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @F() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %HandleAnimal.ref: %HandleAnimal.type = name_ref HandleAnimal, file.%HandleAnimal.decl [concrete = constants.%HandleAnimal] -// CHECK:STDOUT: %.loc16_17.1: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] -// CHECK:STDOUT: %.loc16_17.2: ref %Goat = temporary_storage -// CHECK:STDOUT: %.loc16_17.3: init %Goat = class_init (), %.loc16_17.2 [concrete = constants.%Goat.val] -// CHECK:STDOUT: %.loc16_17.4: ref %Goat = temporary %.loc16_17.2, %.loc16_17.3 -// CHECK:STDOUT: %.loc16_19.1: ref %Goat = converted %.loc16_17.1, %.loc16_17.4 -// CHECK:STDOUT: %Animal.facet.loc16_26.1: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness) [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %.loc16_26.1: %Animal.type = converted constants.%Goat, %Animal.facet.loc16_26.1 [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %Animal.facet.loc16_26.2: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness) [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %.loc16_26.2: %Animal.type = converted constants.%Goat, %Animal.facet.loc16_26.2 [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %HandleAnimal.specific_fn: = specific_function %HandleAnimal.ref, @HandleAnimal(constants.%Animal.facet) [concrete = constants.%HandleAnimal.specific_fn] -// CHECK:STDOUT: %.loc16_19.2: %Goat = bind_value %.loc16_19.1 -// CHECK:STDOUT: %HandleAnimal.call: init %empty_tuple.type = call %HandleAnimal.specific_fn(%.loc16_19.2) -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @FeedAnimal(constants.%T) { -// CHECK:STDOUT: %T.loc8_15.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc8_15.2 => constants.%T -// CHECK:STDOUT: %T.as_type.loc8_30.2 => constants.%T.as_type -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete => constants.%require_complete -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @HandleAnimal(constants.%T) { -// CHECK:STDOUT: %T.loc10_17.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc10_17.2 => constants.%T -// CHECK:STDOUT: %T.as_type.loc10_32.2 => constants.%T.as_type -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @FeedAnimal(@HandleAnimal.%T.loc10_17.2) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @HandleAnimal(constants.%Animal.facet) { -// CHECK:STDOUT: %T.loc10_17.2 => constants.%Animal.facet -// CHECK:STDOUT: %T.patt.loc10_17.2 => constants.%Animal.facet -// CHECK:STDOUT: %T.as_type.loc10_32.2 => constants.%Goat -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete => constants.%complete_type -// CHECK:STDOUT: %FeedAnimal.specific_fn.loc10_37.2 => constants.%FeedAnimal.specific_fn.5d0 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @FeedAnimal(constants.%Animal.facet) { -// CHECK:STDOUT: %T.loc8_15.2 => constants.%Animal.facet -// CHECK:STDOUT: %T.patt.loc8_15.2 => constants.%Animal.facet -// CHECK:STDOUT: %T.as_type.loc8_30.2 => constants.%Goat -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_interface.carbon b/toolchain/check/testdata/builtin_conversions/no_prelude/convert_interface.carbon deleted file mode 100644 index 37def6c92d75..000000000000 --- a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_interface.carbon +++ /dev/null @@ -1,97 +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/builtin_conversions/no_prelude/convert_interface.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtin_conversions/no_prelude/convert_interface.carbon - -interface Eats {} -interface Animal {} - -// TODO: This may be rejected in the future. -// https://github.com/carbon-language/carbon-lang/issues/4853 -impl Animal as Eats {} - -fn F(e: Eats) {} -fn G() { F(Animal); } - -// CHECK:STDOUT: --- convert_interface.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Eats.type: type = facet_type <@Eats> [concrete] -// 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: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %impl_witness: = impl_witness () [concrete] -// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] -// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] -// CHECK:STDOUT: %G.type: type = fn_type @G [concrete] -// CHECK:STDOUT: %G: %G.type = struct_value () [concrete] -// CHECK:STDOUT: %Eats.facet: %Eats.type = facet_value %Animal.type, (%impl_witness) [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Eats = %Eats.decl -// CHECK:STDOUT: .Animal = %Animal.decl -// CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: .G = %G.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Eats.decl: type = interface_decl @Eats [concrete = constants.%Eats.type] {} {} -// CHECK:STDOUT: %Animal.decl: type = interface_decl @Animal [concrete = constants.%Animal.type] {} {} -// CHECK:STDOUT: impl_decl @impl [concrete] {} { -// 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: } -// CHECK:STDOUT: %impl_witness: = impl_witness () [concrete = constants.%impl_witness] -// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { -// CHECK:STDOUT: %e.patt: %Eats.type = binding_pattern e -// CHECK:STDOUT: %e.param_patt: %Eats.type = value_param_pattern %e.patt, call_param0 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %e.param: %Eats.type = value_param call_param0 -// CHECK:STDOUT: %Eats.ref: type = name_ref Eats, file.%Eats.decl [concrete = constants.%Eats.type] -// CHECK:STDOUT: %e: %Eats.type = bind_name e, %e.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {} {} -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: interface @Eats { -// CHECK:STDOUT: %Self: %Eats.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1b5] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: witness = () -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: interface @Animal { -// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.fd4] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: witness = () -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %Animal.ref as %Eats.ref { -// CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = file.%impl_witness -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @F(%e.param_patt: %Eats.type) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @G() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: %Eats.facet: %Eats.type = facet_value constants.%Animal.type, (constants.%impl_witness) [concrete = constants.%Eats.facet] -// CHECK:STDOUT: %.loc19: %Eats.type = converted %Animal.ref, %Eats.facet [concrete = constants.%Eats.facet] -// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref(%.loc19) -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtin_conversions/no_prelude/fail_convert_facet_value_to_missing_impl.carbon b/toolchain/check/testdata/builtin_conversions/no_prelude/fail_convert_facet_value_to_missing_impl.carbon deleted file mode 100644 index 89457638aa81..000000000000 --- a/toolchain/check/testdata/builtin_conversions/no_prelude/fail_convert_facet_value_to_missing_impl.carbon +++ /dev/null @@ -1,345 +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/builtin_conversions/no_prelude/fail_convert_facet_value_to_missing_impl.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtin_conversions/no_prelude/fail_convert_facet_value_to_missing_impl.carbon - -// --- core.carbon - -package Core; - -interface ImplicitAs(Dest:! type) { - fn Convert[self: Self]() -> Dest; -} - -// --- fail_convert_facet_value_to_missing_impl.carbon - -library "[[@TEST_NAME]]"; - -import Core; - -interface Eats {} -interface Animal {} - -fn Feed[T:! Eats](e: T) {} - -// CHECK:STDERR: fail_convert_facet_value_to_missing_impl.carbon:[[@LINE+10]]:37: error: cannot implicitly convert type `T` that implements `Animal` into type implementing `Eats` [ConversionFailureFacetToFacet] -// CHECK:STDERR: fn HandleAnimal[T:! Animal](a: T) { Feed(a); } -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_convert_facet_value_to_missing_impl.carbon:[[@LINE+7]]:37: note: type `type` does not implement interface `Core.ImplicitAs(Eats)` [MissingImplInMemberAccessNote] -// CHECK:STDERR: fn HandleAnimal[T:! Animal](a: T) { Feed(a); } -// CHECK:STDERR: ^~~~~~~ -// CHECK:STDERR: fail_convert_facet_value_to_missing_impl.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](a: T) { Feed(a); } - -// CHECK:STDOUT: --- core.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic] -// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic] -// CHECK:STDOUT: %ImplicitAs.type.96f: type = generic_interface_type @ImplicitAs [concrete] -// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.96f = struct_value () [concrete] -// CHECK:STDOUT: %ImplicitAs.type.07f: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic] -// CHECK:STDOUT: %Self: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] -// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic] -// CHECK:STDOUT: %Convert: %Convert.type = struct_value () [symbolic] -// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type %ImplicitAs.type.07f [symbolic] -// CHECK:STDOUT: %assoc0: %ImplicitAs.assoc_type = assoc_entity element0, @ImplicitAs.%Convert.decl [symbolic] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { -// CHECK:STDOUT: %Dest.patt.loc4_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc4_22.2 (constants.%Dest.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.loc4_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc4_22.2 (constants.%Dest)] -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc4_22.1: type) { -// CHECK:STDOUT: %Dest.loc4_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc4_22.2 (constants.%Dest)] -// CHECK:STDOUT: %Dest.patt.loc4_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc4_22.2 (constants.%Dest.patt)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc4_22.2)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.07f)] -// CHECK:STDOUT: %Self.2: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest.loc4_22.2) [symbolic = %Convert.type (constants.%Convert.type)] -// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type) = struct_value () [symbolic = %Convert (constants.%Convert)] -// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type)] -// CHECK:STDOUT: %assoc0.loc5_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc5_35.2 (constants.%assoc0)] -// CHECK:STDOUT: -// CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %Convert.decl: @ImplicitAs.%Convert.type (%Convert.type) = fn_decl @Convert [symbolic = @ImplicitAs.%Convert (constants.%Convert)] { -// CHECK:STDOUT: %self.patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = binding_pattern self -// CHECK:STDOUT: %self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = value_param_pattern %self.patt, call_param0 -// CHECK:STDOUT: %return.patt: @Convert.%Dest (%Dest) = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: @Convert.%Dest (%Dest) = out_param_pattern %return.patt, call_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc4_22.1 [symbolic = %Dest (constants.%Dest)] -// CHECK:STDOUT: %self.param: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc5_20.1: type = splice_block %.loc5_20.3 [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] { -// CHECK:STDOUT: %.loc5_20.2: @Convert.%ImplicitAs.type (%ImplicitAs.type.07f) = specific_constant @ImplicitAs.%Self.1, @ImplicitAs(constants.%Dest) [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.ref: @Convert.%ImplicitAs.type (%ImplicitAs.type.07f) = name_ref Self, %.loc5_20.2 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc5_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc5_20.3: type = converted %Self.ref, %Self.as_type.loc5_20.2 [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = bind_name self, %self.param -// CHECK:STDOUT: %return.param: ref @Convert.%Dest (%Dest) = out_param call_param1 -// CHECK:STDOUT: %return: ref @Convert.%Dest (%Dest) = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %assoc0.loc5_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc5_35.2 (constants.%assoc0)] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .Dest = -// CHECK:STDOUT: .Convert = %assoc0.loc5_35.1 -// CHECK:STDOUT: witness = (%Convert.decl) -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert(@ImplicitAs.%Dest.loc4_22.1: type, @ImplicitAs.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f)) { -// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.07f)] -// CHECK:STDOUT: %Self: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc5_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type)]() -> @Convert.%Dest (%Dest); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { -// CHECK:STDOUT: %Dest.loc4_22.2 => constants.%Dest -// CHECK:STDOUT: %Dest.patt.loc4_22.2 => constants.%Dest -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self) { -// CHECK:STDOUT: %Dest => constants.%Dest -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.07f -// CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.as_type.loc5_20.1 => constants.%Self.as_type -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(%Dest.loc4_22.2) {} -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_convert_facet_value_to_missing_impl.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Eats.type: type = facet_type <@Eats> [concrete] -// 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.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.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.c75: = require_complete_type %T.as_type.27d [symbolic] -// CHECK:STDOUT: %T.fd4: %Animal.type = bind_symbolic_name T, 0 [symbolic] -// CHECK:STDOUT: %T.patt.a9c: %Animal.type = symbolic_binding_pattern T, 0 [symbolic] -// CHECK:STDOUT: %T.as_type.2ad: type = facet_access_type %T.fd4 [symbolic] -// CHECK:STDOUT: %HandleAnimal.type: type = fn_type @HandleAnimal [concrete] -// CHECK:STDOUT: %HandleAnimal: %HandleAnimal.type = struct_value () [concrete] -// CHECK:STDOUT: %require_complete.234: = require_complete_type %T.as_type.2ad [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.02f: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.1c7 [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.ceb: %ImplicitAs.assoc_type.9a7 = assoc_entity element0, imports.%Core.import_ref.1c7 [concrete] -// CHECK:STDOUT: %assoc0.43d: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207 [symbolic] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs -// CHECK:STDOUT: import Core//default -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import_ref.5ab3ec.1: type = import_ref Core//default, loc4_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] -// 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_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.43d)] -// CHECK:STDOUT: %Core.Convert = import_ref Core//default, Convert, unloaded -// CHECK:STDOUT: %Core.import_ref.5ab3ec.2: type = import_ref Core//default, loc4_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] -// CHECK:STDOUT: %Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) = import_ref Core//default, inst24 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] -// CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, loc5_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Eats = %Eats.decl -// CHECK:STDOUT: .Animal = %Animal.decl -// CHECK:STDOUT: .Feed = %Feed.decl -// CHECK:STDOUT: .HandleAnimal = %HandleAnimal.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Eats.decl: type = interface_decl @Eats [concrete = constants.%Eats.type] {} {} -// 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.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.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.27d) = bind_name e, %e.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %HandleAnimal.decl: %HandleAnimal.type = fn_decl @HandleAnimal [concrete = constants.%HandleAnimal] { -// CHECK:STDOUT: %T.patt.loc21_17.1: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc21_17.2 (constants.%T.patt.a9c)] -// CHECK:STDOUT: %a.patt: @HandleAnimal.%T.as_type.loc21_32.2 (%T.as_type.2ad) = binding_pattern a -// CHECK:STDOUT: %a.param_patt: @HandleAnimal.%T.as_type.loc21_32.2 (%T.as_type.2ad) = value_param_pattern %a.patt, call_param0 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: %T.loc21_17.1: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc21_17.2 (constants.%T.fd4)] -// CHECK:STDOUT: %a.param: @HandleAnimal.%T.as_type.loc21_32.2 (%T.as_type.2ad) = value_param call_param0 -// CHECK:STDOUT: %.loc21_32.1: type = splice_block %.loc21_32.2 [symbolic = %T.as_type.loc21_32.2 (constants.%T.as_type.2ad)] { -// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc21_17.1 [symbolic = %T.loc21_17.2 (constants.%T.fd4)] -// CHECK:STDOUT: %T.as_type.loc21_32.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc21_32.2 (constants.%T.as_type.2ad)] -// CHECK:STDOUT: %.loc21_32.2: type = converted %T.ref, %T.as_type.loc21_32.1 [symbolic = %T.as_type.loc21_32.2 (constants.%T.as_type.2ad)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: @HandleAnimal.%T.as_type.loc21_32.2 (%T.as_type.2ad) = bind_name a, %a.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: interface @Eats { -// CHECK:STDOUT: %Self: %Eats.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1b5] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: witness = () -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: interface @Animal { -// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.fd4] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: witness = () -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.5ab3ec.1: type) [from "core.carbon"] { -// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] -// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.d62)] -// CHECK:STDOUT: %Self: %ImplicitAs.type.d62 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.519)] -// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.275)] -// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = struct_value () [symbolic = %Convert (constants.%Convert.42e)] -// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type.837)] -// CHECK:STDOUT: %assoc0: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = assoc_entity element0, imports.%Core.import_ref.1c7 [symbolic = %assoc0 (constants.%assoc0.02f)] -// CHECK:STDOUT: -// CHECK:STDOUT: interface { -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%Core.import_ref.ff5 -// CHECK:STDOUT: .Convert = imports.%Core.import_ref.630 -// CHECK:STDOUT: witness = (imports.%Core.Convert) -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @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.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.27d)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// 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.27d)) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @HandleAnimal(%T.loc21_17.1: %Animal.type) { -// CHECK:STDOUT: %T.loc21_17.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc21_17.2 (constants.%T.fd4)] -// CHECK:STDOUT: %T.patt.loc21_17.2: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc21_17.2 (constants.%T.patt.a9c)] -// CHECK:STDOUT: %T.as_type.loc21_32.2: type = facet_access_type %T.loc21_17.2 [symbolic = %T.as_type.loc21_32.2 (constants.%T.as_type.2ad)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type @HandleAnimal.%T.as_type.loc21_32.2 (%T.as_type.2ad) [symbolic = %require_complete (constants.%require_complete.234)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%T.patt.loc21_17.1: %Animal.type](%a.param_patt: @HandleAnimal.%T.as_type.loc21_32.2 (%T.as_type.2ad)) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Feed.ref: %Feed.type = name_ref Feed, file.%Feed.decl [concrete = constants.%Feed] -// CHECK:STDOUT: %a.ref: @HandleAnimal.%T.as_type.loc21_32.2 (%T.as_type.2ad) = name_ref a, %a -// CHECK:STDOUT: %.loc21_43: %Eats.type = converted constants.%T.as_type.2ad, [concrete = ] -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.5ab3ec.2: type, imports.%Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62)) [from "core.carbon"] { -// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.d62)] -// CHECK:STDOUT: %Self: %ImplicitAs.type.d62 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.519)] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type (%Self.as_type)]() -> @Convert.%Dest (%Dest); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: 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 @HandleAnimal(constants.%T.fd4) { -// CHECK:STDOUT: %T.loc21_17.2 => constants.%T.fd4 -// CHECK:STDOUT: %T.patt.loc21_17.2 => constants.%T.fd4 -// CHECK:STDOUT: %T.as_type.loc21_32.2 => constants.%T.as_type.2ad -// 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.%Eats.type) { -// CHECK:STDOUT: %Dest => constants.%Eats.type -// CHECK:STDOUT: %Dest.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.ceb -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtin_conversions/value_with_type_through_access.carbon b/toolchain/check/testdata/deduce/value_with_type_through_access.carbon similarity index 99% rename from toolchain/check/testdata/builtin_conversions/value_with_type_through_access.carbon rename to toolchain/check/testdata/deduce/value_with_type_through_access.carbon index bf20e40c6d15..8c70b0a8e1ac 100644 --- a/toolchain/check/testdata/builtin_conversions/value_with_type_through_access.carbon +++ b/toolchain/check/testdata/deduce/value_with_type_through_access.carbon @@ -4,9 +4,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtin_conversions/value_with_type_through_access.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/deduce/value_with_type_through_access.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtin_conversions/value_with_type_through_access.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/deduce/value_with_type_through_access.carbon // --- tuple_access.carbon diff --git a/toolchain/check/testdata/facet/min_prelude/convert_class_type_to_facet_type.carbon b/toolchain/check/testdata/facet/min_prelude/convert_class_type_to_facet_type.carbon new file mode 100644 index 000000000000..4cfda16af197 --- /dev/null +++ b/toolchain/check/testdata/facet/min_prelude/convert_class_type_to_facet_type.carbon @@ -0,0 +1,307 @@ +// 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 +// +// INCLUDE-FILE: toolchain/testing/min_prelude/convert.carbon +// EXTRA-ARGS: --custom-core +// +// AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/facet/min_prelude/convert_class_type_to_facet_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/facet/min_prelude/convert_class_type_to_facet_type.carbon + +interface Animal {} + +class Goat {} +impl Goat as Animal {} + +fn WalkAnimal(A:! Animal) {} + +fn F() { + WalkAnimal(Goat); +} + +// CHECK:STDOUT: --- convert_class_type_to_facet_type.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Animal.type: type = facet_type <@Animal> [concrete] +// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Goat: type = class_type @Goat [concrete] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %impl_witness: = impl_witness () [concrete] +// CHECK:STDOUT: %A: %Animal.type = bind_symbolic_name A, 0 [symbolic] +// CHECK:STDOUT: %A.patt: %Animal.type = symbolic_binding_pattern A, 0 [symbolic] +// CHECK:STDOUT: %WalkAnimal.type: type = fn_type @WalkAnimal [concrete] +// CHECK:STDOUT: %WalkAnimal: %WalkAnimal.type = struct_value () [concrete] +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value %Goat, (%impl_witness) [concrete] +// CHECK:STDOUT: %WalkAnimal.specific_fn: = specific_function %WalkAnimal, @WalkAnimal(%Animal.facet) [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// 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: .Animal = %Animal.decl +// CHECK:STDOUT: .Goat = %Goat.decl +// CHECK:STDOUT: .WalkAnimal = %WalkAnimal.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Animal.decl: type = interface_decl @Animal [concrete = constants.%Animal.type] {} {} +// CHECK:STDOUT: %Goat.decl: type = class_decl @Goat [concrete = constants.%Goat] {} {} +// CHECK:STDOUT: impl_decl @impl [concrete] {} { +// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] +// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness: = impl_witness () [concrete = constants.%impl_witness] +// CHECK:STDOUT: %WalkAnimal.decl: %WalkAnimal.type = fn_decl @WalkAnimal [concrete = constants.%WalkAnimal] { +// CHECK:STDOUT: %A.patt.loc19_15.1: %Animal.type = symbolic_binding_pattern A, 0 [symbolic = %A.patt.loc19_15.2 (constants.%A.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: %A.loc19_15.1: %Animal.type = bind_symbolic_name A, 0 [symbolic = %A.loc19_15.2 (constants.%A)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @Animal { +// CHECK:STDOUT: %Self: %Animal.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: impl @impl: %Goat.ref as %Animal.ref { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = file.%impl_witness +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: class @Goat { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type] +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Goat +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @WalkAnimal(%A.loc19_15.1: %Animal.type) { +// CHECK:STDOUT: %A.loc19_15.2: %Animal.type = bind_symbolic_name A, 0 [symbolic = %A.loc19_15.2 (constants.%A)] +// CHECK:STDOUT: %A.patt.loc19_15.2: %Animal.type = symbolic_binding_pattern A, 0 [symbolic = %A.patt.loc19_15.2 (constants.%A.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%A.patt.loc19_15.1: %Animal.type) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %WalkAnimal.ref: %WalkAnimal.type = name_ref WalkAnimal, file.%WalkAnimal.decl [concrete = constants.%WalkAnimal] +// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] +// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness) [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %.loc22: %Animal.type = converted %Goat.ref, %Animal.facet [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %WalkAnimal.specific_fn: = specific_function %WalkAnimal.ref, @WalkAnimal(constants.%Animal.facet) [concrete = constants.%WalkAnimal.specific_fn] +// CHECK:STDOUT: %WalkAnimal.call: init %empty_tuple.type = call %WalkAnimal.specific_fn() +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @WalkAnimal(constants.%A) { +// CHECK:STDOUT: %A.loc19_15.2 => constants.%A +// CHECK:STDOUT: %A.patt.loc19_15.2 => constants.%A +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @WalkAnimal(constants.%Animal.facet) { +// CHECK:STDOUT: %A.loc19_15.2 => constants.%Animal.facet +// CHECK:STDOUT: %A.patt.loc19_15.2 => constants.%Animal.facet +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- toolchain/testing/min_prelude/convert.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: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .As = %As.decl +// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %As.decl: %As.type.b51 = interface_decl @As [concrete = constants.%As.generic] { +// CHECK:STDOUT: %Dest.patt.loc8_14.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc8_14.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { +// CHECK:STDOUT: %Dest.patt.loc12_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc12_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(%Dest.loc8_14.1: type) { +// CHECK:STDOUT: %Dest.loc8_14.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc8_14.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest.loc8_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.loc8_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.loc9_35.2: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_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.loc9_20.1 (%Self.as_type.7f0) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @As.%Dest.loc8_14.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param call_param0 +// CHECK:STDOUT: %.loc9_20.1: type = splice_block %.loc9_20.3 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] { +// CHECK:STDOUT: %.loc9_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, %.loc9_20.2 [symbolic = %Self (constants.%Self.b4e)] +// CHECK:STDOUT: %Self.as_type.loc9_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: %.loc9_20.3: type = converted %Self.ref, %Self.as_type.loc9_20.2 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.1.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.1.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc9_35.1: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_35.2 (constants.%assoc0.ac5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc9_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc12_22.1: type) { +// CHECK:STDOUT: %Dest.loc12_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc12_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc12_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.loc12_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.loc14_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_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.loc14_20.1 (%Self.as_type.419) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc12_22.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param call_param0 +// CHECK:STDOUT: %.loc14_20.1: type = splice_block %.loc14_20.3 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] { +// CHECK:STDOUT: %.loc14_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, %.loc14_20.2 [symbolic = %Self (constants.%Self.0f3)] +// CHECK:STDOUT: %Self.as_type.loc14_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: %.loc14_20.3: type = converted %Self.ref, %Self.as_type.loc14_20.2 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.2.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.2.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc14_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_35.2 (constants.%assoc0.a50)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc14_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(@As.%Dest.loc8_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.loc9_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(@ImplicitAs.%Dest.loc12_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.loc14_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419)]() -> @Convert.2.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc8_14.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc8_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.loc9_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.loc8_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc12_22.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc12_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.loc14_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.loc12_22.2) {} +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_class_type_to_generic_facet_value.carbon b/toolchain/check/testdata/facet/min_prelude/convert_class_type_to_generic_facet_value.carbon similarity index 53% rename from toolchain/check/testdata/builtin_conversions/no_prelude/convert_class_type_to_generic_facet_value.carbon rename to toolchain/check/testdata/facet/min_prelude/convert_class_type_to_generic_facet_value.carbon index c25cb013c188..595fcdc80fa8 100644 --- a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_class_type_to_generic_facet_value.carbon +++ b/toolchain/check/testdata/facet/min_prelude/convert_class_type_to_generic_facet_value.carbon @@ -2,26 +2,19 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// INCLUDE-FILE: toolchain/testing/min_prelude/convert.carbon +// EXTRA-ARGS: --custom-core +// // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtin_conversions/no_prelude/convert_class_type_to_generic_facet_value.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/facet/min_prelude/convert_class_type_to_generic_facet_value.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtin_conversions/no_prelude/convert_class_type_to_generic_facet_value.carbon - -// --- core.carbon - -package Core; - -interface ImplicitAs(T:! type) { - fn Convert[self: Self]() -> T; -} +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/facet/min_prelude/convert_class_type_to_generic_facet_value.carbon // --- generic_facet_type.carbon library "[[@TEST_NAME]]"; -import Core; - interface Generic(Scalar:! type) { fn F(); } @@ -51,8 +44,6 @@ fn H() { library "[[@TEST_NAME]]"; -import Core; - interface Generic(Scalar:! type) { fn F(); } @@ -70,100 +61,6 @@ fn G() { CallGenericMethod(ImplsGeneric, {} as GenericParam); } -// CHECK:STDOUT: --- core.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] -// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 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(%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: %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: } -// 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: %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: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(%T.loc4_22.1: type) { -// CHECK:STDOUT: %T.loc4_22.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_22.2 (constants.%T)] -// CHECK:STDOUT: %T.patt.loc4_22.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_22.2 (constants.%T.patt)] -// 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: %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: -// CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %Convert.decl: @ImplicitAs.%Convert.type (%Convert.type) = fn_decl @Convert [symbolic = @ImplicitAs.%Convert (constants.%Convert)] { -// CHECK:STDOUT: %self.patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = binding_pattern self -// CHECK:STDOUT: %self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = value_param_pattern %self.patt, call_param0 -// CHECK:STDOUT: %return.patt: @Convert.%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: } -// CHECK:STDOUT: %self: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = 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: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .T = -// CHECK:STDOUT: .Convert = %assoc0.loc5_32.1 -// CHECK:STDOUT: witness = (%Convert.decl) -// 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: -// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type)]() -> @Convert.%T (%T); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(constants.%T) { -// CHECK:STDOUT: %T.loc4_22.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc4_22.2 => constants.%T -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Convert(constants.%T, constants.%Self) { -// 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: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(@Convert.%T) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(%T.loc4_22.2) {} -// CHECK:STDOUT: // CHECK:STDOUT: --- generic_facet_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -211,7 +108,7 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: import Core//default +// CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -228,9 +125,9 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Generic.decl: %Generic.type.c21 = interface_decl @Generic [concrete = constants.%Generic.generic] { -// CHECK:STDOUT: %Scalar.patt.loc6_19.1: type = symbolic_binding_pattern Scalar, 0 [symbolic = %Scalar.patt.loc6_19.2 (constants.%Scalar.patt)] +// CHECK:STDOUT: %Scalar.patt.loc4_19.1: type = symbolic_binding_pattern Scalar, 0 [symbolic = %Scalar.patt.loc4_19.2 (constants.%Scalar.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %Scalar.loc6_19.1: type = bind_symbolic_name Scalar, 0 [symbolic = %Scalar.loc6_19.2 (constants.%Scalar)] +// CHECK:STDOUT: %Scalar.loc4_19.1: type = bind_symbolic_name Scalar, 0 [symbolic = %Scalar.loc4_19.2 (constants.%Scalar)] // CHECK:STDOUT: } // CHECK:STDOUT: %GenericParam.decl: type = class_decl @GenericParam [concrete = constants.%GenericParam] {} {} // CHECK:STDOUT: %ImplsGeneric.decl: type = class_decl @ImplsGeneric [concrete = constants.%ImplsGeneric] {} {} @@ -242,53 +139,53 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%F.decl) [concrete = constants.%impl_witness] // CHECK:STDOUT: %CallGenericMethod.decl: %CallGenericMethod.type = fn_decl @CallGenericMethod [concrete = constants.%CallGenericMethod] { -// CHECK:STDOUT: %T.patt.loc17_22.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc17_22.2 (constants.%T.patt)] -// CHECK:STDOUT: %U.patt.loc17_32.1: @CallGenericMethod.%Generic.type.loc17_45.2 (%Generic.type.91ccba.2) = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc17_32.2 (constants.%U.patt)] +// CHECK:STDOUT: %T.patt.loc15_22.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_22.2 (constants.%T.patt)] +// CHECK:STDOUT: %U.patt.loc15_32.1: @CallGenericMethod.%Generic.type.loc15_45.2 (%Generic.type.91ccba.2) = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc15_32.2 (constants.%U.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %T.loc17_22.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc17_22.2 (constants.%T)] -// CHECK:STDOUT: %.loc17: type = splice_block %Generic.type.loc17_45.1 [symbolic = %Generic.type.loc17_45.2 (constants.%Generic.type.91ccba.2)] { +// CHECK:STDOUT: %T.loc15_22.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc15_22.2 (constants.%T)] +// CHECK:STDOUT: %.loc15: type = splice_block %Generic.type.loc15_45.1 [symbolic = %Generic.type.loc15_45.2 (constants.%Generic.type.91ccba.2)] { // CHECK:STDOUT: %Generic.ref: %Generic.type.c21 = name_ref Generic, file.%Generic.decl [concrete = constants.%Generic.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc17_22.1 [symbolic = %T.loc17_22.2 (constants.%T)] -// CHECK:STDOUT: %Generic.type.loc17_45.1: type = facet_type <@Generic, @Generic(constants.%T)> [symbolic = %Generic.type.loc17_45.2 (constants.%Generic.type.91ccba.2)] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc15_22.1 [symbolic = %T.loc15_22.2 (constants.%T)] +// CHECK:STDOUT: %Generic.type.loc15_45.1: type = facet_type <@Generic, @Generic(constants.%T)> [symbolic = %Generic.type.loc15_45.2 (constants.%Generic.type.91ccba.2)] // CHECK:STDOUT: } -// CHECK:STDOUT: %U.loc17_32.1: @CallGenericMethod.%Generic.type.loc17_45.2 (%Generic.type.91ccba.2) = bind_symbolic_name U, 1 [symbolic = %U.loc17_32.2 (constants.%U)] +// CHECK:STDOUT: %U.loc15_32.1: @CallGenericMethod.%Generic.type.loc15_45.2 (%Generic.type.91ccba.2) = bind_symbolic_name U, 1 [symbolic = %U.loc15_32.2 (constants.%U)] // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {} {} // CHECK:STDOUT: %PassThroughToGenericMethod.decl: %PassThroughToGenericMethod.type = fn_decl @PassThroughToGenericMethod [concrete = constants.%PassThroughToGenericMethod] { -// CHECK:STDOUT: %T.patt.loc23_31.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc23_31.2 (constants.%T.patt)] -// CHECK:STDOUT: %U.patt.loc23_41.1: @PassThroughToGenericMethod.%Generic.type.loc23_54.2 (%Generic.type.91ccba.2) = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc23_41.2 (constants.%U.patt)] +// CHECK:STDOUT: %T.patt.loc21_31.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc21_31.2 (constants.%T.patt)] +// CHECK:STDOUT: %U.patt.loc21_41.1: @PassThroughToGenericMethod.%Generic.type.loc21_54.2 (%Generic.type.91ccba.2) = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc21_41.2 (constants.%U.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %T.loc23_31.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc23_31.2 (constants.%T)] -// CHECK:STDOUT: %.loc23: type = splice_block %Generic.type.loc23_54.1 [symbolic = %Generic.type.loc23_54.2 (constants.%Generic.type.91ccba.2)] { +// CHECK:STDOUT: %T.loc21_31.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc21_31.2 (constants.%T)] +// CHECK:STDOUT: %.loc21: type = splice_block %Generic.type.loc21_54.1 [symbolic = %Generic.type.loc21_54.2 (constants.%Generic.type.91ccba.2)] { // CHECK:STDOUT: %Generic.ref: %Generic.type.c21 = name_ref Generic, file.%Generic.decl [concrete = constants.%Generic.generic] -// CHECK:STDOUT: %T.ref.loc23: type = name_ref T, %T.loc23_31.1 [symbolic = %T.loc23_31.2 (constants.%T)] -// CHECK:STDOUT: %Generic.type.loc23_54.1: type = facet_type <@Generic, @Generic(constants.%T)> [symbolic = %Generic.type.loc23_54.2 (constants.%Generic.type.91ccba.2)] +// CHECK:STDOUT: %T.ref.loc21: type = name_ref T, %T.loc21_31.1 [symbolic = %T.loc21_31.2 (constants.%T)] +// CHECK:STDOUT: %Generic.type.loc21_54.1: type = facet_type <@Generic, @Generic(constants.%T)> [symbolic = %Generic.type.loc21_54.2 (constants.%Generic.type.91ccba.2)] // CHECK:STDOUT: } -// CHECK:STDOUT: %U.loc23_41.1: @PassThroughToGenericMethod.%Generic.type.loc23_54.2 (%Generic.type.91ccba.2) = bind_symbolic_name U, 1 [symbolic = %U.loc23_41.2 (constants.%U)] +// CHECK:STDOUT: %U.loc21_41.1: @PassThroughToGenericMethod.%Generic.type.loc21_54.2 (%Generic.type.91ccba.2) = bind_symbolic_name U, 1 [symbolic = %U.loc21_41.2 (constants.%U)] // CHECK:STDOUT: } // CHECK:STDOUT: %H.decl: %H.type = fn_decl @H [concrete = constants.%H] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Generic(%Scalar.loc6_19.1: type) { -// CHECK:STDOUT: %Scalar.loc6_19.2: type = bind_symbolic_name Scalar, 0 [symbolic = %Scalar.loc6_19.2 (constants.%Scalar)] -// CHECK:STDOUT: %Scalar.patt.loc6_19.2: type = symbolic_binding_pattern Scalar, 0 [symbolic = %Scalar.patt.loc6_19.2 (constants.%Scalar.patt)] +// CHECK:STDOUT: generic interface @Generic(%Scalar.loc4_19.1: type) { +// CHECK:STDOUT: %Scalar.loc4_19.2: type = bind_symbolic_name Scalar, 0 [symbolic = %Scalar.loc4_19.2 (constants.%Scalar)] +// CHECK:STDOUT: %Scalar.patt.loc4_19.2: type = symbolic_binding_pattern Scalar, 0 [symbolic = %Scalar.patt.loc4_19.2 (constants.%Scalar.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Generic.type: type = facet_type <@Generic, @Generic(%Scalar.loc6_19.2)> [symbolic = %Generic.type (constants.%Generic.type.91ccba.1)] +// CHECK:STDOUT: %Generic.type: type = facet_type <@Generic, @Generic(%Scalar.loc4_19.2)> [symbolic = %Generic.type (constants.%Generic.type.91ccba.1)] // CHECK:STDOUT: %Self.2: %Generic.type.91ccba.1 = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %F.type: type = fn_type @F.1, @Generic(%Scalar.loc6_19.2) [symbolic = %F.type (constants.%F.type.f43)] +// CHECK:STDOUT: %F.type: type = fn_type @F.1, @Generic(%Scalar.loc4_19.2) [symbolic = %F.type (constants.%F.type.f43)] // CHECK:STDOUT: %F: @Generic.%F.type (%F.type.f43) = struct_value () [symbolic = %F (constants.%F.8a2)] // CHECK:STDOUT: %Generic.assoc_type: type = assoc_entity_type @Generic.%Generic.type (%Generic.type.91ccba.1) [symbolic = %Generic.assoc_type (constants.%Generic.assoc_type.de9)] -// CHECK:STDOUT: %assoc0.loc7_9.2: @Generic.%Generic.assoc_type (%Generic.assoc_type.de9) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc7_9.2 (constants.%assoc0.29c)] +// CHECK:STDOUT: %assoc0.loc5_9.2: @Generic.%Generic.assoc_type (%Generic.assoc_type.de9) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc5_9.2 (constants.%assoc0.29c)] // CHECK:STDOUT: // CHECK:STDOUT: interface { // CHECK:STDOUT: %Self.1: @Generic.%Generic.type (%Generic.type.91ccba.1) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] // CHECK:STDOUT: %F.decl: @Generic.%F.type (%F.type.f43) = fn_decl @F.1 [symbolic = @Generic.%F (constants.%F.8a2)] {} {} -// CHECK:STDOUT: %assoc0.loc7_9.1: @Generic.%Generic.assoc_type (%Generic.assoc_type.de9) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc7_9.2 (constants.%assoc0.29c)] +// CHECK:STDOUT: %assoc0.loc5_9.1: @Generic.%Generic.assoc_type (%Generic.assoc_type.de9) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc5_9.2 (constants.%assoc0.29c)] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .F = %assoc0.loc7_9.1 +// CHECK:STDOUT: .F = %assoc0.loc5_9.1 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -317,7 +214,7 @@ fn G() { // CHECK:STDOUT: .Self = constants.%ImplsGeneric // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F.1(@Generic.%Scalar.loc6_19.1: type, @Generic.%Self.1: @Generic.%Generic.type (%Generic.type.91ccba.1)) { +// CHECK:STDOUT: generic fn @F.1(@Generic.%Scalar.loc4_19.1: type, @Generic.%Self.1: @Generic.%Generic.type (%Generic.type.91ccba.1)) { // CHECK:STDOUT: fn(); // CHECK:STDOUT: } // CHECK:STDOUT: @@ -326,16 +223,16 @@ fn G() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @CallGenericMethod(%T.loc17_22.1: type, %U.loc17_32.1: @CallGenericMethod.%Generic.type.loc17_45.2 (%Generic.type.91ccba.2)) { -// CHECK:STDOUT: %T.loc17_22.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc17_22.2 (constants.%T)] -// CHECK:STDOUT: %T.patt.loc17_22.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc17_22.2 (constants.%T.patt)] -// CHECK:STDOUT: %Generic.type.loc17_45.2: type = facet_type <@Generic, @Generic(%T.loc17_22.2)> [symbolic = %Generic.type.loc17_45.2 (constants.%Generic.type.91ccba.2)] -// CHECK:STDOUT: %U.loc17_32.2: %Generic.type.91ccba.2 = bind_symbolic_name U, 1 [symbolic = %U.loc17_32.2 (constants.%U)] -// CHECK:STDOUT: %U.patt.loc17_32.2: %Generic.type.91ccba.2 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc17_32.2 (constants.%U.patt)] +// CHECK:STDOUT: generic fn @CallGenericMethod(%T.loc15_22.1: type, %U.loc15_32.1: @CallGenericMethod.%Generic.type.loc15_45.2 (%Generic.type.91ccba.2)) { +// CHECK:STDOUT: %T.loc15_22.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc15_22.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc15_22.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_22.2 (constants.%T.patt)] +// CHECK:STDOUT: %Generic.type.loc15_45.2: type = facet_type <@Generic, @Generic(%T.loc15_22.2)> [symbolic = %Generic.type.loc15_45.2 (constants.%Generic.type.91ccba.2)] +// CHECK:STDOUT: %U.loc15_32.2: %Generic.type.91ccba.2 = bind_symbolic_name U, 1 [symbolic = %U.loc15_32.2 (constants.%U)] +// CHECK:STDOUT: %U.patt.loc15_32.2: %Generic.type.91ccba.2 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc15_32.2 (constants.%U.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: fn(%T.patt.loc17_22.1: type, %U.patt.loc17_32.1: @CallGenericMethod.%Generic.type.loc17_45.2 (%Generic.type.91ccba.2)) { +// CHECK:STDOUT: fn(%T.patt.loc15_22.1: type, %U.patt.loc15_32.1: @CallGenericMethod.%Generic.type.loc15_45.2 (%Generic.type.91ccba.2)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -347,29 +244,29 @@ fn G() { // CHECK:STDOUT: %GenericParam.ref: type = name_ref GenericParam, file.%GenericParam.decl [concrete = constants.%GenericParam] // CHECK:STDOUT: %ImplsGeneric.ref: type = name_ref ImplsGeneric, file.%ImplsGeneric.decl [concrete = constants.%ImplsGeneric] // CHECK:STDOUT: %Generic.facet: %Generic.type.769 = facet_value constants.%ImplsGeneric, (constants.%impl_witness) [concrete = constants.%Generic.facet] -// CHECK:STDOUT: %.loc20: %Generic.type.769 = converted constants.%ImplsGeneric, %Generic.facet [concrete = constants.%Generic.facet] +// CHECK:STDOUT: %.loc18: %Generic.type.769 = converted constants.%ImplsGeneric, %Generic.facet [concrete = constants.%Generic.facet] // CHECK:STDOUT: %CallGenericMethod.specific_fn: = specific_function %CallGenericMethod.ref, @CallGenericMethod(constants.%GenericParam, constants.%Generic.facet) [concrete = constants.%CallGenericMethod.specific_fn.934] // CHECK:STDOUT: %CallGenericMethod.call: init %empty_tuple.type = call %CallGenericMethod.specific_fn() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @PassThroughToGenericMethod(%T.loc23_31.1: type, %U.loc23_41.1: @PassThroughToGenericMethod.%Generic.type.loc23_54.2 (%Generic.type.91ccba.2)) { -// CHECK:STDOUT: %T.loc23_31.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc23_31.2 (constants.%T)] -// CHECK:STDOUT: %T.patt.loc23_31.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc23_31.2 (constants.%T.patt)] -// CHECK:STDOUT: %Generic.type.loc23_54.2: type = facet_type <@Generic, @Generic(%T.loc23_31.2)> [symbolic = %Generic.type.loc23_54.2 (constants.%Generic.type.91ccba.2)] -// CHECK:STDOUT: %U.loc23_41.2: %Generic.type.91ccba.2 = bind_symbolic_name U, 1 [symbolic = %U.loc23_41.2 (constants.%U)] -// CHECK:STDOUT: %U.patt.loc23_41.2: %Generic.type.91ccba.2 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc23_41.2 (constants.%U.patt)] +// CHECK:STDOUT: generic fn @PassThroughToGenericMethod(%T.loc21_31.1: type, %U.loc21_41.1: @PassThroughToGenericMethod.%Generic.type.loc21_54.2 (%Generic.type.91ccba.2)) { +// CHECK:STDOUT: %T.loc21_31.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc21_31.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc21_31.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc21_31.2 (constants.%T.patt)] +// CHECK:STDOUT: %Generic.type.loc21_54.2: type = facet_type <@Generic, @Generic(%T.loc21_31.2)> [symbolic = %Generic.type.loc21_54.2 (constants.%Generic.type.91ccba.2)] +// CHECK:STDOUT: %U.loc21_41.2: %Generic.type.91ccba.2 = bind_symbolic_name U, 1 [symbolic = %U.loc21_41.2 (constants.%U)] +// CHECK:STDOUT: %U.patt.loc21_41.2: %Generic.type.91ccba.2 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc21_41.2 (constants.%U.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %CallGenericMethod.specific_fn.loc24_3.2: = specific_function constants.%CallGenericMethod, @CallGenericMethod(%T.loc23_31.2, %U.loc23_41.2) [symbolic = %CallGenericMethod.specific_fn.loc24_3.2 (constants.%CallGenericMethod.specific_fn.a24)] +// CHECK:STDOUT: %CallGenericMethod.specific_fn.loc22_3.2: = specific_function constants.%CallGenericMethod, @CallGenericMethod(%T.loc21_31.2, %U.loc21_41.2) [symbolic = %CallGenericMethod.specific_fn.loc22_3.2 (constants.%CallGenericMethod.specific_fn.a24)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%T.patt.loc23_31.1: type, %U.patt.loc23_41.1: @PassThroughToGenericMethod.%Generic.type.loc23_54.2 (%Generic.type.91ccba.2)) { +// CHECK:STDOUT: fn(%T.patt.loc21_31.1: type, %U.patt.loc21_41.1: @PassThroughToGenericMethod.%Generic.type.loc21_54.2 (%Generic.type.91ccba.2)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %CallGenericMethod.ref: %CallGenericMethod.type = name_ref CallGenericMethod, file.%CallGenericMethod.decl [concrete = constants.%CallGenericMethod] -// CHECK:STDOUT: %T.ref.loc24: type = name_ref T, %T.loc23_31.1 [symbolic = %T.loc23_31.2 (constants.%T)] -// CHECK:STDOUT: %U.ref: @PassThroughToGenericMethod.%Generic.type.loc23_54.2 (%Generic.type.91ccba.2) = name_ref U, %U.loc23_41.1 [symbolic = %U.loc23_41.2 (constants.%U)] -// CHECK:STDOUT: %CallGenericMethod.specific_fn.loc24_3.1: = specific_function %CallGenericMethod.ref, @CallGenericMethod(constants.%T, constants.%U) [symbolic = %CallGenericMethod.specific_fn.loc24_3.2 (constants.%CallGenericMethod.specific_fn.a24)] -// CHECK:STDOUT: %CallGenericMethod.call: init %empty_tuple.type = call %CallGenericMethod.specific_fn.loc24_3.1() +// CHECK:STDOUT: %T.ref.loc22: type = name_ref T, %T.loc21_31.1 [symbolic = %T.loc21_31.2 (constants.%T)] +// CHECK:STDOUT: %U.ref: @PassThroughToGenericMethod.%Generic.type.loc21_54.2 (%Generic.type.91ccba.2) = name_ref U, %U.loc21_41.1 [symbolic = %U.loc21_41.2 (constants.%U)] +// CHECK:STDOUT: %CallGenericMethod.specific_fn.loc22_3.1: = specific_function %CallGenericMethod.ref, @CallGenericMethod(constants.%T, constants.%U) [symbolic = %CallGenericMethod.specific_fn.loc22_3.2 (constants.%CallGenericMethod.specific_fn.a24)] +// CHECK:STDOUT: %CallGenericMethod.call: init %empty_tuple.type = call %CallGenericMethod.specific_fn.loc22_3.1() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -380,24 +277,24 @@ fn G() { // CHECK:STDOUT: %GenericParam.ref: type = name_ref GenericParam, file.%GenericParam.decl [concrete = constants.%GenericParam] // CHECK:STDOUT: %ImplsGeneric.ref: type = name_ref ImplsGeneric, file.%ImplsGeneric.decl [concrete = constants.%ImplsGeneric] // CHECK:STDOUT: %Generic.facet: %Generic.type.769 = facet_value constants.%ImplsGeneric, (constants.%impl_witness) [concrete = constants.%Generic.facet] -// CHECK:STDOUT: %.loc28: %Generic.type.769 = converted constants.%ImplsGeneric, %Generic.facet [concrete = constants.%Generic.facet] +// CHECK:STDOUT: %.loc26: %Generic.type.769 = converted constants.%ImplsGeneric, %Generic.facet [concrete = constants.%Generic.facet] // CHECK:STDOUT: %PassThroughToGenericMethod.specific_fn: = specific_function %PassThroughToGenericMethod.ref, @PassThroughToGenericMethod(constants.%GenericParam, constants.%Generic.facet) [concrete = constants.%PassThroughToGenericMethod.specific_fn] // CHECK:STDOUT: %PassThroughToGenericMethod.call: init %empty_tuple.type = call %PassThroughToGenericMethod.specific_fn() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Generic(constants.%Scalar) { -// CHECK:STDOUT: %Scalar.loc6_19.2 => constants.%Scalar -// CHECK:STDOUT: %Scalar.patt.loc6_19.2 => constants.%Scalar +// CHECK:STDOUT: %Scalar.loc4_19.2 => constants.%Scalar +// CHECK:STDOUT: %Scalar.patt.loc4_19.2 => constants.%Scalar // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F.1(constants.%Scalar, constants.%Self) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Generic(%Scalar.loc6_19.2) {} +// CHECK:STDOUT: specific @Generic(%Scalar.loc4_19.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Generic(constants.%GenericParam) { -// CHECK:STDOUT: %Scalar.loc6_19.2 => constants.%GenericParam -// CHECK:STDOUT: %Scalar.patt.loc6_19.2 => constants.%GenericParam +// CHECK:STDOUT: %Scalar.loc4_19.2 => constants.%GenericParam +// CHECK:STDOUT: %Scalar.patt.loc4_19.2 => constants.%GenericParam // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Generic.type => constants.%Generic.type.769 @@ -405,59 +302,59 @@ fn G() { // CHECK:STDOUT: %F.type => constants.%F.type.4cf // CHECK:STDOUT: %F => constants.%F.118 // CHECK:STDOUT: %Generic.assoc_type => constants.%Generic.assoc_type.9f1 -// CHECK:STDOUT: %assoc0.loc7_9.2 => constants.%assoc0.9b7 +// CHECK:STDOUT: %assoc0.loc5_9.2 => constants.%assoc0.9b7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F.1(constants.%GenericParam, constants.%Generic.facet) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Generic(constants.%T) { -// CHECK:STDOUT: %Scalar.loc6_19.2 => constants.%T -// CHECK:STDOUT: %Scalar.patt.loc6_19.2 => constants.%T +// CHECK:STDOUT: %Scalar.loc4_19.2 => constants.%T +// CHECK:STDOUT: %Scalar.patt.loc4_19.2 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @CallGenericMethod(constants.%T, constants.%U) { -// CHECK:STDOUT: %T.loc17_22.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc17_22.2 => constants.%T -// CHECK:STDOUT: %Generic.type.loc17_45.2 => constants.%Generic.type.91ccba.2 -// CHECK:STDOUT: %U.loc17_32.2 => constants.%U -// CHECK:STDOUT: %U.patt.loc17_32.2 => constants.%U +// CHECK:STDOUT: %T.loc15_22.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc15_22.2 => constants.%T +// CHECK:STDOUT: %Generic.type.loc15_45.2 => constants.%Generic.type.91ccba.2 +// CHECK:STDOUT: %U.loc15_32.2 => constants.%U +// CHECK:STDOUT: %U.patt.loc15_32.2 => constants.%U // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Generic(@CallGenericMethod.%T.loc17_22.2) {} +// CHECK:STDOUT: specific @Generic(@CallGenericMethod.%T.loc15_22.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @CallGenericMethod(constants.%GenericParam, constants.%Generic.facet) { -// CHECK:STDOUT: %T.loc17_22.2 => constants.%GenericParam -// CHECK:STDOUT: %T.patt.loc17_22.2 => constants.%GenericParam -// CHECK:STDOUT: %Generic.type.loc17_45.2 => constants.%Generic.type.769 -// CHECK:STDOUT: %U.loc17_32.2 => constants.%Generic.facet -// CHECK:STDOUT: %U.patt.loc17_32.2 => constants.%Generic.facet +// CHECK:STDOUT: %T.loc15_22.2 => constants.%GenericParam +// CHECK:STDOUT: %T.patt.loc15_22.2 => constants.%GenericParam +// CHECK:STDOUT: %Generic.type.loc15_45.2 => constants.%Generic.type.769 +// CHECK:STDOUT: %U.loc15_32.2 => constants.%Generic.facet +// CHECK:STDOUT: %U.patt.loc15_32.2 => constants.%Generic.facet // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @PassThroughToGenericMethod(constants.%T, constants.%U) { -// CHECK:STDOUT: %T.loc23_31.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc23_31.2 => constants.%T -// CHECK:STDOUT: %Generic.type.loc23_54.2 => constants.%Generic.type.91ccba.2 -// CHECK:STDOUT: %U.loc23_41.2 => constants.%U -// CHECK:STDOUT: %U.patt.loc23_41.2 => constants.%U +// CHECK:STDOUT: %T.loc21_31.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc21_31.2 => constants.%T +// CHECK:STDOUT: %Generic.type.loc21_54.2 => constants.%Generic.type.91ccba.2 +// CHECK:STDOUT: %U.loc21_41.2 => constants.%U +// CHECK:STDOUT: %U.patt.loc21_41.2 => constants.%U // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Generic(@PassThroughToGenericMethod.%T.loc23_31.2) {} +// CHECK:STDOUT: specific @Generic(@PassThroughToGenericMethod.%T.loc21_31.2) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @CallGenericMethod(@PassThroughToGenericMethod.%T.loc23_31.2, @PassThroughToGenericMethod.%U.loc23_41.2) {} +// CHECK:STDOUT: specific @CallGenericMethod(@PassThroughToGenericMethod.%T.loc21_31.2, @PassThroughToGenericMethod.%U.loc21_41.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @PassThroughToGenericMethod(constants.%GenericParam, constants.%Generic.facet) { -// CHECK:STDOUT: %T.loc23_31.2 => constants.%GenericParam -// CHECK:STDOUT: %T.patt.loc23_31.2 => constants.%GenericParam -// CHECK:STDOUT: %Generic.type.loc23_54.2 => constants.%Generic.type.769 -// CHECK:STDOUT: %U.loc23_41.2 => constants.%Generic.facet -// CHECK:STDOUT: %U.patt.loc23_41.2 => constants.%Generic.facet +// CHECK:STDOUT: %T.loc21_31.2 => constants.%GenericParam +// CHECK:STDOUT: %T.patt.loc21_31.2 => constants.%GenericParam +// CHECK:STDOUT: %Generic.type.loc21_54.2 => constants.%Generic.type.769 +// CHECK:STDOUT: %U.loc21_41.2 => constants.%Generic.facet +// CHECK:STDOUT: %U.patt.loc21_41.2 => constants.%Generic.facet // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %CallGenericMethod.specific_fn.loc24_3.2 => constants.%CallGenericMethod.specific_fn.934 +// CHECK:STDOUT: %CallGenericMethod.specific_fn.loc22_3.2 => constants.%CallGenericMethod.specific_fn.934 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- generic_facet_type_from_implicit_param.carbon @@ -503,7 +400,7 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: import Core//default +// CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -518,9 +415,9 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Generic.decl: %Generic.type.c21 = interface_decl @Generic [concrete = constants.%Generic.generic] { -// CHECK:STDOUT: %Scalar.patt.loc6_19.1: type = symbolic_binding_pattern Scalar, 0 [symbolic = %Scalar.patt.loc6_19.2 (constants.%Scalar.patt)] +// CHECK:STDOUT: %Scalar.patt.loc4_19.1: type = symbolic_binding_pattern Scalar, 0 [symbolic = %Scalar.patt.loc4_19.2 (constants.%Scalar.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %Scalar.loc6_19.1: type = bind_symbolic_name Scalar, 0 [symbolic = %Scalar.loc6_19.2 (constants.%Scalar)] +// CHECK:STDOUT: %Scalar.loc4_19.1: type = bind_symbolic_name Scalar, 0 [symbolic = %Scalar.loc4_19.2 (constants.%Scalar)] // CHECK:STDOUT: } // CHECK:STDOUT: %GenericParam.decl: type = class_decl @GenericParam [concrete = constants.%GenericParam] {} {} // CHECK:STDOUT: %ImplsGeneric.decl: type = class_decl @ImplsGeneric [concrete = constants.%ImplsGeneric] {} {} @@ -532,45 +429,45 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%F.decl) [concrete = constants.%impl_witness] // CHECK:STDOUT: %CallGenericMethod.decl: %CallGenericMethod.type = fn_decl @CallGenericMethod [concrete = constants.%CallGenericMethod] { -// CHECK:STDOUT: %T.patt.loc17_22.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc17_22.2 (constants.%T.patt)] -// CHECK:STDOUT: %U.patt.loc17_32.1: @CallGenericMethod.%Generic.type.loc17_45.2 (%Generic.type.91ccba.2) = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc17_32.2 (constants.%U.patt)] -// CHECK:STDOUT: %t.patt: @CallGenericMethod.%T.loc17_22.2 (%T) = binding_pattern t -// CHECK:STDOUT: %t.param_patt: @CallGenericMethod.%T.loc17_22.2 (%T) = value_param_pattern %t.patt, call_param0 +// CHECK:STDOUT: %T.patt.loc15_22.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_22.2 (constants.%T.patt)] +// CHECK:STDOUT: %U.patt.loc15_32.1: @CallGenericMethod.%Generic.type.loc15_45.2 (%Generic.type.91ccba.2) = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc15_32.2 (constants.%U.patt)] +// CHECK:STDOUT: %t.patt: @CallGenericMethod.%T.loc15_22.2 (%T) = binding_pattern t +// CHECK:STDOUT: %t.param_patt: @CallGenericMethod.%T.loc15_22.2 (%T) = value_param_pattern %t.patt, call_param0 // CHECK:STDOUT: } { -// CHECK:STDOUT: %T.loc17_22.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc17_22.2 (constants.%T)] -// CHECK:STDOUT: %.loc17: type = splice_block %Generic.type.loc17_45.1 [symbolic = %Generic.type.loc17_45.2 (constants.%Generic.type.91ccba.2)] { +// CHECK:STDOUT: %T.loc15_22.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc15_22.2 (constants.%T)] +// CHECK:STDOUT: %.loc15: type = splice_block %Generic.type.loc15_45.1 [symbolic = %Generic.type.loc15_45.2 (constants.%Generic.type.91ccba.2)] { // CHECK:STDOUT: %Generic.ref: %Generic.type.c21 = name_ref Generic, file.%Generic.decl [concrete = constants.%Generic.generic] -// CHECK:STDOUT: %T.ref.loc17_44: type = name_ref T, %T.loc17_22.1 [symbolic = %T.loc17_22.2 (constants.%T)] -// CHECK:STDOUT: %Generic.type.loc17_45.1: type = facet_type <@Generic, @Generic(constants.%T)> [symbolic = %Generic.type.loc17_45.2 (constants.%Generic.type.91ccba.2)] +// CHECK:STDOUT: %T.ref.loc15_44: type = name_ref T, %T.loc15_22.1 [symbolic = %T.loc15_22.2 (constants.%T)] +// CHECK:STDOUT: %Generic.type.loc15_45.1: type = facet_type <@Generic, @Generic(constants.%T)> [symbolic = %Generic.type.loc15_45.2 (constants.%Generic.type.91ccba.2)] // CHECK:STDOUT: } -// CHECK:STDOUT: %U.loc17_32.1: @CallGenericMethod.%Generic.type.loc17_45.2 (%Generic.type.91ccba.2) = bind_symbolic_name U, 1 [symbolic = %U.loc17_32.2 (constants.%U)] -// CHECK:STDOUT: %t.param: @CallGenericMethod.%T.loc17_22.2 (%T) = value_param call_param0 -// CHECK:STDOUT: %T.ref.loc17_51: type = name_ref T, %T.loc17_22.1 [symbolic = %T.loc17_22.2 (constants.%T)] -// CHECK:STDOUT: %t: @CallGenericMethod.%T.loc17_22.2 (%T) = bind_name t, %t.param +// CHECK:STDOUT: %U.loc15_32.1: @CallGenericMethod.%Generic.type.loc15_45.2 (%Generic.type.91ccba.2) = bind_symbolic_name U, 1 [symbolic = %U.loc15_32.2 (constants.%U)] +// CHECK:STDOUT: %t.param: @CallGenericMethod.%T.loc15_22.2 (%T) = value_param call_param0 +// CHECK:STDOUT: %T.ref.loc15_51: type = name_ref T, %T.loc15_22.1 [symbolic = %T.loc15_22.2 (constants.%T)] +// CHECK:STDOUT: %t: @CallGenericMethod.%T.loc15_22.2 (%T) = bind_name t, %t.param // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Generic(%Scalar.loc6_19.1: type) { -// CHECK:STDOUT: %Scalar.loc6_19.2: type = bind_symbolic_name Scalar, 0 [symbolic = %Scalar.loc6_19.2 (constants.%Scalar)] -// CHECK:STDOUT: %Scalar.patt.loc6_19.2: type = symbolic_binding_pattern Scalar, 0 [symbolic = %Scalar.patt.loc6_19.2 (constants.%Scalar.patt)] +// CHECK:STDOUT: generic interface @Generic(%Scalar.loc4_19.1: type) { +// CHECK:STDOUT: %Scalar.loc4_19.2: type = bind_symbolic_name Scalar, 0 [symbolic = %Scalar.loc4_19.2 (constants.%Scalar)] +// CHECK:STDOUT: %Scalar.patt.loc4_19.2: type = symbolic_binding_pattern Scalar, 0 [symbolic = %Scalar.patt.loc4_19.2 (constants.%Scalar.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Generic.type: type = facet_type <@Generic, @Generic(%Scalar.loc6_19.2)> [symbolic = %Generic.type (constants.%Generic.type.91ccba.1)] +// CHECK:STDOUT: %Generic.type: type = facet_type <@Generic, @Generic(%Scalar.loc4_19.2)> [symbolic = %Generic.type (constants.%Generic.type.91ccba.1)] // CHECK:STDOUT: %Self.2: %Generic.type.91ccba.1 = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %F.type: type = fn_type @F.1, @Generic(%Scalar.loc6_19.2) [symbolic = %F.type (constants.%F.type.f43)] +// CHECK:STDOUT: %F.type: type = fn_type @F.1, @Generic(%Scalar.loc4_19.2) [symbolic = %F.type (constants.%F.type.f43)] // CHECK:STDOUT: %F: @Generic.%F.type (%F.type.f43) = struct_value () [symbolic = %F (constants.%F.8a2)] // CHECK:STDOUT: %Generic.assoc_type: type = assoc_entity_type @Generic.%Generic.type (%Generic.type.91ccba.1) [symbolic = %Generic.assoc_type (constants.%Generic.assoc_type.de9)] -// CHECK:STDOUT: %assoc0.loc7_9.2: @Generic.%Generic.assoc_type (%Generic.assoc_type.de9) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc7_9.2 (constants.%assoc0.29c)] +// CHECK:STDOUT: %assoc0.loc5_9.2: @Generic.%Generic.assoc_type (%Generic.assoc_type.de9) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc5_9.2 (constants.%assoc0.29c)] // CHECK:STDOUT: // CHECK:STDOUT: interface { // CHECK:STDOUT: %Self.1: @Generic.%Generic.type (%Generic.type.91ccba.1) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] // CHECK:STDOUT: %F.decl: @Generic.%F.type (%F.type.f43) = fn_decl @F.1 [symbolic = @Generic.%F (constants.%F.8a2)] {} {} -// CHECK:STDOUT: %assoc0.loc7_9.1: @Generic.%Generic.assoc_type (%Generic.assoc_type.de9) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc7_9.2 (constants.%assoc0.29c)] +// CHECK:STDOUT: %assoc0.loc5_9.1: @Generic.%Generic.assoc_type (%Generic.assoc_type.de9) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc5_9.2 (constants.%assoc0.29c)] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .F = %assoc0.loc7_9.1 +// CHECK:STDOUT: .F = %assoc0.loc5_9.1 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -599,7 +496,7 @@ fn G() { // CHECK:STDOUT: .Self = constants.%ImplsGeneric // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F.1(@Generic.%Scalar.loc6_19.1: type, @Generic.%Self.1: @Generic.%Generic.type (%Generic.type.91ccba.1)) { +// CHECK:STDOUT: generic fn @F.1(@Generic.%Scalar.loc4_19.1: type, @Generic.%Self.1: @Generic.%Generic.type (%Generic.type.91ccba.1)) { // CHECK:STDOUT: fn(); // CHECK:STDOUT: } // CHECK:STDOUT: @@ -608,17 +505,17 @@ fn G() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @CallGenericMethod(%T.loc17_22.1: type, %U.loc17_32.1: @CallGenericMethod.%Generic.type.loc17_45.2 (%Generic.type.91ccba.2)) { -// CHECK:STDOUT: %T.loc17_22.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc17_22.2 (constants.%T)] -// CHECK:STDOUT: %T.patt.loc17_22.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc17_22.2 (constants.%T.patt)] -// CHECK:STDOUT: %Generic.type.loc17_45.2: type = facet_type <@Generic, @Generic(%T.loc17_22.2)> [symbolic = %Generic.type.loc17_45.2 (constants.%Generic.type.91ccba.2)] -// CHECK:STDOUT: %U.loc17_32.2: %Generic.type.91ccba.2 = bind_symbolic_name U, 1 [symbolic = %U.loc17_32.2 (constants.%U)] -// CHECK:STDOUT: %U.patt.loc17_32.2: %Generic.type.91ccba.2 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc17_32.2 (constants.%U.patt)] +// CHECK:STDOUT: generic fn @CallGenericMethod(%T.loc15_22.1: type, %U.loc15_32.1: @CallGenericMethod.%Generic.type.loc15_45.2 (%Generic.type.91ccba.2)) { +// CHECK:STDOUT: %T.loc15_22.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc15_22.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc15_22.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_22.2 (constants.%T.patt)] +// CHECK:STDOUT: %Generic.type.loc15_45.2: type = facet_type <@Generic, @Generic(%T.loc15_22.2)> [symbolic = %Generic.type.loc15_45.2 (constants.%Generic.type.91ccba.2)] +// CHECK:STDOUT: %U.loc15_32.2: %Generic.type.91ccba.2 = bind_symbolic_name U, 1 [symbolic = %U.loc15_32.2 (constants.%U)] +// CHECK:STDOUT: %U.patt.loc15_32.2: %Generic.type.91ccba.2 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc15_32.2 (constants.%U.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type @CallGenericMethod.%T.loc17_22.2 (%T) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type @CallGenericMethod.%T.loc15_22.2 (%T) [symbolic = %require_complete (constants.%require_complete)] // CHECK:STDOUT: -// CHECK:STDOUT: fn[%T.patt.loc17_22.1: type](%U.patt.loc17_32.1: @CallGenericMethod.%Generic.type.loc17_45.2 (%Generic.type.91ccba.2), %t.param_patt: @CallGenericMethod.%T.loc17_22.2 (%T)) { +// CHECK:STDOUT: fn[%T.patt.loc15_22.1: type](%U.patt.loc15_32.1: @CallGenericMethod.%Generic.type.loc15_45.2 (%Generic.type.91ccba.2), %t.param_patt: @CallGenericMethod.%T.loc15_22.2 (%T)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -628,32 +525,32 @@ fn G() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %CallGenericMethod.ref: %CallGenericMethod.type = name_ref CallGenericMethod, file.%CallGenericMethod.decl [concrete = constants.%CallGenericMethod] // CHECK:STDOUT: %ImplsGeneric.ref: type = name_ref ImplsGeneric, file.%ImplsGeneric.decl [concrete = constants.%ImplsGeneric] -// CHECK:STDOUT: %.loc20_36.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc18_36.1: %empty_struct_type = struct_literal () // CHECK:STDOUT: %GenericParam.ref: type = name_ref GenericParam, file.%GenericParam.decl [concrete = constants.%GenericParam] -// CHECK:STDOUT: %.loc20_36.2: ref %GenericParam = temporary_storage -// CHECK:STDOUT: %.loc20_36.3: init %GenericParam = class_init (), %.loc20_36.2 [concrete = constants.%GenericParam.val] -// CHECK:STDOUT: %.loc20_36.4: ref %GenericParam = temporary %.loc20_36.2, %.loc20_36.3 -// CHECK:STDOUT: %.loc20_38.1: ref %GenericParam = converted %.loc20_36.1, %.loc20_36.4 +// CHECK:STDOUT: %.loc18_36.2: ref %GenericParam = temporary_storage +// CHECK:STDOUT: %.loc18_36.3: init %GenericParam = class_init (), %.loc18_36.2 [concrete = constants.%GenericParam.val] +// CHECK:STDOUT: %.loc18_36.4: ref %GenericParam = temporary %.loc18_36.2, %.loc18_36.3 +// CHECK:STDOUT: %.loc18_38.1: ref %GenericParam = converted %.loc18_36.1, %.loc18_36.4 // CHECK:STDOUT: %Generic.facet: %Generic.type.769 = facet_value constants.%ImplsGeneric, (constants.%impl_witness) [concrete = constants.%Generic.facet] -// CHECK:STDOUT: %.loc20_53: %Generic.type.769 = converted constants.%ImplsGeneric, %Generic.facet [concrete = constants.%Generic.facet] +// CHECK:STDOUT: %.loc18_53: %Generic.type.769 = converted constants.%ImplsGeneric, %Generic.facet [concrete = constants.%Generic.facet] // CHECK:STDOUT: %CallGenericMethod.specific_fn: = specific_function %CallGenericMethod.ref, @CallGenericMethod(constants.%GenericParam, constants.%Generic.facet) [concrete = constants.%CallGenericMethod.specific_fn] -// CHECK:STDOUT: %.loc20_38.2: %GenericParam = bind_value %.loc20_38.1 -// CHECK:STDOUT: %CallGenericMethod.call: init %empty_tuple.type = call %CallGenericMethod.specific_fn(%.loc20_38.2) +// CHECK:STDOUT: %.loc18_38.2: %GenericParam = bind_value %.loc18_38.1 +// CHECK:STDOUT: %CallGenericMethod.call: init %empty_tuple.type = call %CallGenericMethod.specific_fn(%.loc18_38.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Generic(constants.%Scalar) { -// CHECK:STDOUT: %Scalar.loc6_19.2 => constants.%Scalar -// CHECK:STDOUT: %Scalar.patt.loc6_19.2 => constants.%Scalar +// CHECK:STDOUT: %Scalar.loc4_19.2 => constants.%Scalar +// CHECK:STDOUT: %Scalar.patt.loc4_19.2 => constants.%Scalar // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F.1(constants.%Scalar, constants.%Self) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Generic(%Scalar.loc6_19.2) {} +// CHECK:STDOUT: specific @Generic(%Scalar.loc4_19.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Generic(constants.%GenericParam) { -// CHECK:STDOUT: %Scalar.loc6_19.2 => constants.%GenericParam -// CHECK:STDOUT: %Scalar.patt.loc6_19.2 => constants.%GenericParam +// CHECK:STDOUT: %Scalar.loc4_19.2 => constants.%GenericParam +// CHECK:STDOUT: %Scalar.patt.loc4_19.2 => constants.%GenericParam // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Generic.type => constants.%Generic.type.769 @@ -661,34 +558,210 @@ fn G() { // CHECK:STDOUT: %F.type => constants.%F.type.4cf // CHECK:STDOUT: %F => constants.%F.118 // CHECK:STDOUT: %Generic.assoc_type => constants.%Generic.assoc_type.9f1 -// CHECK:STDOUT: %assoc0.loc7_9.2 => constants.%assoc0.9b7 +// CHECK:STDOUT: %assoc0.loc5_9.2 => constants.%assoc0.9b7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F.1(constants.%GenericParam, constants.%Generic.facet) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Generic(constants.%T) { -// CHECK:STDOUT: %Scalar.loc6_19.2 => constants.%T -// CHECK:STDOUT: %Scalar.patt.loc6_19.2 => constants.%T +// CHECK:STDOUT: %Scalar.loc4_19.2 => constants.%T +// CHECK:STDOUT: %Scalar.patt.loc4_19.2 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @CallGenericMethod(constants.%T, constants.%U) { -// CHECK:STDOUT: %T.loc17_22.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc17_22.2 => constants.%T -// CHECK:STDOUT: %Generic.type.loc17_45.2 => constants.%Generic.type.91ccba.2 -// CHECK:STDOUT: %U.loc17_32.2 => constants.%U -// CHECK:STDOUT: %U.patt.loc17_32.2 => constants.%U +// CHECK:STDOUT: %T.loc15_22.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc15_22.2 => constants.%T +// CHECK:STDOUT: %Generic.type.loc15_45.2 => constants.%Generic.type.91ccba.2 +// CHECK:STDOUT: %U.loc15_32.2 => constants.%U +// CHECK:STDOUT: %U.patt.loc15_32.2 => constants.%U // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Generic(@CallGenericMethod.%T.loc17_22.2) {} +// CHECK:STDOUT: specific @Generic(@CallGenericMethod.%T.loc15_22.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @CallGenericMethod(constants.%GenericParam, constants.%Generic.facet) { -// CHECK:STDOUT: %T.loc17_22.2 => constants.%GenericParam -// CHECK:STDOUT: %T.patt.loc17_22.2 => constants.%GenericParam -// CHECK:STDOUT: %Generic.type.loc17_45.2 => constants.%Generic.type.769 -// CHECK:STDOUT: %U.loc17_32.2 => constants.%Generic.facet -// CHECK:STDOUT: %U.patt.loc17_32.2 => constants.%Generic.facet +// CHECK:STDOUT: %T.loc15_22.2 => constants.%GenericParam +// CHECK:STDOUT: %T.patt.loc15_22.2 => constants.%GenericParam +// CHECK:STDOUT: %Generic.type.loc15_45.2 => constants.%Generic.type.769 +// CHECK:STDOUT: %U.loc15_32.2 => constants.%Generic.facet +// CHECK:STDOUT: %U.patt.loc15_32.2 => constants.%Generic.facet // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete => constants.%complete_type // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: --- toolchain/testing/min_prelude/convert.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: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .As = %As.decl +// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %As.decl: %As.type.b51 = interface_decl @As [concrete = constants.%As.generic] { +// CHECK:STDOUT: %Dest.patt.loc8_14.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc8_14.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { +// CHECK:STDOUT: %Dest.patt.loc12_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc12_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(%Dest.loc8_14.1: type) { +// CHECK:STDOUT: %Dest.loc8_14.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc8_14.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest.loc8_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.loc8_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.loc9_35.2: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_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.loc9_20.1 (%Self.as_type.7f0) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @As.%Dest.loc8_14.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param call_param0 +// CHECK:STDOUT: %.loc9_20.1: type = splice_block %.loc9_20.3 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] { +// CHECK:STDOUT: %.loc9_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, %.loc9_20.2 [symbolic = %Self (constants.%Self.b4e)] +// CHECK:STDOUT: %Self.as_type.loc9_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: %.loc9_20.3: type = converted %Self.ref, %Self.as_type.loc9_20.2 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.1.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.1.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc9_35.1: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_35.2 (constants.%assoc0.ac5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc9_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc12_22.1: type) { +// CHECK:STDOUT: %Dest.loc12_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc12_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc12_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.loc12_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.loc14_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_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.loc14_20.1 (%Self.as_type.419) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc12_22.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param call_param0 +// CHECK:STDOUT: %.loc14_20.1: type = splice_block %.loc14_20.3 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] { +// CHECK:STDOUT: %.loc14_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, %.loc14_20.2 [symbolic = %Self (constants.%Self.0f3)] +// CHECK:STDOUT: %Self.as_type.loc14_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: %.loc14_20.3: type = converted %Self.ref, %Self.as_type.loc14_20.2 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.2.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.2.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc14_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_35.2 (constants.%assoc0.a50)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc14_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(@As.%Dest.loc8_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.loc9_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(@ImplicitAs.%Dest.loc12_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.loc14_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419)]() -> @Convert.2.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc8_14.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc8_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.loc9_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.loc8_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc12_22.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc12_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.loc14_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.loc12_22.2) {} +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/facet/min_prelude/convert_class_value_to_facet_value_value.carbon b/toolchain/check/testdata/facet/min_prelude/convert_class_value_to_facet_value_value.carbon new file mode 100644 index 000000000000..e376a46f9463 --- /dev/null +++ b/toolchain/check/testdata/facet/min_prelude/convert_class_value_to_facet_value_value.carbon @@ -0,0 +1,332 @@ +// 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 +// +// INCLUDE-FILE: toolchain/testing/min_prelude/convert.carbon +// EXTRA-ARGS: --custom-core +// +// AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/facet/min_prelude/convert_class_value_to_facet_value_value.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/facet/min_prelude/convert_class_value_to_facet_value_value.carbon + +interface Animal {} + +fn WalkAnimal[T:! Animal](a: T) {} + +class Goat {} +impl Goat as Animal {} + +fn F() { + WalkAnimal({} as Goat); +} + +// CHECK:STDOUT: --- convert_class_value_to_facet_value_value.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Animal.type: type = facet_type <@Animal> [concrete] +// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %T: %Animal.type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.patt: %Animal.type = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic] +// CHECK:STDOUT: %WalkAnimal.type: type = fn_type @WalkAnimal [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %WalkAnimal: %WalkAnimal.type = struct_value () [concrete] +// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type [symbolic] +// CHECK:STDOUT: %Goat: type = class_type @Goat [concrete] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] +// CHECK:STDOUT: %impl_witness: = impl_witness () [concrete] +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %Goat.val: %Goat = struct_value () [concrete] +// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value %Goat, (%impl_witness) [concrete] +// CHECK:STDOUT: %WalkAnimal.specific_fn: = specific_function %WalkAnimal, @WalkAnimal(%Animal.facet) [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// 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: .Animal = %Animal.decl +// CHECK:STDOUT: .WalkAnimal = %WalkAnimal.decl +// CHECK:STDOUT: .Goat = %Goat.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Animal.decl: type = interface_decl @Animal [concrete = constants.%Animal.type] {} {} +// CHECK:STDOUT: %WalkAnimal.decl: %WalkAnimal.type = fn_decl @WalkAnimal [concrete = constants.%WalkAnimal] { +// CHECK:STDOUT: %T.patt.loc16_15.1: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc16_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %a.patt: @WalkAnimal.%T.as_type.loc16_30.2 (%T.as_type) = binding_pattern a +// CHECK:STDOUT: %a.param_patt: @WalkAnimal.%T.as_type.loc16_30.2 (%T.as_type) = value_param_pattern %a.patt, call_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: %T.loc16_15.1: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc16_15.2 (constants.%T)] +// CHECK:STDOUT: %a.param: @WalkAnimal.%T.as_type.loc16_30.2 (%T.as_type) = value_param call_param0 +// CHECK:STDOUT: %.loc16_30.1: type = splice_block %.loc16_30.2 [symbolic = %T.as_type.loc16_30.2 (constants.%T.as_type)] { +// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc16_15.1 [symbolic = %T.loc16_15.2 (constants.%T)] +// CHECK:STDOUT: %T.as_type.loc16_30.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc16_30.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc16_30.2: type = converted %T.ref, %T.as_type.loc16_30.1 [symbolic = %T.as_type.loc16_30.2 (constants.%T.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: @WalkAnimal.%T.as_type.loc16_30.2 (%T.as_type) = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Goat.decl: type = class_decl @Goat [concrete = constants.%Goat] {} {} +// CHECK:STDOUT: impl_decl @impl [concrete] {} { +// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] +// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness: = impl_witness () [concrete = constants.%impl_witness] +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @Animal { +// CHECK:STDOUT: %Self: %Animal.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: impl @impl: %Goat.ref as %Animal.ref { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = file.%impl_witness +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: class @Goat { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type] +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Goat +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @WalkAnimal(%T.loc16_15.1: %Animal.type) { +// CHECK:STDOUT: %T.loc16_15.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc16_15.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc16_15.2: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc16_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.as_type.loc16_30.2: type = facet_access_type %T.loc16_15.2 [symbolic = %T.as_type.loc16_30.2 (constants.%T.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @WalkAnimal.%T.as_type.loc16_30.2 (%T.as_type) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%T.patt.loc16_15.1: %Animal.type](%a.param_patt: @WalkAnimal.%T.as_type.loc16_30.2 (%T.as_type)) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %WalkAnimal.ref: %WalkAnimal.type = name_ref WalkAnimal, file.%WalkAnimal.decl [concrete = constants.%WalkAnimal] +// CHECK:STDOUT: %.loc22_15.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] +// CHECK:STDOUT: %.loc22_15.2: ref %Goat = temporary_storage +// CHECK:STDOUT: %.loc22_15.3: init %Goat = class_init (), %.loc22_15.2 [concrete = constants.%Goat.val] +// CHECK:STDOUT: %.loc22_15.4: ref %Goat = temporary %.loc22_15.2, %.loc22_15.3 +// CHECK:STDOUT: %.loc22_17.1: ref %Goat = converted %.loc22_15.1, %.loc22_15.4 +// CHECK:STDOUT: %Animal.facet.loc22_24.1: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness) [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %.loc22_24.1: %Animal.type = converted constants.%Goat, %Animal.facet.loc22_24.1 [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %Animal.facet.loc22_24.2: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness) [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %.loc22_24.2: %Animal.type = converted constants.%Goat, %Animal.facet.loc22_24.2 [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %WalkAnimal.specific_fn: = specific_function %WalkAnimal.ref, @WalkAnimal(constants.%Animal.facet) [concrete = constants.%WalkAnimal.specific_fn] +// CHECK:STDOUT: %.loc22_17.2: %Goat = bind_value %.loc22_17.1 +// CHECK:STDOUT: %WalkAnimal.call: init %empty_tuple.type = call %WalkAnimal.specific_fn(%.loc22_17.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @WalkAnimal(constants.%T) { +// CHECK:STDOUT: %T.loc16_15.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc16_15.2 => constants.%T +// CHECK:STDOUT: %T.as_type.loc16_30.2 => constants.%T.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @WalkAnimal(constants.%Animal.facet) { +// CHECK:STDOUT: %T.loc16_15.2 => constants.%Animal.facet +// CHECK:STDOUT: %T.patt.loc16_15.2 => constants.%Animal.facet +// CHECK:STDOUT: %T.as_type.loc16_30.2 => constants.%Goat +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- toolchain/testing/min_prelude/convert.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: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .As = %As.decl +// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %As.decl: %As.type.b51 = interface_decl @As [concrete = constants.%As.generic] { +// CHECK:STDOUT: %Dest.patt.loc8_14.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc8_14.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { +// CHECK:STDOUT: %Dest.patt.loc12_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc12_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(%Dest.loc8_14.1: type) { +// CHECK:STDOUT: %Dest.loc8_14.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc8_14.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest.loc8_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.loc8_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.loc9_35.2: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_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.loc9_20.1 (%Self.as_type.7f0) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @As.%Dest.loc8_14.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param call_param0 +// CHECK:STDOUT: %.loc9_20.1: type = splice_block %.loc9_20.3 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] { +// CHECK:STDOUT: %.loc9_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, %.loc9_20.2 [symbolic = %Self (constants.%Self.b4e)] +// CHECK:STDOUT: %Self.as_type.loc9_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: %.loc9_20.3: type = converted %Self.ref, %Self.as_type.loc9_20.2 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.1.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.1.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc9_35.1: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_35.2 (constants.%assoc0.ac5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc9_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc12_22.1: type) { +// CHECK:STDOUT: %Dest.loc12_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc12_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc12_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.loc12_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.loc14_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_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.loc14_20.1 (%Self.as_type.419) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc12_22.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param call_param0 +// CHECK:STDOUT: %.loc14_20.1: type = splice_block %.loc14_20.3 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] { +// CHECK:STDOUT: %.loc14_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, %.loc14_20.2 [symbolic = %Self (constants.%Self.0f3)] +// CHECK:STDOUT: %Self.as_type.loc14_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: %.loc14_20.3: type = converted %Self.ref, %Self.as_type.loc14_20.2 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.2.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.2.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc14_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_35.2 (constants.%assoc0.a50)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc14_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(@As.%Dest.loc8_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.loc9_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(@ImplicitAs.%Dest.loc12_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.loc14_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419)]() -> @Convert.2.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc8_14.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc8_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.loc9_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.loc8_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc12_22.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc12_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.loc14_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.loc12_22.2) {} +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_class_value_to_generic_facet_value_value.carbon b/toolchain/check/testdata/facet/min_prelude/convert_class_value_to_generic_facet_value_value.carbon similarity index 52% rename from toolchain/check/testdata/builtin_conversions/no_prelude/convert_class_value_to_generic_facet_value_value.carbon rename to toolchain/check/testdata/facet/min_prelude/convert_class_value_to_generic_facet_value_value.carbon index ca9bcefefadc..07b34bc3d9d5 100644 --- a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_class_value_to_generic_facet_value_value.carbon +++ b/toolchain/check/testdata/facet/min_prelude/convert_class_value_to_generic_facet_value_value.carbon @@ -2,26 +2,19 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// INCLUDE-FILE: toolchain/testing/min_prelude/convert.carbon +// EXTRA-ARGS: --custom-core +// // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtin_conversions/no_prelude/convert_class_value_to_generic_facet_value_value.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/facet/min_prelude/convert_class_value_to_generic_facet_value_value.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtin_conversions/no_prelude/convert_class_value_to_generic_facet_value_value.carbon - -// --- core.carbon - -package Core; - -interface ImplicitAs(T:! type) { - fn Convert[self: Self]() -> T; -} +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/facet/min_prelude/convert_class_value_to_generic_facet_value_value.carbon // --- convert_class_value_to_generic_facet_value_value.carbon library "[[@TEST_NAME]]"; -import Core; - interface Generic(Scalar:! type) { fn F(); } @@ -44,8 +37,6 @@ fn G() { // --- multiple_generic_params_one_fixed_one_deduced.carbon library "[[@TEST_NAME]]"; -import Core; - interface I(V:! type, W:! type) {} class C {} @@ -61,8 +52,6 @@ fn B() { // --- fail_mismatch_impl_constraint_with_fixed_specific.carbon library "[[@TEST_NAME]]"; -import Core; - interface I(V:! type, W:! type) {} class C {} @@ -88,8 +77,6 @@ fn B() { // --- fail_mismatch_impl_self_with_fixed_specific.carbon library "[[@TEST_NAME]]"; -import Core; - interface I {} class C(V:! type, W:! type) {} @@ -112,100 +99,6 @@ fn B() { A({} as C({}, {})); } -// CHECK:STDOUT: --- core.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] -// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 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(%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: %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: } -// 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: %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: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(%T.loc4_22.1: type) { -// CHECK:STDOUT: %T.loc4_22.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_22.2 (constants.%T)] -// CHECK:STDOUT: %T.patt.loc4_22.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_22.2 (constants.%T.patt)] -// 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: %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: -// CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %Convert.decl: @ImplicitAs.%Convert.type (%Convert.type) = fn_decl @Convert [symbolic = @ImplicitAs.%Convert (constants.%Convert)] { -// CHECK:STDOUT: %self.patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = binding_pattern self -// CHECK:STDOUT: %self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = value_param_pattern %self.patt, call_param0 -// CHECK:STDOUT: %return.patt: @Convert.%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: } -// CHECK:STDOUT: %self: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = 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: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .T = -// CHECK:STDOUT: .Convert = %assoc0.loc5_32.1 -// CHECK:STDOUT: witness = (%Convert.decl) -// 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: -// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type)]() -> @Convert.%T (%T); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(constants.%T) { -// CHECK:STDOUT: %T.loc4_22.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc4_22.2 => constants.%T -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Convert(constants.%T, constants.%Self) { -// 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: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(@Convert.%T) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(%T.loc4_22.2) {} -// CHECK:STDOUT: // CHECK:STDOUT: --- convert_class_value_to_generic_facet_value_value.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -265,7 +158,7 @@ fn B() { // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: import Core//default +// CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -280,9 +173,9 @@ fn B() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Generic.decl: %Generic.type.c21 = interface_decl @Generic [concrete = constants.%Generic.generic] { -// CHECK:STDOUT: %Scalar.patt.loc6_19.1: type = symbolic_binding_pattern Scalar, 0 [symbolic = %Scalar.patt.loc6_19.2 (constants.%Scalar.patt)] +// CHECK:STDOUT: %Scalar.patt.loc4_19.1: type = symbolic_binding_pattern Scalar, 0 [symbolic = %Scalar.patt.loc4_19.2 (constants.%Scalar.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %Scalar.loc6_19.1: type = bind_symbolic_name Scalar, 0 [symbolic = %Scalar.loc6_19.2 (constants.%Scalar)] +// CHECK:STDOUT: %Scalar.loc4_19.1: type = bind_symbolic_name Scalar, 0 [symbolic = %Scalar.loc4_19.2 (constants.%Scalar)] // CHECK:STDOUT: } // CHECK:STDOUT: %GenericParam.decl: type = class_decl @GenericParam [concrete = constants.%GenericParam] {} {} // CHECK:STDOUT: %ImplsGeneric.decl: type = class_decl @ImplsGeneric [concrete = constants.%ImplsGeneric] {} {} @@ -294,54 +187,54 @@ fn B() { // CHECK:STDOUT: } // CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%F.decl) [concrete = constants.%impl_witness] // CHECK:STDOUT: %CallGenericMethod.decl: %CallGenericMethod.type = fn_decl @CallGenericMethod [concrete = constants.%CallGenericMethod] { -// CHECK:STDOUT: %T.patt.loc17_22.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc17_22.2 (constants.%T.patt)] -// CHECK:STDOUT: %U.patt.loc17_32.1: @CallGenericMethod.%Generic.type.loc17_45.2 (%Generic.type.91ccba.2) = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc17_32.2 (constants.%U.patt)] -// CHECK:STDOUT: %a.patt: @CallGenericMethod.%U.as_type.loc17_51.2 (%U.as_type) = binding_pattern a -// CHECK:STDOUT: %a.param_patt: @CallGenericMethod.%U.as_type.loc17_51.2 (%U.as_type) = value_param_pattern %a.patt, call_param0 -// CHECK:STDOUT: %s.patt: @CallGenericMethod.%T.loc17_22.2 (%T) = binding_pattern s -// CHECK:STDOUT: %s.param_patt: @CallGenericMethod.%T.loc17_22.2 (%T) = value_param_pattern %s.patt, call_param1 +// CHECK:STDOUT: %T.patt.loc15_22.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_22.2 (constants.%T.patt)] +// CHECK:STDOUT: %U.patt.loc15_32.1: @CallGenericMethod.%Generic.type.loc15_45.2 (%Generic.type.91ccba.2) = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc15_32.2 (constants.%U.patt)] +// CHECK:STDOUT: %a.patt: @CallGenericMethod.%U.as_type.loc15_51.2 (%U.as_type) = binding_pattern a +// CHECK:STDOUT: %a.param_patt: @CallGenericMethod.%U.as_type.loc15_51.2 (%U.as_type) = value_param_pattern %a.patt, call_param0 +// CHECK:STDOUT: %s.patt: @CallGenericMethod.%T.loc15_22.2 (%T) = binding_pattern s +// CHECK:STDOUT: %s.param_patt: @CallGenericMethod.%T.loc15_22.2 (%T) = value_param_pattern %s.patt, call_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %T.loc17_22.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc17_22.2 (constants.%T)] -// CHECK:STDOUT: %.loc17_45: type = splice_block %Generic.type.loc17_45.1 [symbolic = %Generic.type.loc17_45.2 (constants.%Generic.type.91ccba.2)] { +// CHECK:STDOUT: %T.loc15_22.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc15_22.2 (constants.%T)] +// CHECK:STDOUT: %.loc15_45: type = splice_block %Generic.type.loc15_45.1 [symbolic = %Generic.type.loc15_45.2 (constants.%Generic.type.91ccba.2)] { // CHECK:STDOUT: %Generic.ref: %Generic.type.c21 = name_ref Generic, file.%Generic.decl [concrete = constants.%Generic.generic] -// CHECK:STDOUT: %T.ref.loc17_44: type = name_ref T, %T.loc17_22.1 [symbolic = %T.loc17_22.2 (constants.%T)] -// CHECK:STDOUT: %Generic.type.loc17_45.1: type = facet_type <@Generic, @Generic(constants.%T)> [symbolic = %Generic.type.loc17_45.2 (constants.%Generic.type.91ccba.2)] +// CHECK:STDOUT: %T.ref.loc15_44: type = name_ref T, %T.loc15_22.1 [symbolic = %T.loc15_22.2 (constants.%T)] +// CHECK:STDOUT: %Generic.type.loc15_45.1: type = facet_type <@Generic, @Generic(constants.%T)> [symbolic = %Generic.type.loc15_45.2 (constants.%Generic.type.91ccba.2)] // CHECK:STDOUT: } -// CHECK:STDOUT: %U.loc17_32.1: @CallGenericMethod.%Generic.type.loc17_45.2 (%Generic.type.91ccba.2) = bind_symbolic_name U, 1 [symbolic = %U.loc17_32.2 (constants.%U)] -// CHECK:STDOUT: %a.param: @CallGenericMethod.%U.as_type.loc17_51.2 (%U.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc17_51.1: type = splice_block %.loc17_51.2 [symbolic = %U.as_type.loc17_51.2 (constants.%U.as_type)] { -// CHECK:STDOUT: %U.ref.loc17: @CallGenericMethod.%Generic.type.loc17_45.2 (%Generic.type.91ccba.2) = name_ref U, %U.loc17_32.1 [symbolic = %U.loc17_32.2 (constants.%U)] -// CHECK:STDOUT: %U.as_type.loc17_51.1: type = facet_access_type %U.ref.loc17 [symbolic = %U.as_type.loc17_51.2 (constants.%U.as_type)] -// CHECK:STDOUT: %.loc17_51.2: type = converted %U.ref.loc17, %U.as_type.loc17_51.1 [symbolic = %U.as_type.loc17_51.2 (constants.%U.as_type)] +// CHECK:STDOUT: %U.loc15_32.1: @CallGenericMethod.%Generic.type.loc15_45.2 (%Generic.type.91ccba.2) = bind_symbolic_name U, 1 [symbolic = %U.loc15_32.2 (constants.%U)] +// CHECK:STDOUT: %a.param: @CallGenericMethod.%U.as_type.loc15_51.2 (%U.as_type) = value_param call_param0 +// CHECK:STDOUT: %.loc15_51.1: type = splice_block %.loc15_51.2 [symbolic = %U.as_type.loc15_51.2 (constants.%U.as_type)] { +// CHECK:STDOUT: %U.ref.loc15: @CallGenericMethod.%Generic.type.loc15_45.2 (%Generic.type.91ccba.2) = name_ref U, %U.loc15_32.1 [symbolic = %U.loc15_32.2 (constants.%U)] +// CHECK:STDOUT: %U.as_type.loc15_51.1: type = facet_access_type %U.ref.loc15 [symbolic = %U.as_type.loc15_51.2 (constants.%U.as_type)] +// CHECK:STDOUT: %.loc15_51.2: type = converted %U.ref.loc15, %U.as_type.loc15_51.1 [symbolic = %U.as_type.loc15_51.2 (constants.%U.as_type)] // CHECK:STDOUT: } -// CHECK:STDOUT: %a: @CallGenericMethod.%U.as_type.loc17_51.2 (%U.as_type) = bind_name a, %a.param -// CHECK:STDOUT: %s.param: @CallGenericMethod.%T.loc17_22.2 (%T) = value_param call_param1 -// CHECK:STDOUT: %T.ref.loc17_57: type = name_ref T, %T.loc17_22.1 [symbolic = %T.loc17_22.2 (constants.%T)] -// CHECK:STDOUT: %s: @CallGenericMethod.%T.loc17_22.2 (%T) = bind_name s, %s.param +// CHECK:STDOUT: %a: @CallGenericMethod.%U.as_type.loc15_51.2 (%U.as_type) = bind_name a, %a.param +// CHECK:STDOUT: %s.param: @CallGenericMethod.%T.loc15_22.2 (%T) = value_param call_param1 +// CHECK:STDOUT: %T.ref.loc15_57: type = name_ref T, %T.loc15_22.1 [symbolic = %T.loc15_22.2 (constants.%T)] +// CHECK:STDOUT: %s: @CallGenericMethod.%T.loc15_22.2 (%T) = bind_name s, %s.param // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Generic(%Scalar.loc6_19.1: type) { -// CHECK:STDOUT: %Scalar.loc6_19.2: type = bind_symbolic_name Scalar, 0 [symbolic = %Scalar.loc6_19.2 (constants.%Scalar)] -// CHECK:STDOUT: %Scalar.patt.loc6_19.2: type = symbolic_binding_pattern Scalar, 0 [symbolic = %Scalar.patt.loc6_19.2 (constants.%Scalar.patt)] +// CHECK:STDOUT: generic interface @Generic(%Scalar.loc4_19.1: type) { +// CHECK:STDOUT: %Scalar.loc4_19.2: type = bind_symbolic_name Scalar, 0 [symbolic = %Scalar.loc4_19.2 (constants.%Scalar)] +// CHECK:STDOUT: %Scalar.patt.loc4_19.2: type = symbolic_binding_pattern Scalar, 0 [symbolic = %Scalar.patt.loc4_19.2 (constants.%Scalar.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Generic.type: type = facet_type <@Generic, @Generic(%Scalar.loc6_19.2)> [symbolic = %Generic.type (constants.%Generic.type.91ccba.1)] +// CHECK:STDOUT: %Generic.type: type = facet_type <@Generic, @Generic(%Scalar.loc4_19.2)> [symbolic = %Generic.type (constants.%Generic.type.91ccba.1)] // CHECK:STDOUT: %Self.2: %Generic.type.91ccba.1 = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %F.type: type = fn_type @F.1, @Generic(%Scalar.loc6_19.2) [symbolic = %F.type (constants.%F.type.f439a9.1)] +// CHECK:STDOUT: %F.type: type = fn_type @F.1, @Generic(%Scalar.loc4_19.2) [symbolic = %F.type (constants.%F.type.f439a9.1)] // CHECK:STDOUT: %F: @Generic.%F.type (%F.type.f439a9.1) = struct_value () [symbolic = %F (constants.%F.8a2d67.1)] // CHECK:STDOUT: %Generic.assoc_type: type = assoc_entity_type @Generic.%Generic.type (%Generic.type.91ccba.1) [symbolic = %Generic.assoc_type (constants.%Generic.assoc_type.de973d.1)] -// CHECK:STDOUT: %assoc0.loc7_9.2: @Generic.%Generic.assoc_type (%Generic.assoc_type.de973d.1) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc7_9.2 (constants.%assoc0.29ce53.1)] +// CHECK:STDOUT: %assoc0.loc5_9.2: @Generic.%Generic.assoc_type (%Generic.assoc_type.de973d.1) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc5_9.2 (constants.%assoc0.29ce53.1)] // CHECK:STDOUT: // CHECK:STDOUT: interface { // CHECK:STDOUT: %Self.1: @Generic.%Generic.type (%Generic.type.91ccba.1) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] // CHECK:STDOUT: %F.decl: @Generic.%F.type (%F.type.f439a9.1) = fn_decl @F.1 [symbolic = @Generic.%F (constants.%F.8a2d67.1)] {} {} -// CHECK:STDOUT: %assoc0.loc7_9.1: @Generic.%Generic.assoc_type (%Generic.assoc_type.de973d.1) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc7_9.2 (constants.%assoc0.29ce53.1)] +// CHECK:STDOUT: %assoc0.loc5_9.1: @Generic.%Generic.assoc_type (%Generic.assoc_type.de973d.1) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc5_9.2 (constants.%assoc0.29ce53.1)] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .F = %assoc0.loc7_9.1 +// CHECK:STDOUT: .F = %assoc0.loc5_9.1 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -370,7 +263,7 @@ fn B() { // CHECK:STDOUT: .Self = constants.%ImplsGeneric // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F.1(@Generic.%Scalar.loc6_19.1: type, @Generic.%Self.1: @Generic.%Generic.type (%Generic.type.91ccba.1)) { +// CHECK:STDOUT: generic fn @F.1(@Generic.%Scalar.loc4_19.1: type, @Generic.%Self.1: @Generic.%Generic.type (%Generic.type.91ccba.1)) { // CHECK:STDOUT: fn(); // CHECK:STDOUT: } // CHECK:STDOUT: @@ -379,38 +272,38 @@ fn B() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @CallGenericMethod(%T.loc17_22.1: type, %U.loc17_32.1: @CallGenericMethod.%Generic.type.loc17_45.2 (%Generic.type.91ccba.2)) { -// CHECK:STDOUT: %T.loc17_22.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc17_22.2 (constants.%T)] -// CHECK:STDOUT: %T.patt.loc17_22.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc17_22.2 (constants.%T.patt)] -// CHECK:STDOUT: %Generic.type.loc17_45.2: type = facet_type <@Generic, @Generic(%T.loc17_22.2)> [symbolic = %Generic.type.loc17_45.2 (constants.%Generic.type.91ccba.2)] -// CHECK:STDOUT: %U.loc17_32.2: %Generic.type.91ccba.2 = bind_symbolic_name U, 1 [symbolic = %U.loc17_32.2 (constants.%U)] -// CHECK:STDOUT: %U.patt.loc17_32.2: %Generic.type.91ccba.2 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc17_32.2 (constants.%U.patt)] -// CHECK:STDOUT: %U.as_type.loc17_51.2: type = facet_access_type %U.loc17_32.2 [symbolic = %U.as_type.loc17_51.2 (constants.%U.as_type)] +// CHECK:STDOUT: generic fn @CallGenericMethod(%T.loc15_22.1: type, %U.loc15_32.1: @CallGenericMethod.%Generic.type.loc15_45.2 (%Generic.type.91ccba.2)) { +// CHECK:STDOUT: %T.loc15_22.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc15_22.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc15_22.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_22.2 (constants.%T.patt)] +// CHECK:STDOUT: %Generic.type.loc15_45.2: type = facet_type <@Generic, @Generic(%T.loc15_22.2)> [symbolic = %Generic.type.loc15_45.2 (constants.%Generic.type.91ccba.2)] +// CHECK:STDOUT: %U.loc15_32.2: %Generic.type.91ccba.2 = bind_symbolic_name U, 1 [symbolic = %U.loc15_32.2 (constants.%U)] +// CHECK:STDOUT: %U.patt.loc15_32.2: %Generic.type.91ccba.2 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc15_32.2 (constants.%U.patt)] +// CHECK:STDOUT: %U.as_type.loc15_51.2: type = facet_access_type %U.loc15_32.2 [symbolic = %U.as_type.loc15_51.2 (constants.%U.as_type)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc17_49: = require_complete_type @CallGenericMethod.%U.as_type.loc17_51.2 (%U.as_type) [symbolic = %require_complete.loc17_49 (constants.%require_complete.7b2)] -// CHECK:STDOUT: %require_complete.loc17_55: = require_complete_type @CallGenericMethod.%T.loc17_22.2 (%T) [symbolic = %require_complete.loc17_55 (constants.%require_complete.4ae)] -// CHECK:STDOUT: %require_complete.loc18: = require_complete_type @CallGenericMethod.%Generic.type.loc17_45.2 (%Generic.type.91ccba.2) [symbolic = %require_complete.loc18 (constants.%require_complete.02a)] -// CHECK:STDOUT: %Generic.assoc_type: type = assoc_entity_type @CallGenericMethod.%Generic.type.loc17_45.2 (%Generic.type.91ccba.2) [symbolic = %Generic.assoc_type (constants.%Generic.assoc_type.de973d.2)] +// CHECK:STDOUT: %require_complete.loc15_49: = require_complete_type @CallGenericMethod.%U.as_type.loc15_51.2 (%U.as_type) [symbolic = %require_complete.loc15_49 (constants.%require_complete.7b2)] +// CHECK:STDOUT: %require_complete.loc15_55: = require_complete_type @CallGenericMethod.%T.loc15_22.2 (%T) [symbolic = %require_complete.loc15_55 (constants.%require_complete.4ae)] +// CHECK:STDOUT: %require_complete.loc16: = require_complete_type @CallGenericMethod.%Generic.type.loc15_45.2 (%Generic.type.91ccba.2) [symbolic = %require_complete.loc16 (constants.%require_complete.02a)] +// CHECK:STDOUT: %Generic.assoc_type: type = assoc_entity_type @CallGenericMethod.%Generic.type.loc15_45.2 (%Generic.type.91ccba.2) [symbolic = %Generic.assoc_type (constants.%Generic.assoc_type.de973d.2)] // CHECK:STDOUT: %assoc0: @CallGenericMethod.%Generic.assoc_type (%Generic.assoc_type.de973d.2) = assoc_entity element0, @Generic.%F.decl [symbolic = %assoc0 (constants.%assoc0.29ce53.2)] -// CHECK:STDOUT: %U.as_wit.iface0.loc18_4.2: = facet_access_witness %U.loc17_32.2, element0 [symbolic = %U.as_wit.iface0.loc18_4.2 (constants.%U.as_wit.iface0)] -// CHECK:STDOUT: %F.type: type = fn_type @F.1, @Generic(%T.loc17_22.2) [symbolic = %F.type (constants.%F.type.f439a9.2)] -// CHECK:STDOUT: %Generic.facet: @CallGenericMethod.%Generic.type.loc17_45.2 (%Generic.type.91ccba.2) = facet_value %U.as_type.loc17_51.2, (%U.as_wit.iface0.loc18_4.2) [symbolic = %Generic.facet (constants.%Generic.facet.0aa)] -// CHECK:STDOUT: %.loc18_4.3: type = fn_type_with_self_type %F.type, %Generic.facet [symbolic = %.loc18_4.3 (constants.%.10b)] -// CHECK:STDOUT: %impl.elem0.loc18_4.2: @CallGenericMethod.%.loc18_4.3 (%.10b) = impl_witness_access %U.as_wit.iface0.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, @F.1(%T.loc17_22.2, %Generic.facet) [symbolic = %specific_fn.loc18_4.2 (constants.%specific_fn)] +// CHECK:STDOUT: %U.as_wit.iface0.loc16_4.2: = facet_access_witness %U.loc15_32.2, element0 [symbolic = %U.as_wit.iface0.loc16_4.2 (constants.%U.as_wit.iface0)] +// CHECK:STDOUT: %F.type: type = fn_type @F.1, @Generic(%T.loc15_22.2) [symbolic = %F.type (constants.%F.type.f439a9.2)] +// CHECK:STDOUT: %Generic.facet: @CallGenericMethod.%Generic.type.loc15_45.2 (%Generic.type.91ccba.2) = facet_value %U.as_type.loc15_51.2, (%U.as_wit.iface0.loc16_4.2) [symbolic = %Generic.facet (constants.%Generic.facet.0aa)] +// CHECK:STDOUT: %.loc16_4.3: type = fn_type_with_self_type %F.type, %Generic.facet [symbolic = %.loc16_4.3 (constants.%.10b)] +// CHECK:STDOUT: %impl.elem0.loc16_4.2: @CallGenericMethod.%.loc16_4.3 (%.10b) = impl_witness_access %U.as_wit.iface0.loc16_4.2, element0 [symbolic = %impl.elem0.loc16_4.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %specific_fn.loc16_4.2: = specific_function %impl.elem0.loc16_4.2, @F.1(%T.loc15_22.2, %Generic.facet) [symbolic = %specific_fn.loc16_4.2 (constants.%specific_fn)] // CHECK:STDOUT: -// CHECK:STDOUT: fn[%T.patt.loc17_22.1: type, %U.patt.loc17_32.1: @CallGenericMethod.%Generic.type.loc17_45.2 (%Generic.type.91ccba.2)](%a.param_patt: @CallGenericMethod.%U.as_type.loc17_51.2 (%U.as_type), %s.param_patt: @CallGenericMethod.%T.loc17_22.2 (%T)) { +// CHECK:STDOUT: fn[%T.patt.loc15_22.1: type, %U.patt.loc15_32.1: @CallGenericMethod.%Generic.type.loc15_45.2 (%Generic.type.91ccba.2)](%a.param_patt: @CallGenericMethod.%U.as_type.loc15_51.2 (%U.as_type), %s.param_patt: @CallGenericMethod.%T.loc15_22.2 (%T)) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %U.ref.loc18: @CallGenericMethod.%Generic.type.loc17_45.2 (%Generic.type.91ccba.2) = name_ref U, %U.loc17_32.1 [symbolic = %U.loc17_32.2 (constants.%U)] -// CHECK:STDOUT: %.loc18_4.1: @CallGenericMethod.%Generic.assoc_type (%Generic.assoc_type.de973d.2) = specific_constant @Generic.%assoc0.loc7_9.1, @Generic(constants.%T) [symbolic = %assoc0 (constants.%assoc0.29ce53.2)] -// CHECK:STDOUT: %F.ref: @CallGenericMethod.%Generic.assoc_type (%Generic.assoc_type.de973d.2) = name_ref F, %.loc18_4.1 [symbolic = %assoc0 (constants.%assoc0.29ce53.2)] -// CHECK:STDOUT: %U.as_type.loc18: type = facet_access_type %U.ref.loc18 [symbolic = %U.as_type.loc17_51.2 (constants.%U.as_type)] -// CHECK:STDOUT: %.loc18_4.2: type = converted %U.ref.loc18, %U.as_type.loc18 [symbolic = %U.as_type.loc17_51.2 (constants.%U.as_type)] -// CHECK:STDOUT: %U.as_wit.iface0.loc18_4.1: = facet_access_witness %U.ref.loc18, element0 [symbolic = %U.as_wit.iface0.loc18_4.2 (constants.%U.as_wit.iface0)] -// CHECK:STDOUT: %impl.elem0.loc18_4.1: @CallGenericMethod.%.loc18_4.3 (%.10b) = impl_witness_access %U.as_wit.iface0.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, @F.1(constants.%T, constants.%Generic.facet.0aa) [symbolic = %specific_fn.loc18_4.2 (constants.%specific_fn)] -// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %specific_fn.loc18_4.1() +// CHECK:STDOUT: %U.ref.loc16: @CallGenericMethod.%Generic.type.loc15_45.2 (%Generic.type.91ccba.2) = name_ref U, %U.loc15_32.1 [symbolic = %U.loc15_32.2 (constants.%U)] +// CHECK:STDOUT: %.loc16_4.1: @CallGenericMethod.%Generic.assoc_type (%Generic.assoc_type.de973d.2) = specific_constant @Generic.%assoc0.loc5_9.1, @Generic(constants.%T) [symbolic = %assoc0 (constants.%assoc0.29ce53.2)] +// CHECK:STDOUT: %F.ref: @CallGenericMethod.%Generic.assoc_type (%Generic.assoc_type.de973d.2) = name_ref F, %.loc16_4.1 [symbolic = %assoc0 (constants.%assoc0.29ce53.2)] +// CHECK:STDOUT: %U.as_type.loc16: type = facet_access_type %U.ref.loc16 [symbolic = %U.as_type.loc15_51.2 (constants.%U.as_type)] +// CHECK:STDOUT: %.loc16_4.2: type = converted %U.ref.loc16, %U.as_type.loc16 [symbolic = %U.as_type.loc15_51.2 (constants.%U.as_type)] +// CHECK:STDOUT: %U.as_wit.iface0.loc16_4.1: = facet_access_witness %U.ref.loc16, element0 [symbolic = %U.as_wit.iface0.loc16_4.2 (constants.%U.as_wit.iface0)] +// CHECK:STDOUT: %impl.elem0.loc16_4.1: @CallGenericMethod.%.loc16_4.3 (%.10b) = impl_witness_access %U.as_wit.iface0.loc16_4.1, element0 [symbolic = %impl.elem0.loc16_4.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %specific_fn.loc16_4.1: = specific_function %impl.elem0.loc16_4.1, @F.1(constants.%T, constants.%Generic.facet.0aa) [symbolic = %specific_fn.loc16_4.2 (constants.%specific_fn)] +// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %specific_fn.loc16_4.1() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -418,39 +311,39 @@ fn B() { // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %CallGenericMethod.ref: %CallGenericMethod.type = name_ref CallGenericMethod, file.%CallGenericMethod.decl [concrete = constants.%CallGenericMethod] -// CHECK:STDOUT: %.loc22_22.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc20_22.1: %empty_struct_type = struct_literal () // CHECK:STDOUT: %ImplsGeneric.ref: type = name_ref ImplsGeneric, file.%ImplsGeneric.decl [concrete = constants.%ImplsGeneric] -// CHECK:STDOUT: %.loc22_22.2: ref %ImplsGeneric = temporary_storage -// CHECK:STDOUT: %.loc22_22.3: init %ImplsGeneric = class_init (), %.loc22_22.2 [concrete = constants.%ImplsGeneric.val] -// CHECK:STDOUT: %.loc22_22.4: ref %ImplsGeneric = temporary %.loc22_22.2, %.loc22_22.3 -// CHECK:STDOUT: %.loc22_24.1: ref %ImplsGeneric = converted %.loc22_22.1, %.loc22_22.4 -// CHECK:STDOUT: %.loc22_42.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc20_22.2: ref %ImplsGeneric = temporary_storage +// CHECK:STDOUT: %.loc20_22.3: init %ImplsGeneric = class_init (), %.loc20_22.2 [concrete = constants.%ImplsGeneric.val] +// CHECK:STDOUT: %.loc20_22.4: ref %ImplsGeneric = temporary %.loc20_22.2, %.loc20_22.3 +// CHECK:STDOUT: %.loc20_24.1: ref %ImplsGeneric = converted %.loc20_22.1, %.loc20_22.4 +// CHECK:STDOUT: %.loc20_42.1: %empty_struct_type = struct_literal () // CHECK:STDOUT: %GenericParam.ref: type = name_ref GenericParam, file.%GenericParam.decl [concrete = constants.%GenericParam] -// CHECK:STDOUT: %.loc22_42.2: ref %GenericParam = temporary_storage -// CHECK:STDOUT: %.loc22_42.3: init %GenericParam = class_init (), %.loc22_42.2 [concrete = constants.%GenericParam.val] -// CHECK:STDOUT: %.loc22_42.4: ref %GenericParam = temporary %.loc22_42.2, %.loc22_42.3 -// CHECK:STDOUT: %.loc22_44.1: ref %GenericParam = converted %.loc22_42.1, %.loc22_42.4 +// CHECK:STDOUT: %.loc20_42.2: ref %GenericParam = temporary_storage +// CHECK:STDOUT: %.loc20_42.3: init %GenericParam = class_init (), %.loc20_42.2 [concrete = constants.%GenericParam.val] +// CHECK:STDOUT: %.loc20_42.4: ref %GenericParam = temporary %.loc20_42.2, %.loc20_42.3 +// CHECK:STDOUT: %.loc20_44.1: ref %GenericParam = converted %.loc20_42.1, %.loc20_42.4 // CHECK:STDOUT: %Generic.facet: %Generic.type.769 = facet_value constants.%ImplsGeneric, (constants.%impl_witness) [concrete = constants.%Generic.facet.8bd] -// CHECK:STDOUT: %.loc22_59: %Generic.type.769 = converted constants.%ImplsGeneric, %Generic.facet [concrete = constants.%Generic.facet.8bd] +// CHECK:STDOUT: %.loc20_59: %Generic.type.769 = converted constants.%ImplsGeneric, %Generic.facet [concrete = constants.%Generic.facet.8bd] // CHECK:STDOUT: %CallGenericMethod.specific_fn: = specific_function %CallGenericMethod.ref, @CallGenericMethod(constants.%GenericParam, constants.%Generic.facet.8bd) [concrete = constants.%CallGenericMethod.specific_fn] -// CHECK:STDOUT: %.loc22_24.2: %ImplsGeneric = bind_value %.loc22_24.1 -// CHECK:STDOUT: %.loc22_44.2: %GenericParam = bind_value %.loc22_44.1 -// CHECK:STDOUT: %CallGenericMethod.call: init %empty_tuple.type = call %CallGenericMethod.specific_fn(%.loc22_24.2, %.loc22_44.2) +// CHECK:STDOUT: %.loc20_24.2: %ImplsGeneric = bind_value %.loc20_24.1 +// CHECK:STDOUT: %.loc20_44.2: %GenericParam = bind_value %.loc20_44.1 +// CHECK:STDOUT: %CallGenericMethod.call: init %empty_tuple.type = call %CallGenericMethod.specific_fn(%.loc20_24.2, %.loc20_44.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Generic(constants.%Scalar) { -// CHECK:STDOUT: %Scalar.loc6_19.2 => constants.%Scalar -// CHECK:STDOUT: %Scalar.patt.loc6_19.2 => constants.%Scalar +// CHECK:STDOUT: %Scalar.loc4_19.2 => constants.%Scalar +// CHECK:STDOUT: %Scalar.patt.loc4_19.2 => constants.%Scalar // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F.1(constants.%Scalar, constants.%Self) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Generic(%Scalar.loc6_19.2) {} +// CHECK:STDOUT: specific @Generic(%Scalar.loc4_19.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Generic(constants.%GenericParam) { -// CHECK:STDOUT: %Scalar.loc6_19.2 => constants.%GenericParam -// CHECK:STDOUT: %Scalar.patt.loc6_19.2 => constants.%GenericParam +// CHECK:STDOUT: %Scalar.loc4_19.2 => constants.%GenericParam +// CHECK:STDOUT: %Scalar.patt.loc4_19.2 => constants.%GenericParam // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Generic.type => constants.%Generic.type.769 @@ -458,14 +351,14 @@ fn B() { // CHECK:STDOUT: %F.type => constants.%F.type.4cf // CHECK:STDOUT: %F => constants.%F.118 // CHECK:STDOUT: %Generic.assoc_type => constants.%Generic.assoc_type.9f1 -// CHECK:STDOUT: %assoc0.loc7_9.2 => constants.%assoc0.9b7 +// CHECK:STDOUT: %assoc0.loc5_9.2 => constants.%assoc0.9b7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F.1(constants.%GenericParam, constants.%Generic.facet.8bd) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Generic(constants.%T) { -// CHECK:STDOUT: %Scalar.loc6_19.2 => constants.%T -// CHECK:STDOUT: %Scalar.patt.loc6_19.2 => constants.%T +// CHECK:STDOUT: %Scalar.loc4_19.2 => constants.%T +// CHECK:STDOUT: %Scalar.patt.loc4_19.2 => constants.%T // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Generic.type => constants.%Generic.type.91ccba.2 @@ -473,44 +366,44 @@ fn B() { // CHECK:STDOUT: %F.type => constants.%F.type.f439a9.2 // CHECK:STDOUT: %F => constants.%F.8a2d67.2 // CHECK:STDOUT: %Generic.assoc_type => constants.%Generic.assoc_type.de973d.2 -// CHECK:STDOUT: %assoc0.loc7_9.2 => constants.%assoc0.29ce53.2 +// CHECK:STDOUT: %assoc0.loc5_9.2 => constants.%assoc0.29ce53.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @CallGenericMethod(constants.%T, constants.%U) { -// CHECK:STDOUT: %T.loc17_22.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc17_22.2 => constants.%T -// CHECK:STDOUT: %Generic.type.loc17_45.2 => constants.%Generic.type.91ccba.2 -// CHECK:STDOUT: %U.loc17_32.2 => constants.%U -// CHECK:STDOUT: %U.patt.loc17_32.2 => constants.%U -// CHECK:STDOUT: %U.as_type.loc17_51.2 => constants.%U.as_type +// CHECK:STDOUT: %T.loc15_22.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc15_22.2 => constants.%T +// CHECK:STDOUT: %Generic.type.loc15_45.2 => constants.%Generic.type.91ccba.2 +// CHECK:STDOUT: %U.loc15_32.2 => constants.%U +// CHECK:STDOUT: %U.patt.loc15_32.2 => constants.%U +// CHECK:STDOUT: %U.as_type.loc15_51.2 => constants.%U.as_type // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Generic(@CallGenericMethod.%T.loc17_22.2) {} +// CHECK:STDOUT: specific @Generic(@CallGenericMethod.%T.loc15_22.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @F.1(constants.%T, constants.%Generic.facet.0aa) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.1(@CallGenericMethod.%T.loc17_22.2, @CallGenericMethod.%Generic.facet) {} +// CHECK:STDOUT: specific @F.1(@CallGenericMethod.%T.loc15_22.2, @CallGenericMethod.%Generic.facet) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @CallGenericMethod(constants.%GenericParam, constants.%Generic.facet.8bd) { -// CHECK:STDOUT: %T.loc17_22.2 => constants.%GenericParam -// CHECK:STDOUT: %T.patt.loc17_22.2 => constants.%GenericParam -// CHECK:STDOUT: %Generic.type.loc17_45.2 => constants.%Generic.type.769 -// CHECK:STDOUT: %U.loc17_32.2 => constants.%Generic.facet.8bd -// CHECK:STDOUT: %U.patt.loc17_32.2 => constants.%Generic.facet.8bd -// CHECK:STDOUT: %U.as_type.loc17_51.2 => constants.%ImplsGeneric +// CHECK:STDOUT: %T.loc15_22.2 => constants.%GenericParam +// CHECK:STDOUT: %T.patt.loc15_22.2 => constants.%GenericParam +// CHECK:STDOUT: %Generic.type.loc15_45.2 => constants.%Generic.type.769 +// CHECK:STDOUT: %U.loc15_32.2 => constants.%Generic.facet.8bd +// CHECK:STDOUT: %U.patt.loc15_32.2 => constants.%Generic.facet.8bd +// CHECK:STDOUT: %U.as_type.loc15_51.2 => constants.%ImplsGeneric // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc17_49 => constants.%complete_type.357 -// CHECK:STDOUT: %require_complete.loc17_55 => constants.%complete_type.357 -// CHECK:STDOUT: %require_complete.loc18 => constants.%complete_type.997 +// CHECK:STDOUT: %require_complete.loc15_49 => constants.%complete_type.357 +// CHECK:STDOUT: %require_complete.loc15_55 => constants.%complete_type.357 +// CHECK:STDOUT: %require_complete.loc16 => constants.%complete_type.997 // CHECK:STDOUT: %Generic.assoc_type => constants.%Generic.assoc_type.9f1 // CHECK:STDOUT: %assoc0 => constants.%assoc0.9b7 -// CHECK:STDOUT: %U.as_wit.iface0.loc18_4.2 => constants.%impl_witness +// CHECK:STDOUT: %U.as_wit.iface0.loc16_4.2 => constants.%impl_witness // CHECK:STDOUT: %F.type => constants.%F.type.4cf // CHECK:STDOUT: %Generic.facet => constants.%Generic.facet.8bd -// CHECK:STDOUT: %.loc18_4.3 => constants.%.1eb -// CHECK:STDOUT: %impl.elem0.loc18_4.2 => constants.%F.a56 -// CHECK:STDOUT: %specific_fn.loc18_4.2 => constants.%F.specific_fn +// CHECK:STDOUT: %.loc16_4.3 => constants.%.1eb +// CHECK:STDOUT: %impl.elem0.loc16_4.2 => constants.%F.a56 +// CHECK:STDOUT: %specific_fn.loc16_4.2 => constants.%F.specific_fn // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- multiple_generic_params_one_fixed_one_deduced.carbon @@ -551,7 +444,7 @@ fn B() { // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: import Core//default +// CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -565,58 +458,58 @@ fn B() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %I.decl: %I.type.dac = interface_decl @I [concrete = constants.%I.generic] { -// CHECK:STDOUT: %V.patt.loc5_13.1: type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc5_13.2 (constants.%V.patt)] -// CHECK:STDOUT: %W.patt.loc5_23.1: type = symbolic_binding_pattern W, 1 [symbolic = %W.patt.loc5_23.2 (constants.%W.patt)] +// CHECK:STDOUT: %V.patt.loc3_13.1: type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc3_13.2 (constants.%V.patt)] +// CHECK:STDOUT: %W.patt.loc3_23.1: type = symbolic_binding_pattern W, 1 [symbolic = %W.patt.loc3_23.2 (constants.%W.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %V.loc5_13.1: type = bind_symbolic_name V, 0 [symbolic = %V.loc5_13.2 (constants.%V)] -// CHECK:STDOUT: %W.loc5_23.1: type = bind_symbolic_name W, 1 [symbolic = %W.loc5_23.2 (constants.%W)] +// CHECK:STDOUT: %V.loc3_13.1: type = bind_symbolic_name V, 0 [symbolic = %V.loc3_13.2 (constants.%V)] +// CHECK:STDOUT: %W.loc3_23.1: type = bind_symbolic_name W, 1 [symbolic = %W.loc3_23.2 (constants.%W)] // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {} // CHECK:STDOUT: impl_decl @impl [concrete] { -// CHECK:STDOUT: %T.patt.loc9_14.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_14.2 (constants.%T.patt.e01)] +// CHECK:STDOUT: %T.patt.loc7_14.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc7_14.2 (constants.%T.patt.e01)] // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, file.%I.decl [concrete = constants.%I.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc9_14.1 [symbolic = %T.loc9_14.2 (constants.%T.8b3)] -// CHECK:STDOUT: %.loc9_35: %empty_tuple.type = tuple_literal () -// CHECK:STDOUT: %.loc9_36: type = converted %.loc9_35, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %I.type.loc9_36.1: type = facet_type <@I, @I(constants.%T.8b3, constants.%empty_tuple.type)> [symbolic = %I.type.loc9_36.2 (constants.%I.type.bea)] -// CHECK:STDOUT: %T.loc9_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc9_14.2 (constants.%T.8b3)] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc7_14.1 [symbolic = %T.loc7_14.2 (constants.%T.8b3)] +// CHECK:STDOUT: %.loc7_35: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc7_36: type = converted %.loc7_35, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %I.type.loc7_36.1: type = facet_type <@I, @I(constants.%T.8b3, constants.%empty_tuple.type)> [symbolic = %I.type.loc7_36.2 (constants.%I.type.bea)] +// CHECK:STDOUT: %T.loc7_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc7_14.2 (constants.%T.8b3)] // CHECK:STDOUT: } // CHECK:STDOUT: %impl_witness: = impl_witness (), @impl(constants.%T.8b3) [symbolic = @impl.%impl_witness (constants.%impl_witness.298)] // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [concrete = constants.%A] { -// CHECK:STDOUT: %T.patt.loc11_6.1: %I.type.202 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_6.2 (constants.%T.patt.5b9)] -// CHECK:STDOUT: %t.patt: @A.%T.as_type.loc11_24.2 (%T.as_type) = binding_pattern t -// CHECK:STDOUT: %t.param_patt: @A.%T.as_type.loc11_24.2 (%T.as_type) = value_param_pattern %t.patt, call_param0 +// CHECK:STDOUT: %T.patt.loc9_6.1: %I.type.202 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_6.2 (constants.%T.patt.5b9)] +// CHECK:STDOUT: %t.patt: @A.%T.as_type.loc9_24.2 (%T.as_type) = binding_pattern t +// CHECK:STDOUT: %t.param_patt: @A.%T.as_type.loc9_24.2 (%T.as_type) = value_param_pattern %t.patt, call_param0 // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc11_18.1: type = splice_block %I.type [concrete = constants.%I.type.202] { +// CHECK:STDOUT: %.loc9_18.1: type = splice_block %I.type [concrete = constants.%I.type.202] { // CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, file.%I.decl [concrete = constants.%I.generic] -// CHECK:STDOUT: %.loc11_13: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %.loc11_17: %empty_tuple.type = tuple_literal () -// CHECK:STDOUT: %.loc11_18.2: type = converted %.loc11_13, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %.loc11_18.3: type = converted %.loc11_17, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc9_13: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc9_17: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc9_18.2: type = converted %.loc9_13, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc9_18.3: type = converted %.loc9_17, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(constants.%empty_struct_type, constants.%empty_tuple.type)> [concrete = constants.%I.type.202] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc11_6.1: %I.type.202 = bind_symbolic_name T, 0 [symbolic = %T.loc11_6.2 (constants.%T.e96)] -// CHECK:STDOUT: %t.param: @A.%T.as_type.loc11_24.2 (%T.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc11_24.1: type = splice_block %.loc11_24.2 [symbolic = %T.as_type.loc11_24.2 (constants.%T.as_type)] { -// CHECK:STDOUT: %T.ref: %I.type.202 = name_ref T, %T.loc11_6.1 [symbolic = %T.loc11_6.2 (constants.%T.e96)] -// CHECK:STDOUT: %T.as_type.loc11_24.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc11_24.2 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc11_24.2: type = converted %T.ref, %T.as_type.loc11_24.1 [symbolic = %T.as_type.loc11_24.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.loc9_6.1: %I.type.202 = bind_symbolic_name T, 0 [symbolic = %T.loc9_6.2 (constants.%T.e96)] +// CHECK:STDOUT: %t.param: @A.%T.as_type.loc9_24.2 (%T.as_type) = value_param call_param0 +// CHECK:STDOUT: %.loc9_24.1: type = splice_block %.loc9_24.2 [symbolic = %T.as_type.loc9_24.2 (constants.%T.as_type)] { +// CHECK:STDOUT: %T.ref: %I.type.202 = name_ref T, %T.loc9_6.1 [symbolic = %T.loc9_6.2 (constants.%T.e96)] +// CHECK:STDOUT: %T.as_type.loc9_24.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc9_24.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc9_24.2: type = converted %T.ref, %T.as_type.loc9_24.1 [symbolic = %T.as_type.loc9_24.2 (constants.%T.as_type)] // CHECK:STDOUT: } -// CHECK:STDOUT: %t: @A.%T.as_type.loc11_24.2 (%T.as_type) = bind_name t, %t.param +// CHECK:STDOUT: %t: @A.%T.as_type.loc9_24.2 (%T.as_type) = bind_name t, %t.param // CHECK:STDOUT: } // CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [concrete = constants.%B] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @I(%V.loc5_13.1: type, %W.loc5_23.1: type) { -// CHECK:STDOUT: %V.loc5_13.2: type = bind_symbolic_name V, 0 [symbolic = %V.loc5_13.2 (constants.%V)] -// CHECK:STDOUT: %V.patt.loc5_13.2: type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc5_13.2 (constants.%V.patt)] -// CHECK:STDOUT: %W.loc5_23.2: type = bind_symbolic_name W, 1 [symbolic = %W.loc5_23.2 (constants.%W)] -// CHECK:STDOUT: %W.patt.loc5_23.2: type = symbolic_binding_pattern W, 1 [symbolic = %W.patt.loc5_23.2 (constants.%W.patt)] +// CHECK:STDOUT: generic interface @I(%V.loc3_13.1: type, %W.loc3_23.1: type) { +// CHECK:STDOUT: %V.loc3_13.2: type = bind_symbolic_name V, 0 [symbolic = %V.loc3_13.2 (constants.%V)] +// CHECK:STDOUT: %V.patt.loc3_13.2: type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc3_13.2 (constants.%V.patt)] +// CHECK:STDOUT: %W.loc3_23.2: type = bind_symbolic_name W, 1 [symbolic = %W.loc3_23.2 (constants.%W)] +// CHECK:STDOUT: %W.patt.loc3_23.2: type = symbolic_binding_pattern W, 1 [symbolic = %W.patt.loc3_23.2 (constants.%W.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%V.loc5_13.2, %W.loc5_23.2)> [symbolic = %I.type (constants.%I.type.f76)] +// CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%V.loc3_13.2, %W.loc3_23.2)> [symbolic = %I.type (constants.%I.type.f76)] // CHECK:STDOUT: %Self.2: %I.type.f76 = bind_symbolic_name Self, 2 [symbolic = %Self.2 (constants.%Self)] // CHECK:STDOUT: // CHECK:STDOUT: interface { @@ -628,16 +521,16 @@ fn B() { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @impl(%T.loc9_14.1: type) { -// CHECK:STDOUT: %T.loc9_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc9_14.2 (constants.%T.8b3)] -// CHECK:STDOUT: %T.patt.loc9_14.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_14.2 (constants.%T.patt.e01)] -// CHECK:STDOUT: %I.type.loc9_36.2: type = facet_type <@I, @I(%T.loc9_14.2, constants.%empty_tuple.type)> [symbolic = %I.type.loc9_36.2 (constants.%I.type.bea)] -// CHECK:STDOUT: %require_complete: = require_complete_type @impl.%I.type.loc9_36.2 (%I.type.bea) [symbolic = %require_complete (constants.%require_complete.5ce)] -// CHECK:STDOUT: %impl_witness: = impl_witness (), @impl(%T.loc9_14.2) [symbolic = %impl_witness (constants.%impl_witness.298)] +// CHECK:STDOUT: generic impl @impl(%T.loc7_14.1: type) { +// CHECK:STDOUT: %T.loc7_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc7_14.2 (constants.%T.8b3)] +// CHECK:STDOUT: %T.patt.loc7_14.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc7_14.2 (constants.%T.patt.e01)] +// CHECK:STDOUT: %I.type.loc7_36.2: type = facet_type <@I, @I(%T.loc7_14.2, constants.%empty_tuple.type)> [symbolic = %I.type.loc7_36.2 (constants.%I.type.bea)] +// CHECK:STDOUT: %require_complete: = require_complete_type @impl.%I.type.loc7_36.2 (%I.type.bea) [symbolic = %require_complete (constants.%require_complete.5ce)] +// CHECK:STDOUT: %impl_witness: = impl_witness (), @impl(%T.loc7_14.2) [symbolic = %impl_witness (constants.%impl_witness.298)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: impl: %C.ref as %I.type.loc9_36.1 { +// CHECK:STDOUT: impl: %C.ref as %I.type.loc7_36.1 { // CHECK:STDOUT: !members: // CHECK:STDOUT: witness = file.%impl_witness // CHECK:STDOUT: } @@ -651,15 +544,15 @@ fn B() { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @A(%T.loc11_6.1: %I.type.202) { -// CHECK:STDOUT: %T.loc11_6.2: %I.type.202 = bind_symbolic_name T, 0 [symbolic = %T.loc11_6.2 (constants.%T.e96)] -// CHECK:STDOUT: %T.patt.loc11_6.2: %I.type.202 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_6.2 (constants.%T.patt.5b9)] -// CHECK:STDOUT: %T.as_type.loc11_24.2: type = facet_access_type %T.loc11_6.2 [symbolic = %T.as_type.loc11_24.2 (constants.%T.as_type)] +// CHECK:STDOUT: generic fn @A(%T.loc9_6.1: %I.type.202) { +// CHECK:STDOUT: %T.loc9_6.2: %I.type.202 = bind_symbolic_name T, 0 [symbolic = %T.loc9_6.2 (constants.%T.e96)] +// CHECK:STDOUT: %T.patt.loc9_6.2: %I.type.202 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_6.2 (constants.%T.patt.5b9)] +// CHECK:STDOUT: %T.as_type.loc9_24.2: type = facet_access_type %T.loc9_6.2 [symbolic = %T.as_type.loc9_24.2 (constants.%T.as_type)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type @A.%T.as_type.loc11_24.2 (%T.as_type) [symbolic = %require_complete (constants.%require_complete.c8b)] +// CHECK:STDOUT: %require_complete: = require_complete_type @A.%T.as_type.loc9_24.2 (%T.as_type) [symbolic = %require_complete (constants.%require_complete.c8b)] // CHECK:STDOUT: -// CHECK:STDOUT: fn[%T.patt.loc11_6.1: %I.type.202](%t.param_patt: @A.%T.as_type.loc11_24.2 (%T.as_type)) { +// CHECK:STDOUT: fn[%T.patt.loc9_6.1: %I.type.202](%t.param_patt: @A.%T.as_type.loc9_24.2 (%T.as_type)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -668,36 +561,36 @@ fn B() { // CHECK:STDOUT: fn @B() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [concrete = constants.%A] -// CHECK:STDOUT: %.loc14_6.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc12_6.1: %empty_struct_type = struct_literal () // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc14_6.2: ref %C = temporary_storage -// CHECK:STDOUT: %.loc14_6.3: init %C = class_init (), %.loc14_6.2 [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc14_6.4: ref %C = temporary %.loc14_6.2, %.loc14_6.3 -// CHECK:STDOUT: %.loc14_8.1: ref %C = converted %.loc14_6.1, %.loc14_6.4 -// CHECK:STDOUT: %I.facet.loc14_12.1: %I.type.202 = facet_value constants.%C, (constants.%impl_witness.e3d) [concrete = constants.%I.facet] -// CHECK:STDOUT: %.loc14_12.1: %I.type.202 = converted constants.%C, %I.facet.loc14_12.1 [concrete = constants.%I.facet] -// CHECK:STDOUT: %I.facet.loc14_12.2: %I.type.202 = facet_value constants.%C, (constants.%impl_witness.e3d) [concrete = constants.%I.facet] -// CHECK:STDOUT: %.loc14_12.2: %I.type.202 = converted constants.%C, %I.facet.loc14_12.2 [concrete = constants.%I.facet] +// CHECK:STDOUT: %.loc12_6.2: ref %C = temporary_storage +// CHECK:STDOUT: %.loc12_6.3: init %C = class_init (), %.loc12_6.2 [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc12_6.4: ref %C = temporary %.loc12_6.2, %.loc12_6.3 +// CHECK:STDOUT: %.loc12_8.1: ref %C = converted %.loc12_6.1, %.loc12_6.4 +// CHECK:STDOUT: %I.facet.loc12_12.1: %I.type.202 = facet_value constants.%C, (constants.%impl_witness.e3d) [concrete = constants.%I.facet] +// CHECK:STDOUT: %.loc12_12.1: %I.type.202 = converted constants.%C, %I.facet.loc12_12.1 [concrete = constants.%I.facet] +// CHECK:STDOUT: %I.facet.loc12_12.2: %I.type.202 = facet_value constants.%C, (constants.%impl_witness.e3d) [concrete = constants.%I.facet] +// CHECK:STDOUT: %.loc12_12.2: %I.type.202 = converted constants.%C, %I.facet.loc12_12.2 [concrete = constants.%I.facet] // CHECK:STDOUT: %A.specific_fn: = specific_function %A.ref, @A(constants.%I.facet) [concrete = constants.%A.specific_fn] -// CHECK:STDOUT: %.loc14_8.2: %C = bind_value %.loc14_8.1 -// CHECK:STDOUT: %A.call: init %empty_tuple.type = call %A.specific_fn(%.loc14_8.2) +// CHECK:STDOUT: %.loc12_8.2: %C = bind_value %.loc12_8.1 +// CHECK:STDOUT: %A.call: init %empty_tuple.type = call %A.specific_fn(%.loc12_8.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @I(constants.%V, constants.%W) { -// CHECK:STDOUT: %V.loc5_13.2 => constants.%V -// CHECK:STDOUT: %V.patt.loc5_13.2 => constants.%V -// CHECK:STDOUT: %W.loc5_23.2 => constants.%W -// CHECK:STDOUT: %W.patt.loc5_23.2 => constants.%W +// CHECK:STDOUT: %V.loc3_13.2 => constants.%V +// CHECK:STDOUT: %V.patt.loc3_13.2 => constants.%V +// CHECK:STDOUT: %W.loc3_23.2 => constants.%W +// CHECK:STDOUT: %W.patt.loc3_23.2 => constants.%W // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @I(%V.loc5_13.2, %W.loc5_23.2) {} +// CHECK:STDOUT: specific @I(%V.loc3_13.2, %W.loc3_23.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @I(constants.%T.8b3, constants.%empty_tuple.type) { -// CHECK:STDOUT: %V.loc5_13.2 => constants.%T.8b3 -// CHECK:STDOUT: %V.patt.loc5_13.2 => constants.%T.8b3 -// CHECK:STDOUT: %W.loc5_23.2 => constants.%empty_tuple.type -// CHECK:STDOUT: %W.patt.loc5_23.2 => constants.%empty_tuple.type +// CHECK:STDOUT: %V.loc3_13.2 => constants.%T.8b3 +// CHECK:STDOUT: %V.patt.loc3_13.2 => constants.%T.8b3 +// CHECK:STDOUT: %W.loc3_23.2 => constants.%empty_tuple.type +// CHECK:STDOUT: %W.patt.loc3_23.2 => constants.%empty_tuple.type // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %I.type => constants.%I.type.bea @@ -705,22 +598,22 @@ fn B() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @impl(constants.%T.8b3) { -// CHECK:STDOUT: %T.loc9_14.2 => constants.%T.8b3 -// CHECK:STDOUT: %T.patt.loc9_14.2 => constants.%T.8b3 -// CHECK:STDOUT: %I.type.loc9_36.2 => constants.%I.type.bea +// CHECK:STDOUT: %T.loc7_14.2 => constants.%T.8b3 +// CHECK:STDOUT: %T.patt.loc7_14.2 => constants.%T.8b3 +// CHECK:STDOUT: %I.type.loc7_36.2 => constants.%I.type.bea // CHECK:STDOUT: %require_complete => constants.%require_complete.5ce // CHECK:STDOUT: %impl_witness => constants.%impl_witness.298 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @I(@impl.%T.loc9_14.2, constants.%empty_tuple.type) {} +// CHECK:STDOUT: specific @I(@impl.%T.loc7_14.2, constants.%empty_tuple.type) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @impl(%T.loc9_14.2) {} +// CHECK:STDOUT: specific @impl(%T.loc7_14.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @I(constants.%empty_struct_type, constants.%empty_tuple.type) { -// CHECK:STDOUT: %V.loc5_13.2 => constants.%empty_struct_type -// CHECK:STDOUT: %V.patt.loc5_13.2 => constants.%empty_struct_type -// CHECK:STDOUT: %W.loc5_23.2 => constants.%empty_tuple.type -// CHECK:STDOUT: %W.patt.loc5_23.2 => constants.%empty_tuple.type +// CHECK:STDOUT: %V.loc3_13.2 => constants.%empty_struct_type +// CHECK:STDOUT: %V.patt.loc3_13.2 => constants.%empty_struct_type +// CHECK:STDOUT: %W.loc3_23.2 => constants.%empty_tuple.type +// CHECK:STDOUT: %W.patt.loc3_23.2 => constants.%empty_tuple.type // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %I.type => constants.%I.type.202 @@ -728,15 +621,15 @@ fn B() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @A(constants.%T.e96) { -// CHECK:STDOUT: %T.loc11_6.2 => constants.%T.e96 -// CHECK:STDOUT: %T.patt.loc11_6.2 => constants.%T.e96 -// CHECK:STDOUT: %T.as_type.loc11_24.2 => constants.%T.as_type +// CHECK:STDOUT: %T.loc9_6.2 => constants.%T.e96 +// CHECK:STDOUT: %T.patt.loc9_6.2 => constants.%T.e96 +// CHECK:STDOUT: %T.as_type.loc9_24.2 => constants.%T.as_type // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @impl(constants.%empty_struct_type) { -// CHECK:STDOUT: %T.loc9_14.2 => constants.%empty_struct_type -// CHECK:STDOUT: %T.patt.loc9_14.2 => constants.%empty_struct_type -// CHECK:STDOUT: %I.type.loc9_36.2 => constants.%I.type.202 +// CHECK:STDOUT: %T.loc7_14.2 => constants.%empty_struct_type +// CHECK:STDOUT: %T.patt.loc7_14.2 => constants.%empty_struct_type +// CHECK:STDOUT: %I.type.loc7_36.2 => constants.%I.type.202 // CHECK:STDOUT: %require_complete => constants.%complete_type.3d9 // CHECK:STDOUT: %impl_witness => constants.%impl_witness.e3d // CHECK:STDOUT: @@ -744,9 +637,9 @@ fn B() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @A(constants.%I.facet) { -// CHECK:STDOUT: %T.loc11_6.2 => constants.%I.facet -// CHECK:STDOUT: %T.patt.loc11_6.2 => constants.%I.facet -// CHECK:STDOUT: %T.as_type.loc11_24.2 => constants.%C +// CHECK:STDOUT: %T.loc9_6.2 => constants.%I.facet +// CHECK:STDOUT: %T.patt.loc9_6.2 => constants.%I.facet +// CHECK:STDOUT: %T.as_type.loc9_24.2 => constants.%C // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete => constants.%complete_type.357 @@ -785,9 +678,11 @@ fn B() { // CHECK:STDOUT: %I.type.202: type = facet_type <@I, @I(%empty_struct_type, %empty_tuple.type)> [concrete] // CHECK:STDOUT: %complete_type.3d9: = complete_type_witness %I.type.202 [concrete] // CHECK:STDOUT: %impl_witness.e3d: = impl_witness (), @impl(%empty_struct_type) [concrete] -// CHECK:STDOUT: %ImplicitAs.type.d62: type = facet_type <@ImplicitAs, @ImplicitAs(%T.8b3)> [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: %Convert.type.275: type = fn_type @Convert, @ImplicitAs(%T.8b3) [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] @@ -803,15 +698,15 @@ fn B() { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs -// CHECK:STDOUT: import Core//default +// CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import_ref.5ab3ec.1: 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.43d)] -// CHECK:STDOUT: %Core.Convert = import_ref Core//default, Convert, unloaded -// CHECK:STDOUT: %Core.import_ref.5ab3ec.2: type = import_ref Core//default, loc4_22, loaded [symbolic = @ImplicitAs.%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.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, loc5_32, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] +// CHECK:STDOUT: %Core.import_ref.5ab3ec.1: type = import_ref Core//prelude, loc12_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//prelude, inst65 [no loc], unloaded +// CHECK:STDOUT: %Core.import_ref.630: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = import_ref Core//prelude, loc14_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.43d)] +// CHECK:STDOUT: %Core.Convert = import_ref Core//prelude, Convert, unloaded +// CHECK:STDOUT: %Core.import_ref.5ab3ec.2: type = import_ref Core//prelude, loc12_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) = import_ref Core//prelude, inst65 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] +// CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//prelude, loc14_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -824,58 +719,58 @@ fn B() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %I.decl: %I.type.dac = interface_decl @I [concrete = constants.%I.generic] { -// CHECK:STDOUT: %V.patt.loc5_13.1: type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc5_13.2 (constants.%V.patt)] -// CHECK:STDOUT: %W.patt.loc5_23.1: type = symbolic_binding_pattern W, 1 [symbolic = %W.patt.loc5_23.2 (constants.%W.patt)] +// CHECK:STDOUT: %V.patt.loc3_13.1: type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc3_13.2 (constants.%V.patt)] +// CHECK:STDOUT: %W.patt.loc3_23.1: type = symbolic_binding_pattern W, 1 [symbolic = %W.patt.loc3_23.2 (constants.%W.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %V.loc5_13.1: type = bind_symbolic_name V, 0 [symbolic = %V.loc5_13.2 (constants.%V)] -// CHECK:STDOUT: %W.loc5_23.1: type = bind_symbolic_name W, 1 [symbolic = %W.loc5_23.2 (constants.%W)] +// CHECK:STDOUT: %V.loc3_13.1: type = bind_symbolic_name V, 0 [symbolic = %V.loc3_13.2 (constants.%V)] +// CHECK:STDOUT: %W.loc3_23.1: type = bind_symbolic_name W, 1 [symbolic = %W.loc3_23.2 (constants.%W)] // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {} // CHECK:STDOUT: impl_decl @impl [concrete] { -// CHECK:STDOUT: %T.patt.loc9_14.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_14.2 (constants.%T.patt.e01)] +// CHECK:STDOUT: %T.patt.loc7_14.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc7_14.2 (constants.%T.patt.e01)] // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, file.%I.decl [concrete = constants.%I.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc9_14.1 [symbolic = %T.loc9_14.2 (constants.%T.8b3)] -// CHECK:STDOUT: %.loc9_35: %empty_tuple.type = tuple_literal () -// CHECK:STDOUT: %.loc9_36: type = converted %.loc9_35, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %I.type.loc9_36.1: type = facet_type <@I, @I(constants.%T.8b3, constants.%empty_tuple.type)> [symbolic = %I.type.loc9_36.2 (constants.%I.type.bea)] -// CHECK:STDOUT: %T.loc9_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc9_14.2 (constants.%T.8b3)] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc7_14.1 [symbolic = %T.loc7_14.2 (constants.%T.8b3)] +// CHECK:STDOUT: %.loc7_35: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc7_36: type = converted %.loc7_35, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %I.type.loc7_36.1: type = facet_type <@I, @I(constants.%T.8b3, constants.%empty_tuple.type)> [symbolic = %I.type.loc7_36.2 (constants.%I.type.bea)] +// CHECK:STDOUT: %T.loc7_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc7_14.2 (constants.%T.8b3)] // CHECK:STDOUT: } // CHECK:STDOUT: %impl_witness: = impl_witness (), @impl(constants.%T.8b3) [symbolic = @impl.%impl_witness (constants.%impl_witness.298)] // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [concrete = constants.%A] { -// CHECK:STDOUT: %T.patt.loc11_6.1: %I.type.906 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_6.2 (constants.%T.patt.6fc)] -// CHECK:STDOUT: %t.patt: @A.%T.as_type.loc11_24.2 (%T.as_type) = binding_pattern t -// CHECK:STDOUT: %t.param_patt: @A.%T.as_type.loc11_24.2 (%T.as_type) = value_param_pattern %t.patt, call_param0 +// CHECK:STDOUT: %T.patt.loc9_6.1: %I.type.906 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_6.2 (constants.%T.patt.6fc)] +// CHECK:STDOUT: %t.patt: @A.%T.as_type.loc9_24.2 (%T.as_type) = binding_pattern t +// CHECK:STDOUT: %t.param_patt: @A.%T.as_type.loc9_24.2 (%T.as_type) = value_param_pattern %t.patt, call_param0 // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc11_18.1: type = splice_block %I.type [concrete = constants.%I.type.906] { +// CHECK:STDOUT: %.loc9_18.1: type = splice_block %I.type [concrete = constants.%I.type.906] { // CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, file.%I.decl [concrete = constants.%I.generic] -// CHECK:STDOUT: %.loc11_13: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %.loc11_17: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %.loc11_18.2: type = converted %.loc11_13, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %.loc11_18.3: type = converted %.loc11_17, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc9_13: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc9_17: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc9_18.2: type = converted %.loc9_13, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc9_18.3: type = converted %.loc9_17, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(constants.%empty_struct_type, constants.%empty_struct_type)> [concrete = constants.%I.type.906] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc11_6.1: %I.type.906 = bind_symbolic_name T, 0 [symbolic = %T.loc11_6.2 (constants.%T.4b2)] -// CHECK:STDOUT: %t.param: @A.%T.as_type.loc11_24.2 (%T.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc11_24.1: type = splice_block %.loc11_24.2 [symbolic = %T.as_type.loc11_24.2 (constants.%T.as_type)] { -// CHECK:STDOUT: %T.ref: %I.type.906 = name_ref T, %T.loc11_6.1 [symbolic = %T.loc11_6.2 (constants.%T.4b2)] -// CHECK:STDOUT: %T.as_type.loc11_24.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc11_24.2 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc11_24.2: type = converted %T.ref, %T.as_type.loc11_24.1 [symbolic = %T.as_type.loc11_24.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.loc9_6.1: %I.type.906 = bind_symbolic_name T, 0 [symbolic = %T.loc9_6.2 (constants.%T.4b2)] +// CHECK:STDOUT: %t.param: @A.%T.as_type.loc9_24.2 (%T.as_type) = value_param call_param0 +// CHECK:STDOUT: %.loc9_24.1: type = splice_block %.loc9_24.2 [symbolic = %T.as_type.loc9_24.2 (constants.%T.as_type)] { +// CHECK:STDOUT: %T.ref: %I.type.906 = name_ref T, %T.loc9_6.1 [symbolic = %T.loc9_6.2 (constants.%T.4b2)] +// CHECK:STDOUT: %T.as_type.loc9_24.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc9_24.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc9_24.2: type = converted %T.ref, %T.as_type.loc9_24.1 [symbolic = %T.as_type.loc9_24.2 (constants.%T.as_type)] // CHECK:STDOUT: } -// CHECK:STDOUT: %t: @A.%T.as_type.loc11_24.2 (%T.as_type) = bind_name t, %t.param +// CHECK:STDOUT: %t: @A.%T.as_type.loc9_24.2 (%T.as_type) = bind_name t, %t.param // CHECK:STDOUT: } // CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [concrete = constants.%B] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @I(%V.loc5_13.1: type, %W.loc5_23.1: type) { -// CHECK:STDOUT: %V.loc5_13.2: type = bind_symbolic_name V, 0 [symbolic = %V.loc5_13.2 (constants.%V)] -// CHECK:STDOUT: %V.patt.loc5_13.2: type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc5_13.2 (constants.%V.patt)] -// CHECK:STDOUT: %W.loc5_23.2: type = bind_symbolic_name W, 1 [symbolic = %W.loc5_23.2 (constants.%W)] -// CHECK:STDOUT: %W.patt.loc5_23.2: type = symbolic_binding_pattern W, 1 [symbolic = %W.patt.loc5_23.2 (constants.%W.patt)] +// CHECK:STDOUT: generic interface @I(%V.loc3_13.1: type, %W.loc3_23.1: type) { +// CHECK:STDOUT: %V.loc3_13.2: type = bind_symbolic_name V, 0 [symbolic = %V.loc3_13.2 (constants.%V)] +// CHECK:STDOUT: %V.patt.loc3_13.2: type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc3_13.2 (constants.%V.patt)] +// CHECK:STDOUT: %W.loc3_23.2: type = bind_symbolic_name W, 1 [symbolic = %W.loc3_23.2 (constants.%W)] +// CHECK:STDOUT: %W.patt.loc3_23.2: type = symbolic_binding_pattern W, 1 [symbolic = %W.patt.loc3_23.2 (constants.%W.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%V.loc5_13.2, %W.loc5_23.2)> [symbolic = %I.type (constants.%I.type.f76)] +// CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%V.loc3_13.2, %W.loc3_23.2)> [symbolic = %I.type (constants.%I.type.f76)] // CHECK:STDOUT: %Self.2: %I.type.f76 = bind_symbolic_name Self, 2 [symbolic = %Self.2 (constants.%Self.770)] // CHECK:STDOUT: // CHECK:STDOUT: interface { @@ -887,14 +782,14 @@ fn B() { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(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: generic interface @ImplicitAs(imports.%Core.import_ref.5ab3ec.1: type) [from "toolchain/testing/min_prelude/convert.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(%T)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.d62)] +// 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(%T) [symbolic = %Convert.type (constants.%Convert.type.275)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.275)] // CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = struct_value () [symbolic = %Convert (constants.%Convert.42e)] // CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type.837)] // CHECK:STDOUT: %assoc0: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = assoc_entity element0, imports.%Core.import_ref.1c7 [symbolic = %assoc0 (constants.%assoc0.02f)] @@ -907,16 +802,16 @@ fn B() { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @impl(%T.loc9_14.1: type) { -// CHECK:STDOUT: %T.loc9_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc9_14.2 (constants.%T.8b3)] -// CHECK:STDOUT: %T.patt.loc9_14.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_14.2 (constants.%T.patt.e01)] -// CHECK:STDOUT: %I.type.loc9_36.2: type = facet_type <@I, @I(%T.loc9_14.2, constants.%empty_tuple.type)> [symbolic = %I.type.loc9_36.2 (constants.%I.type.bea)] -// CHECK:STDOUT: %require_complete: = require_complete_type @impl.%I.type.loc9_36.2 (%I.type.bea) [symbolic = %require_complete (constants.%require_complete.5ce)] -// CHECK:STDOUT: %impl_witness: = impl_witness (), @impl(%T.loc9_14.2) [symbolic = %impl_witness (constants.%impl_witness.298)] +// CHECK:STDOUT: generic impl @impl(%T.loc7_14.1: type) { +// CHECK:STDOUT: %T.loc7_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc7_14.2 (constants.%T.8b3)] +// CHECK:STDOUT: %T.patt.loc7_14.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc7_14.2 (constants.%T.patt.e01)] +// CHECK:STDOUT: %I.type.loc7_36.2: type = facet_type <@I, @I(%T.loc7_14.2, constants.%empty_tuple.type)> [symbolic = %I.type.loc7_36.2 (constants.%I.type.bea)] +// CHECK:STDOUT: %require_complete: = require_complete_type @impl.%I.type.loc7_36.2 (%I.type.bea) [symbolic = %require_complete (constants.%require_complete.5ce)] +// CHECK:STDOUT: %impl_witness: = impl_witness (), @impl(%T.loc7_14.2) [symbolic = %impl_witness (constants.%impl_witness.298)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: impl: %C.ref as %I.type.loc9_36.1 { +// CHECK:STDOUT: impl: %C.ref as %I.type.loc7_36.1 { // CHECK:STDOUT: !members: // CHECK:STDOUT: witness = file.%impl_witness // CHECK:STDOUT: } @@ -930,15 +825,15 @@ fn B() { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @A(%T.loc11_6.1: %I.type.906) { -// CHECK:STDOUT: %T.loc11_6.2: %I.type.906 = bind_symbolic_name T, 0 [symbolic = %T.loc11_6.2 (constants.%T.4b2)] -// CHECK:STDOUT: %T.patt.loc11_6.2: %I.type.906 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_6.2 (constants.%T.patt.6fc)] -// CHECK:STDOUT: %T.as_type.loc11_24.2: type = facet_access_type %T.loc11_6.2 [symbolic = %T.as_type.loc11_24.2 (constants.%T.as_type)] +// CHECK:STDOUT: generic fn @A(%T.loc9_6.1: %I.type.906) { +// CHECK:STDOUT: %T.loc9_6.2: %I.type.906 = bind_symbolic_name T, 0 [symbolic = %T.loc9_6.2 (constants.%T.4b2)] +// CHECK:STDOUT: %T.patt.loc9_6.2: %I.type.906 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_6.2 (constants.%T.patt.6fc)] +// CHECK:STDOUT: %T.as_type.loc9_24.2: type = facet_access_type %T.loc9_6.2 [symbolic = %T.as_type.loc9_24.2 (constants.%T.as_type)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type @A.%T.as_type.loc11_24.2 (%T.as_type) [symbolic = %require_complete (constants.%require_complete.d5b)] +// CHECK:STDOUT: %require_complete: = require_complete_type @A.%T.as_type.loc9_24.2 (%T.as_type) [symbolic = %require_complete (constants.%require_complete.d5b)] // CHECK:STDOUT: -// CHECK:STDOUT: fn[%T.patt.loc11_6.1: %I.type.906](%t.param_patt: @A.%T.as_type.loc11_24.2 (%T.as_type)) { +// CHECK:STDOUT: fn[%T.patt.loc9_6.1: %I.type.906](%t.param_patt: @A.%T.as_type.loc9_24.2 (%T.as_type)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -947,39 +842,39 @@ fn B() { // CHECK:STDOUT: fn @B() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [concrete = constants.%A] -// CHECK:STDOUT: %.loc24_6.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc22_6.1: %empty_struct_type = struct_literal () // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc24_6.2: ref %C = temporary_storage -// CHECK:STDOUT: %.loc24_6.3: init %C = class_init (), %.loc24_6.2 [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc24_6.4: ref %C = temporary %.loc24_6.2, %.loc24_6.3 -// CHECK:STDOUT: %.loc24_8: ref %C = converted %.loc24_6.1, %.loc24_6.4 -// CHECK:STDOUT: %.loc24_12: %I.type.906 = converted constants.%C, [concrete = ] +// CHECK:STDOUT: %.loc22_6.2: ref %C = temporary_storage +// CHECK:STDOUT: %.loc22_6.3: init %C = class_init (), %.loc22_6.2 [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc22_6.4: ref %C = temporary %.loc22_6.2, %.loc22_6.3 +// CHECK:STDOUT: %.loc22_8: ref %C = converted %.loc22_6.1, %.loc22_6.4 +// CHECK:STDOUT: %.loc22_12: %I.type.906 = converted constants.%C, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.5ab3ec.2: type, imports.%Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62)) [from "core.carbon"] { -// CHECK:STDOUT: %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: generic fn @Convert(imports.%Core.import_ref.5ab3ec.2: type, imports.%Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62)) [from "toolchain/testing/min_prelude/convert.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.%T (%T.8b3); +// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type (%Self.as_type)]() -> @Convert.%Dest (%Dest); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @I(constants.%V, constants.%W) { -// CHECK:STDOUT: %V.loc5_13.2 => constants.%V -// CHECK:STDOUT: %V.patt.loc5_13.2 => constants.%V -// CHECK:STDOUT: %W.loc5_23.2 => constants.%W -// CHECK:STDOUT: %W.patt.loc5_23.2 => constants.%W +// CHECK:STDOUT: %V.loc3_13.2 => constants.%V +// CHECK:STDOUT: %V.patt.loc3_13.2 => constants.%V +// CHECK:STDOUT: %W.loc3_23.2 => constants.%W +// CHECK:STDOUT: %W.patt.loc3_23.2 => constants.%W // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @I(%V.loc5_13.2, %W.loc5_23.2) {} +// CHECK:STDOUT: specific @I(%V.loc3_13.2, %W.loc3_23.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @I(constants.%T.8b3, constants.%empty_tuple.type) { -// CHECK:STDOUT: %V.loc5_13.2 => constants.%T.8b3 -// CHECK:STDOUT: %V.patt.loc5_13.2 => constants.%T.8b3 -// CHECK:STDOUT: %W.loc5_23.2 => constants.%empty_tuple.type -// CHECK:STDOUT: %W.patt.loc5_23.2 => constants.%empty_tuple.type +// CHECK:STDOUT: %V.loc3_13.2 => constants.%T.8b3 +// CHECK:STDOUT: %V.patt.loc3_13.2 => constants.%T.8b3 +// CHECK:STDOUT: %W.loc3_23.2 => constants.%empty_tuple.type +// CHECK:STDOUT: %W.patt.loc3_23.2 => constants.%empty_tuple.type // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %I.type => constants.%I.type.bea @@ -987,68 +882,68 @@ fn B() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @impl(constants.%T.8b3) { -// CHECK:STDOUT: %T.loc9_14.2 => constants.%T.8b3 -// CHECK:STDOUT: %T.patt.loc9_14.2 => constants.%T.8b3 -// CHECK:STDOUT: %I.type.loc9_36.2 => constants.%I.type.bea +// CHECK:STDOUT: %T.loc7_14.2 => constants.%T.8b3 +// CHECK:STDOUT: %T.patt.loc7_14.2 => constants.%T.8b3 +// CHECK:STDOUT: %I.type.loc7_36.2 => constants.%I.type.bea // CHECK:STDOUT: %require_complete => constants.%require_complete.5ce // CHECK:STDOUT: %impl_witness => constants.%impl_witness.298 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @I(@impl.%T.loc9_14.2, constants.%empty_tuple.type) {} +// CHECK:STDOUT: specific @I(@impl.%T.loc7_14.2, constants.%empty_tuple.type) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @impl(%T.loc9_14.2) {} +// CHECK:STDOUT: specific @impl(%T.loc7_14.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @I(constants.%empty_struct_type, constants.%empty_struct_type) { -// CHECK:STDOUT: %V.loc5_13.2 => constants.%empty_struct_type -// CHECK:STDOUT: %V.patt.loc5_13.2 => constants.%empty_struct_type -// CHECK:STDOUT: %W.loc5_23.2 => constants.%empty_struct_type -// CHECK:STDOUT: %W.patt.loc5_23.2 => constants.%empty_struct_type +// CHECK:STDOUT: %V.loc3_13.2 => constants.%empty_struct_type +// CHECK:STDOUT: %V.patt.loc3_13.2 => constants.%empty_struct_type +// CHECK:STDOUT: %W.loc3_23.2 => constants.%empty_struct_type +// CHECK:STDOUT: %W.patt.loc3_23.2 => constants.%empty_struct_type // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @A(constants.%T.4b2) { -// CHECK:STDOUT: %T.loc11_6.2 => constants.%T.4b2 -// CHECK:STDOUT: %T.patt.loc11_6.2 => constants.%T.4b2 -// CHECK:STDOUT: %T.as_type.loc11_24.2 => constants.%T.as_type +// CHECK:STDOUT: %T.loc9_6.2 => constants.%T.4b2 +// CHECK:STDOUT: %T.patt.loc9_6.2 => constants.%T.4b2 +// CHECK:STDOUT: %T.as_type.loc9_24.2 => constants.%T.as_type // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @impl(constants.%empty_struct_type) { -// CHECK:STDOUT: %T.loc9_14.2 => constants.%empty_struct_type -// CHECK:STDOUT: %T.patt.loc9_14.2 => constants.%empty_struct_type -// CHECK:STDOUT: %I.type.loc9_36.2 => constants.%I.type.202 +// CHECK:STDOUT: %T.loc7_14.2 => constants.%empty_struct_type +// CHECK:STDOUT: %T.patt.loc7_14.2 => constants.%empty_struct_type +// CHECK:STDOUT: %I.type.loc7_36.2 => constants.%I.type.202 // CHECK:STDOUT: %require_complete => constants.%complete_type.3d9 // CHECK:STDOUT: %impl_witness => constants.%impl_witness.e3d // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @I(constants.%empty_struct_type, constants.%empty_tuple.type) { -// CHECK:STDOUT: %V.loc5_13.2 => constants.%empty_struct_type -// CHECK:STDOUT: %V.patt.loc5_13.2 => constants.%empty_struct_type -// CHECK:STDOUT: %W.loc5_23.2 => constants.%empty_tuple.type -// CHECK:STDOUT: %W.patt.loc5_23.2 => constants.%empty_tuple.type +// CHECK:STDOUT: %V.loc3_13.2 => constants.%empty_struct_type +// CHECK:STDOUT: %V.patt.loc3_13.2 => constants.%empty_struct_type +// CHECK:STDOUT: %W.loc3_23.2 => constants.%empty_tuple.type +// CHECK:STDOUT: %W.patt.loc3_23.2 => constants.%empty_tuple.type // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %I.type => constants.%I.type.202 // CHECK:STDOUT: %Self.2 => constants.%Self.770 // 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: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(%T) {} +// CHECK:STDOUT: specific @ImplicitAs(%Dest) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(@Convert.%T) {} +// CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Convert(constants.%T.8b3, constants.%Self.519) { -// CHECK:STDOUT: %T => constants.%T.8b3 +// CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self.519) { +// CHECK:STDOUT: %Dest => constants.%Dest // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.d62 // CHECK:STDOUT: %Self => constants.%Self.519 // CHECK:STDOUT: %Self.as_type => constants.%Self.as_type // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @ImplicitAs(constants.%I.type.906) { -// CHECK:STDOUT: %T => constants.%I.type.906 -// CHECK:STDOUT: %T.patt => constants.%I.type.906 +// CHECK:STDOUT: %Dest => constants.%I.type.906 +// CHECK:STDOUT: %Dest.patt => constants.%I.type.906 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.442 @@ -1090,9 +985,11 @@ fn B() { // CHECK:STDOUT: %C.val: %C.c74 = struct_value () [concrete] // CHECK:STDOUT: %C.83b: type = class_type @C, @C(%empty_struct_type, %empty_tuple.type) [concrete] // CHECK:STDOUT: %impl_witness.366: = impl_witness (), @impl(%empty_struct_type) [concrete] -// CHECK:STDOUT: %ImplicitAs.type.d62: type = facet_type <@ImplicitAs, @ImplicitAs(%T.8b3)> [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: %Convert.type.275: type = fn_type @Convert, @ImplicitAs(%T.8b3) [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] @@ -1108,15 +1005,15 @@ fn B() { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs -// CHECK:STDOUT: import Core//default +// CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import_ref.5ab3ec.1: 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.43d)] -// CHECK:STDOUT: %Core.Convert = import_ref Core//default, Convert, unloaded -// CHECK:STDOUT: %Core.import_ref.5ab3ec.2: type = import_ref Core//default, loc4_22, loaded [symbolic = @ImplicitAs.%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.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, loc5_32, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] +// CHECK:STDOUT: %Core.import_ref.5ab3ec.1: type = import_ref Core//prelude, loc12_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//prelude, inst65 [no loc], unloaded +// CHECK:STDOUT: %Core.import_ref.630: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = import_ref Core//prelude, loc14_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.43d)] +// CHECK:STDOUT: %Core.Convert = import_ref Core//prelude, Convert, unloaded +// CHECK:STDOUT: %Core.import_ref.5ab3ec.2: type = import_ref Core//prelude, loc12_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) = import_ref Core//prelude, inst65 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] +// CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//prelude, loc14_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -1130,38 +1027,38 @@ fn B() { // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {} // CHECK:STDOUT: %C.decl: %C.type = class_decl @C [concrete = constants.%C.generic] { -// CHECK:STDOUT: %V.patt.loc7_9.1: type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc7_9.2 (constants.%V.patt)] -// CHECK:STDOUT: %W.patt.loc7_19.1: type = symbolic_binding_pattern W, 1 [symbolic = %W.patt.loc7_19.2 (constants.%W.patt)] +// CHECK:STDOUT: %V.patt.loc5_9.1: type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc5_9.2 (constants.%V.patt)] +// CHECK:STDOUT: %W.patt.loc5_19.1: type = symbolic_binding_pattern W, 1 [symbolic = %W.patt.loc5_19.2 (constants.%W.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %V.loc7_9.1: type = bind_symbolic_name V, 0 [symbolic = %V.loc7_9.2 (constants.%V)] -// CHECK:STDOUT: %W.loc7_19.1: type = bind_symbolic_name W, 1 [symbolic = %W.loc7_19.2 (constants.%W)] +// CHECK:STDOUT: %V.loc5_9.1: type = bind_symbolic_name V, 0 [symbolic = %V.loc5_9.2 (constants.%V)] +// CHECK:STDOUT: %W.loc5_19.1: type = bind_symbolic_name W, 1 [symbolic = %W.loc5_19.2 (constants.%W)] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl [concrete] { -// CHECK:STDOUT: %T.patt.loc9_14.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_14.2 (constants.%T.patt.e01)] +// CHECK:STDOUT: %T.patt.loc7_14.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc7_14.2 (constants.%T.patt.e01)] // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc9_14.1 [symbolic = %T.loc9_14.2 (constants.%T.8b3)] -// CHECK:STDOUT: %.loc9_30: %empty_tuple.type = tuple_literal () -// CHECK:STDOUT: %.loc9_31: type = converted %.loc9_30, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %C.loc9_31.1: type = class_type @C, @C(constants.%T.8b3, constants.%empty_tuple.type) [symbolic = %C.loc9_31.2 (constants.%C.463)] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc7_14.1 [symbolic = %T.loc7_14.2 (constants.%T.8b3)] +// CHECK:STDOUT: %.loc7_30: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc7_31: type = converted %.loc7_30, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %C.loc7_31.1: type = class_type @C, @C(constants.%T.8b3, constants.%empty_tuple.type) [symbolic = %C.loc7_31.2 (constants.%C.463)] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] -// CHECK:STDOUT: %T.loc9_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc9_14.2 (constants.%T.8b3)] +// CHECK:STDOUT: %T.loc7_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc7_14.2 (constants.%T.8b3)] // CHECK:STDOUT: } // CHECK:STDOUT: %impl_witness: = impl_witness (), @impl(constants.%T.8b3) [symbolic = @impl.%impl_witness (constants.%impl_witness.1a1)] // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [concrete = constants.%A] { -// CHECK:STDOUT: %T.patt.loc11_6.1: %I.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_6.2 (constants.%T.patt.3ad)] -// CHECK:STDOUT: %t.patt: @A.%T.as_type.loc11_16.2 (%T.as_type) = binding_pattern t -// CHECK:STDOUT: %t.param_patt: @A.%T.as_type.loc11_16.2 (%T.as_type) = value_param_pattern %t.patt, call_param0 +// CHECK:STDOUT: %T.patt.loc9_6.1: %I.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_6.2 (constants.%T.patt.3ad)] +// CHECK:STDOUT: %t.patt: @A.%T.as_type.loc9_16.2 (%T.as_type) = binding_pattern t +// CHECK:STDOUT: %t.param_patt: @A.%T.as_type.loc9_16.2 (%T.as_type) = value_param_pattern %t.patt, call_param0 // CHECK:STDOUT: } { // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] -// CHECK:STDOUT: %T.loc11_6.1: %I.type = bind_symbolic_name T, 0 [symbolic = %T.loc11_6.2 (constants.%T.826)] -// CHECK:STDOUT: %t.param: @A.%T.as_type.loc11_16.2 (%T.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc11_16.1: type = splice_block %.loc11_16.2 [symbolic = %T.as_type.loc11_16.2 (constants.%T.as_type)] { -// CHECK:STDOUT: %T.ref: %I.type = name_ref T, %T.loc11_6.1 [symbolic = %T.loc11_6.2 (constants.%T.826)] -// CHECK:STDOUT: %T.as_type.loc11_16.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc11_16.2 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc11_16.2: type = converted %T.ref, %T.as_type.loc11_16.1 [symbolic = %T.as_type.loc11_16.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.loc9_6.1: %I.type = bind_symbolic_name T, 0 [symbolic = %T.loc9_6.2 (constants.%T.826)] +// CHECK:STDOUT: %t.param: @A.%T.as_type.loc9_16.2 (%T.as_type) = value_param call_param0 +// CHECK:STDOUT: %.loc9_16.1: type = splice_block %.loc9_16.2 [symbolic = %T.as_type.loc9_16.2 (constants.%T.as_type)] { +// CHECK:STDOUT: %T.ref: %I.type = name_ref T, %T.loc9_6.1 [symbolic = %T.loc9_6.2 (constants.%T.826)] +// CHECK:STDOUT: %T.as_type.loc9_16.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc9_16.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc9_16.2: type = converted %T.ref, %T.as_type.loc9_16.1 [symbolic = %T.as_type.loc9_16.2 (constants.%T.as_type)] // CHECK:STDOUT: } -// CHECK:STDOUT: %t: @A.%T.as_type.loc11_16.2 (%T.as_type) = bind_name t, %t.param +// CHECK:STDOUT: %t: @A.%T.as_type.loc9_16.2 (%T.as_type) = bind_name t, %t.param // CHECK:STDOUT: } // CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [concrete = constants.%B] {} {} // CHECK:STDOUT: } @@ -1174,14 +1071,14 @@ fn B() { // CHECK:STDOUT: witness = () // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(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: generic interface @ImplicitAs(imports.%Core.import_ref.5ab3ec.1: type) [from "toolchain/testing/min_prelude/convert.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(%T)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.d62)] +// 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(%T) [symbolic = %Convert.type (constants.%Convert.type.275)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.275)] // CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = struct_value () [symbolic = %Convert (constants.%Convert.42e)] // CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type.837)] // CHECK:STDOUT: %assoc0: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = assoc_entity element0, imports.%Core.import_ref.1c7 [symbolic = %assoc0 (constants.%assoc0.02f)] @@ -1194,25 +1091,25 @@ fn B() { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @impl(%T.loc9_14.1: type) { -// CHECK:STDOUT: %T.loc9_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc9_14.2 (constants.%T.8b3)] -// CHECK:STDOUT: %T.patt.loc9_14.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_14.2 (constants.%T.patt.e01)] -// CHECK:STDOUT: %C.loc9_31.2: type = class_type @C, @C(%T.loc9_14.2, constants.%empty_tuple.type) [symbolic = %C.loc9_31.2 (constants.%C.463)] -// CHECK:STDOUT: %impl_witness: = impl_witness (), @impl(%T.loc9_14.2) [symbolic = %impl_witness (constants.%impl_witness.1a1)] +// CHECK:STDOUT: generic impl @impl(%T.loc7_14.1: type) { +// CHECK:STDOUT: %T.loc7_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc7_14.2 (constants.%T.8b3)] +// CHECK:STDOUT: %T.patt.loc7_14.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc7_14.2 (constants.%T.patt.e01)] +// CHECK:STDOUT: %C.loc7_31.2: type = class_type @C, @C(%T.loc7_14.2, constants.%empty_tuple.type) [symbolic = %C.loc7_31.2 (constants.%C.463)] +// CHECK:STDOUT: %impl_witness: = impl_witness (), @impl(%T.loc7_14.2) [symbolic = %impl_witness (constants.%impl_witness.1a1)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: impl: %C.loc9_31.1 as %I.ref { +// CHECK:STDOUT: impl: %C.loc7_31.1 as %I.ref { // CHECK:STDOUT: !members: // CHECK:STDOUT: witness = file.%impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @C(%V.loc7_9.1: type, %W.loc7_19.1: type) { -// CHECK:STDOUT: %V.loc7_9.2: type = bind_symbolic_name V, 0 [symbolic = %V.loc7_9.2 (constants.%V)] -// CHECK:STDOUT: %V.patt.loc7_9.2: type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc7_9.2 (constants.%V.patt)] -// CHECK:STDOUT: %W.loc7_19.2: type = bind_symbolic_name W, 1 [symbolic = %W.loc7_19.2 (constants.%W)] -// CHECK:STDOUT: %W.patt.loc7_19.2: type = symbolic_binding_pattern W, 1 [symbolic = %W.patt.loc7_19.2 (constants.%W.patt)] +// CHECK:STDOUT: generic class @C(%V.loc5_9.1: type, %W.loc5_19.1: type) { +// CHECK:STDOUT: %V.loc5_9.2: type = bind_symbolic_name V, 0 [symbolic = %V.loc5_9.2 (constants.%V)] +// CHECK:STDOUT: %V.patt.loc5_9.2: type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc5_9.2 (constants.%V.patt)] +// CHECK:STDOUT: %W.loc5_19.2: type = bind_symbolic_name W, 1 [symbolic = %W.loc5_19.2 (constants.%W)] +// CHECK:STDOUT: %W.patt.loc5_19.2: type = symbolic_binding_pattern W, 1 [symbolic = %W.patt.loc5_19.2 (constants.%W.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -1225,15 +1122,15 @@ fn B() { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @A(%T.loc11_6.1: %I.type) { -// CHECK:STDOUT: %T.loc11_6.2: %I.type = bind_symbolic_name T, 0 [symbolic = %T.loc11_6.2 (constants.%T.826)] -// CHECK:STDOUT: %T.patt.loc11_6.2: %I.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_6.2 (constants.%T.patt.3ad)] -// CHECK:STDOUT: %T.as_type.loc11_16.2: type = facet_access_type %T.loc11_6.2 [symbolic = %T.as_type.loc11_16.2 (constants.%T.as_type)] +// CHECK:STDOUT: generic fn @A(%T.loc9_6.1: %I.type) { +// CHECK:STDOUT: %T.loc9_6.2: %I.type = bind_symbolic_name T, 0 [symbolic = %T.loc9_6.2 (constants.%T.826)] +// CHECK:STDOUT: %T.patt.loc9_6.2: %I.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_6.2 (constants.%T.patt.3ad)] +// CHECK:STDOUT: %T.as_type.loc9_16.2: type = facet_access_type %T.loc9_6.2 [symbolic = %T.as_type.loc9_16.2 (constants.%T.as_type)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type @A.%T.as_type.loc11_16.2 (%T.as_type) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type @A.%T.as_type.loc9_16.2 (%T.as_type) [symbolic = %require_complete (constants.%require_complete)] // CHECK:STDOUT: -// CHECK:STDOUT: fn[%T.patt.loc11_6.1: %I.type](%t.param_patt: @A.%T.as_type.loc11_16.2 (%T.as_type)) { +// CHECK:STDOUT: fn[%T.patt.loc9_6.1: %I.type](%t.param_patt: @A.%T.as_type.loc9_16.2 (%T.as_type)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -1242,103 +1139,103 @@ fn B() { // CHECK:STDOUT: fn @B() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [concrete = constants.%A] -// CHECK:STDOUT: %.loc24_6.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc22_6.1: %empty_struct_type = struct_literal () // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C.generic] -// CHECK:STDOUT: %.loc24_14: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %.loc24_18: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %.loc24_19.1: type = converted %.loc24_14, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %.loc24_19.2: type = converted %.loc24_18, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc22_14: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc22_18: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc22_19.1: type = converted %.loc22_14, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc22_19.2: type = converted %.loc22_18, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%empty_struct_type, constants.%empty_struct_type) [concrete = constants.%C.c74] -// CHECK:STDOUT: %.loc24_6.2: ref %C.c74 = temporary_storage -// CHECK:STDOUT: %.loc24_6.3: init %C.c74 = class_init (), %.loc24_6.2 [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc24_6.4: ref %C.c74 = temporary %.loc24_6.2, %.loc24_6.3 -// CHECK:STDOUT: %.loc24_8: ref %C.c74 = converted %.loc24_6.1, %.loc24_6.4 -// CHECK:STDOUT: %.loc24_20: %I.type = converted constants.%C.c74, [concrete = ] +// CHECK:STDOUT: %.loc22_6.2: ref %C.c74 = temporary_storage +// CHECK:STDOUT: %.loc22_6.3: init %C.c74 = class_init (), %.loc22_6.2 [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc22_6.4: ref %C.c74 = temporary %.loc22_6.2, %.loc22_6.3 +// CHECK:STDOUT: %.loc22_8: ref %C.c74 = converted %.loc22_6.1, %.loc22_6.4 +// CHECK:STDOUT: %.loc22_20: %I.type = converted constants.%C.c74, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.5ab3ec.2: type, imports.%Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62)) [from "core.carbon"] { -// CHECK:STDOUT: %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: generic fn @Convert(imports.%Core.import_ref.5ab3ec.2: type, imports.%Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62)) [from "toolchain/testing/min_prelude/convert.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.%T (%T.8b3); +// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type (%Self.as_type)]() -> @Convert.%Dest (%Dest); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @C(constants.%V, constants.%W) { -// CHECK:STDOUT: %V.loc7_9.2 => constants.%V -// CHECK:STDOUT: %V.patt.loc7_9.2 => constants.%V -// CHECK:STDOUT: %W.loc7_19.2 => constants.%W -// CHECK:STDOUT: %W.patt.loc7_19.2 => constants.%W +// CHECK:STDOUT: %V.loc5_9.2 => constants.%V +// CHECK:STDOUT: %V.patt.loc5_9.2 => constants.%V +// CHECK:STDOUT: %W.loc5_19.2 => constants.%W +// CHECK:STDOUT: %W.patt.loc5_19.2 => constants.%W // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @C(constants.%T.8b3, constants.%empty_tuple.type) { -// CHECK:STDOUT: %V.loc7_9.2 => constants.%T.8b3 -// CHECK:STDOUT: %V.patt.loc7_9.2 => constants.%T.8b3 -// CHECK:STDOUT: %W.loc7_19.2 => constants.%empty_tuple.type -// CHECK:STDOUT: %W.patt.loc7_19.2 => constants.%empty_tuple.type +// CHECK:STDOUT: %V.loc5_9.2 => constants.%T.8b3 +// CHECK:STDOUT: %V.patt.loc5_9.2 => constants.%T.8b3 +// CHECK:STDOUT: %W.loc5_19.2 => constants.%empty_tuple.type +// CHECK:STDOUT: %W.patt.loc5_19.2 => constants.%empty_tuple.type // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @impl(constants.%T.8b3) { -// CHECK:STDOUT: %T.loc9_14.2 => constants.%T.8b3 -// CHECK:STDOUT: %T.patt.loc9_14.2 => constants.%T.8b3 -// CHECK:STDOUT: %C.loc9_31.2 => constants.%C.463 +// CHECK:STDOUT: %T.loc7_14.2 => constants.%T.8b3 +// CHECK:STDOUT: %T.patt.loc7_14.2 => constants.%T.8b3 +// CHECK:STDOUT: %C.loc7_31.2 => constants.%C.463 // CHECK:STDOUT: %impl_witness => constants.%impl_witness.1a1 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C(@impl.%T.loc9_14.2, constants.%empty_tuple.type) {} +// CHECK:STDOUT: specific @C(@impl.%T.loc7_14.2, constants.%empty_tuple.type) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @impl(%T.loc9_14.2) {} +// CHECK:STDOUT: specific @impl(%T.loc7_14.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @A(constants.%T.826) { -// CHECK:STDOUT: %T.loc11_6.2 => constants.%T.826 -// CHECK:STDOUT: %T.patt.loc11_6.2 => constants.%T.826 -// CHECK:STDOUT: %T.as_type.loc11_16.2 => constants.%T.as_type +// CHECK:STDOUT: %T.loc9_6.2 => constants.%T.826 +// CHECK:STDOUT: %T.patt.loc9_6.2 => constants.%T.826 +// CHECK:STDOUT: %T.as_type.loc9_16.2 => constants.%T.as_type // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @C(constants.%empty_struct_type, constants.%empty_struct_type) { -// CHECK:STDOUT: %V.loc7_9.2 => constants.%empty_struct_type -// CHECK:STDOUT: %V.patt.loc7_9.2 => constants.%empty_struct_type -// CHECK:STDOUT: %W.loc7_19.2 => constants.%empty_struct_type -// CHECK:STDOUT: %W.patt.loc7_19.2 => constants.%empty_struct_type +// CHECK:STDOUT: %V.loc5_9.2 => constants.%empty_struct_type +// CHECK:STDOUT: %V.patt.loc5_9.2 => constants.%empty_struct_type +// CHECK:STDOUT: %W.loc5_19.2 => constants.%empty_struct_type +// CHECK:STDOUT: %W.patt.loc5_19.2 => constants.%empty_struct_type // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @impl(constants.%empty_struct_type) { -// CHECK:STDOUT: %T.loc9_14.2 => constants.%empty_struct_type -// CHECK:STDOUT: %T.patt.loc9_14.2 => constants.%empty_struct_type -// CHECK:STDOUT: %C.loc9_31.2 => constants.%C.83b +// CHECK:STDOUT: %T.loc7_14.2 => constants.%empty_struct_type +// CHECK:STDOUT: %T.patt.loc7_14.2 => constants.%empty_struct_type +// CHECK:STDOUT: %C.loc7_31.2 => constants.%C.83b // CHECK:STDOUT: %impl_witness => constants.%impl_witness.366 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @C(constants.%empty_struct_type, constants.%empty_tuple.type) { -// CHECK:STDOUT: %V.loc7_9.2 => constants.%empty_struct_type -// CHECK:STDOUT: %V.patt.loc7_9.2 => constants.%empty_struct_type -// CHECK:STDOUT: %W.loc7_19.2 => constants.%empty_tuple.type -// CHECK:STDOUT: %W.patt.loc7_19.2 => constants.%empty_tuple.type +// CHECK:STDOUT: %V.loc5_9.2 => constants.%empty_struct_type +// CHECK:STDOUT: %V.patt.loc5_9.2 => constants.%empty_struct_type +// CHECK:STDOUT: %W.loc5_19.2 => constants.%empty_tuple.type +// CHECK:STDOUT: %W.patt.loc5_19.2 => constants.%empty_tuple.type // 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: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(%T) {} +// CHECK:STDOUT: specific @ImplicitAs(%Dest) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(@Convert.%T) {} +// CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Convert(constants.%T.8b3, constants.%Self.519) { -// CHECK:STDOUT: %T => constants.%T.8b3 +// CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self.519) { +// CHECK:STDOUT: %Dest => constants.%Dest // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.d62 // CHECK:STDOUT: %Self => constants.%Self.519 // CHECK:STDOUT: %Self.as_type => constants.%Self.as_type // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @ImplicitAs(constants.%I.type) { -// CHECK:STDOUT: %T => constants.%I.type -// CHECK:STDOUT: %T.patt => constants.%I.type +// CHECK:STDOUT: %Dest => constants.%I.type +// CHECK:STDOUT: %Dest.patt => constants.%I.type // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.c42 @@ -1349,3 +1246,179 @@ fn B() { // CHECK:STDOUT: %assoc0 => constants.%assoc0.0e0 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: --- toolchain/testing/min_prelude/convert.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: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .As = %As.decl +// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %As.decl: %As.type.b51 = interface_decl @As [concrete = constants.%As.generic] { +// CHECK:STDOUT: %Dest.patt.loc8_14.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc8_14.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { +// CHECK:STDOUT: %Dest.patt.loc12_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc12_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(%Dest.loc8_14.1: type) { +// CHECK:STDOUT: %Dest.loc8_14.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc8_14.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest.loc8_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.loc8_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.loc9_35.2: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_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.loc9_20.1 (%Self.as_type.7f0) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @As.%Dest.loc8_14.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param call_param0 +// CHECK:STDOUT: %.loc9_20.1: type = splice_block %.loc9_20.3 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] { +// CHECK:STDOUT: %.loc9_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, %.loc9_20.2 [symbolic = %Self (constants.%Self.b4e)] +// CHECK:STDOUT: %Self.as_type.loc9_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: %.loc9_20.3: type = converted %Self.ref, %Self.as_type.loc9_20.2 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.1.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.1.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc9_35.1: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_35.2 (constants.%assoc0.ac5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc9_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc12_22.1: type) { +// CHECK:STDOUT: %Dest.loc12_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc12_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc12_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.loc12_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.loc14_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_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.loc14_20.1 (%Self.as_type.419) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc12_22.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param call_param0 +// CHECK:STDOUT: %.loc14_20.1: type = splice_block %.loc14_20.3 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] { +// CHECK:STDOUT: %.loc14_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, %.loc14_20.2 [symbolic = %Self (constants.%Self.0f3)] +// CHECK:STDOUT: %Self.as_type.loc14_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: %.loc14_20.3: type = converted %Self.ref, %Self.as_type.loc14_20.2 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.2.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.2.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc14_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_35.2 (constants.%assoc0.a50)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc14_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(@As.%Dest.loc8_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.loc9_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(@ImplicitAs.%Dest.loc12_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.loc14_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419)]() -> @Convert.2.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc8_14.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc8_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.loc9_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.loc8_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc12_22.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc12_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.loc14_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.loc12_22.2) {} +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_as_type_knows_original_type.carbon b/toolchain/check/testdata/facet/min_prelude/convert_facet_value_as_type_knows_original_type.carbon similarity index 68% rename from toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_as_type_knows_original_type.carbon rename to toolchain/check/testdata/facet/min_prelude/convert_facet_value_as_type_knows_original_type.carbon index cb46f8eb7007..74a09af175c9 100644 --- a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_as_type_knows_original_type.carbon +++ b/toolchain/check/testdata/facet/min_prelude/convert_facet_value_as_type_knows_original_type.carbon @@ -2,30 +2,19 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// INCLUDE-FILE: toolchain/testing/min_prelude/convert.carbon +// EXTRA-ARGS: --custom-core +// // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_as_type_knows_original_type.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/facet/min_prelude/convert_facet_value_as_type_knows_original_type.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_as_type_knows_original_type.carbon - -// --- core.carbon - -package Core; - -interface As(Dest:! type) { - fn Convert[self: Self]() -> Dest; -} - -interface ImplicitAs(Dest:! type) { - fn Convert[self: Self]() -> Dest; -} +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/facet/min_prelude/convert_facet_value_as_type_knows_original_type.carbon // --- explicit_as_type.carbon library "[[@TEST_NAME]]"; -import Core; - interface Eats {} interface Animal {} @@ -43,8 +32,6 @@ fn F() { library "[[@TEST_NAME]]"; -import Core; - interface Eats { fn Eat(); } @@ -71,182 +58,6 @@ fn F() { (({} as Goat) as (Goat as Animal)).Eat(); } -// 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: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .As = %As.decl -// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %As.decl: %As.type.b51 = interface_decl @As [concrete = constants.%As.generic] { -// CHECK:STDOUT: %Dest.patt.loc4_14.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc4_14.2 (constants.%Dest.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.loc4_14.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc4_14.2 (constants.%Dest)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { -// CHECK:STDOUT: %Dest.patt.loc8_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_22.2 (constants.%Dest.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.loc8_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_22.2 (constants.%Dest)] -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic interface @As(%Dest.loc4_14.1: type) { -// CHECK:STDOUT: %Dest.loc4_14.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc4_14.2 (constants.%Dest)] -// CHECK:STDOUT: %Dest.patt.loc4_14.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc4_14.2 (constants.%Dest.patt)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest.loc4_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.loc4_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.loc5_35.2: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc5_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.loc5_20.1 (%Self.as_type.7f0) = binding_pattern self -// CHECK:STDOUT: %self.param_patt: @Convert.1.%Self.as_type.loc5_20.1 (%Self.as_type.7f0) = value_param_pattern %self.patt, call_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, call_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @As.%Dest.loc4_14.1 [symbolic = %Dest (constants.%Dest)] -// CHECK:STDOUT: %self.param: @Convert.1.%Self.as_type.loc5_20.1 (%Self.as_type.7f0) = 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.7f0)] { -// CHECK:STDOUT: %.loc5_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, %.loc5_20.2 [symbolic = %Self (constants.%Self.b4e)] -// 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.7f0)] -// 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.7f0)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: @Convert.1.%Self.as_type.loc5_20.1 (%Self.as_type.7f0) = bind_name self, %self.param -// CHECK:STDOUT: %return.param: ref @Convert.1.%Dest (%Dest) = out_param call_param1 -// CHECK:STDOUT: %return: ref @Convert.1.%Dest (%Dest) = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %assoc0.loc5_35.1: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc5_35.2 (constants.%assoc0.ac5)] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .Dest = -// CHECK:STDOUT: .Convert = %assoc0.loc5_35.1 -// CHECK:STDOUT: witness = (%Convert.decl) -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc8_22.1: type) { -// CHECK:STDOUT: %Dest.loc8_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_22.2 (constants.%Dest)] -// CHECK:STDOUT: %Dest.patt.loc8_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_22.2 (constants.%Dest.patt)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc8_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.loc8_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.loc9_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_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.loc9_20.1 (%Self.as_type.419) = binding_pattern self -// CHECK:STDOUT: %self.param_patt: @Convert.2.%Self.as_type.loc9_20.1 (%Self.as_type.419) = value_param_pattern %self.patt, call_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, call_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc8_22.1 [symbolic = %Dest (constants.%Dest)] -// CHECK:STDOUT: %self.param: @Convert.2.%Self.as_type.loc9_20.1 (%Self.as_type.419) = value_param call_param0 -// CHECK:STDOUT: %.loc9_20.1: type = splice_block %.loc9_20.3 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.419)] { -// CHECK:STDOUT: %.loc9_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, %.loc9_20.2 [symbolic = %Self (constants.%Self.0f3)] -// CHECK:STDOUT: %Self.as_type.loc9_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.419)] -// CHECK:STDOUT: %.loc9_20.3: type = converted %Self.ref, %Self.as_type.loc9_20.2 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.419)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: @Convert.2.%Self.as_type.loc9_20.1 (%Self.as_type.419) = bind_name self, %self.param -// CHECK:STDOUT: %return.param: ref @Convert.2.%Dest (%Dest) = out_param call_param1 -// CHECK:STDOUT: %return: ref @Convert.2.%Dest (%Dest) = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %assoc0.loc9_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_35.2 (constants.%assoc0.a50)] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .Dest = -// CHECK:STDOUT: .Convert = %assoc0.loc9_35.1 -// CHECK:STDOUT: witness = (%Convert.decl) -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert.1(@As.%Dest.loc4_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.loc5_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type.7f0)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self.as_type.loc5_20.1 (%Self.as_type.7f0)]() -> @Convert.1.%Dest (%Dest); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert.2(@ImplicitAs.%Dest.loc8_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.loc9_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.419)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Convert.2.%Self.as_type.loc9_20.1 (%Self.as_type.419)]() -> @Convert.2.%Dest (%Dest); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @As(constants.%Dest) { -// CHECK:STDOUT: %Dest.loc4_14.2 => constants.%Dest -// CHECK:STDOUT: %Dest.patt.loc4_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.loc5_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.loc4_14.2) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { -// CHECK:STDOUT: %Dest.loc8_22.2 => constants.%Dest -// CHECK:STDOUT: %Dest.patt.loc8_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.loc9_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.loc8_22.2) {} -// CHECK:STDOUT: // CHECK:STDOUT: --- explicit_as_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -272,7 +83,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: import Core//default +// CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -293,17 +104,17 @@ fn F() { // CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] // CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %impl_witness.loc10: = impl_witness () [concrete = constants.%impl_witness] +// CHECK:STDOUT: %impl_witness.loc8: = impl_witness () [concrete = constants.%impl_witness] // CHECK:STDOUT: impl_decl @impl.b88 [concrete] {} { // CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] // CHECK:STDOUT: %Eats.ref: type = name_ref Eats, file.%Eats.decl [concrete = constants.%Eats.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %impl_witness.loc11: = impl_witness () [concrete = constants.%impl_witness] +// CHECK:STDOUT: %impl_witness.loc9: = impl_witness () [concrete = constants.%impl_witness] // CHECK:STDOUT: %Feed.decl: %Feed.type = fn_decl @Feed [concrete = constants.%Feed] { -// CHECK:STDOUT: %e.patt.loc13_9.1: %Eats.type = symbolic_binding_pattern e, 0 [symbolic = %e.patt.loc13_9.2 (constants.%e.patt)] +// CHECK:STDOUT: %e.patt.loc11_9.1: %Eats.type = symbolic_binding_pattern e, 0 [symbolic = %e.patt.loc11_9.2 (constants.%e.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %Eats.ref: type = name_ref Eats, file.%Eats.decl [concrete = constants.%Eats.type] -// CHECK:STDOUT: %e.loc13_9.1: %Eats.type = bind_symbolic_name e, 0 [symbolic = %e.loc13_9.2 (constants.%e)] +// CHECK:STDOUT: %e.loc11_9.1: %Eats.type = bind_symbolic_name e, 0 [symbolic = %e.loc11_9.2 (constants.%e)] // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: } @@ -326,12 +137,12 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.27e: %Goat.ref as %Animal.ref { // CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = file.%impl_witness.loc10 +// CHECK:STDOUT: witness = file.%impl_witness.loc8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.b88: %Goat.ref as %Eats.ref { // CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = file.%impl_witness.loc11 +// CHECK:STDOUT: witness = file.%impl_witness.loc9 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Goat { @@ -342,13 +153,13 @@ fn F() { // CHECK:STDOUT: .Self = constants.%Goat // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Feed(%e.loc13_9.1: %Eats.type) { -// CHECK:STDOUT: %e.loc13_9.2: %Eats.type = bind_symbolic_name e, 0 [symbolic = %e.loc13_9.2 (constants.%e)] -// CHECK:STDOUT: %e.patt.loc13_9.2: %Eats.type = symbolic_binding_pattern e, 0 [symbolic = %e.patt.loc13_9.2 (constants.%e.patt)] +// CHECK:STDOUT: generic fn @Feed(%e.loc11_9.1: %Eats.type) { +// CHECK:STDOUT: %e.loc11_9.2: %Eats.type = bind_symbolic_name e, 0 [symbolic = %e.loc11_9.2 (constants.%e)] +// CHECK:STDOUT: %e.patt.loc11_9.2: %Eats.type = symbolic_binding_pattern e, 0 [symbolic = %e.patt.loc11_9.2 (constants.%e.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: fn(%e.patt.loc13_9.1: %Eats.type) { +// CHECK:STDOUT: fn(%e.patt.loc11_9.1: %Eats.type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -360,24 +171,24 @@ fn F() { // CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] // CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] // CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness) [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %.loc16_14: %Animal.type = converted %Goat.ref, %Animal.facet [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %as_type: type = facet_access_type %.loc16_14 [concrete = constants.%Goat] -// CHECK:STDOUT: %.loc16_25: type = converted %.loc16_14, %as_type [concrete = constants.%Goat] +// CHECK:STDOUT: %.loc14_14: %Animal.type = converted %Goat.ref, %Animal.facet [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %as_type: type = facet_access_type %.loc14_14 [concrete = constants.%Goat] +// CHECK:STDOUT: %.loc14_25: type = converted %.loc14_14, %as_type [concrete = constants.%Goat] // CHECK:STDOUT: %Eats.facet: %Eats.type = facet_value constants.%Goat, (constants.%impl_witness) [concrete = constants.%Eats.facet] -// CHECK:STDOUT: %.loc16_32: %Eats.type = converted %.loc16_25, %Eats.facet [concrete = constants.%Eats.facet] +// CHECK:STDOUT: %.loc14_32: %Eats.type = converted %.loc14_25, %Eats.facet [concrete = constants.%Eats.facet] // CHECK:STDOUT: %Feed.specific_fn: = specific_function %Feed.ref, @Feed(constants.%Eats.facet) [concrete = constants.%Feed.specific_fn] // CHECK:STDOUT: %Feed.call: init %empty_tuple.type = call %Feed.specific_fn() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Feed(constants.%e) { -// CHECK:STDOUT: %e.loc13_9.2 => constants.%e -// CHECK:STDOUT: %e.patt.loc13_9.2 => constants.%e +// CHECK:STDOUT: %e.loc11_9.2 => constants.%e +// CHECK:STDOUT: %e.patt.loc11_9.2 => constants.%e // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Feed(constants.%Eats.facet) { -// CHECK:STDOUT: %e.loc13_9.2 => constants.%Eats.facet -// CHECK:STDOUT: %e.patt.loc13_9.2 => constants.%Eats.facet +// CHECK:STDOUT: %e.loc11_9.2 => constants.%Eats.facet +// CHECK:STDOUT: %e.patt.loc11_9.2 => constants.%Eats.facet // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } @@ -413,7 +224,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: import Core//default +// CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -453,7 +264,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.32f: %Self.ref as %Animal.ref { // CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = @Goat.%impl_witness.loc14 +// CHECK:STDOUT: witness = @Goat.%impl_witness.loc12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.626: %Self.ref as %Eats.ref { @@ -461,7 +272,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Eat = %Eat.decl -// CHECK:STDOUT: witness = @Goat.%impl_witness.loc15 +// CHECK:STDOUT: witness = @Goat.%impl_witness.loc13 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Goat { @@ -470,12 +281,12 @@ fn F() { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Goat [concrete = constants.%Goat] // CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %impl_witness.loc14: = impl_witness () [concrete = constants.%impl_witness.1bc] +// CHECK:STDOUT: %impl_witness.loc12: = impl_witness () [concrete = constants.%impl_witness.1bc] // CHECK:STDOUT: impl_decl @impl.626 [concrete] {} { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Goat [concrete = constants.%Goat] // CHECK:STDOUT: %Eats.ref: type = name_ref Eats, file.%Eats.decl [concrete = constants.%Eats.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %impl_witness.loc15: = impl_witness (@impl.626.%Eat.decl) [concrete = constants.%impl_witness.9a5] +// CHECK:STDOUT: %impl_witness.loc13: = impl_witness (@impl.626.%Eat.decl) [concrete = constants.%impl_witness.9a5] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -507,57 +318,57 @@ fn F() { // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %x.patt: %Goat = binding_pattern x // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc24_28.1: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %Goat.ref.loc24_33: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] -// CHECK:STDOUT: %.loc24_28.2: ref %Goat = temporary_storage -// CHECK:STDOUT: %.loc24_28.3: init %Goat = class_init (), %.loc24_28.2 [concrete = constants.%Goat.val] -// CHECK:STDOUT: %.loc24_28.4: ref %Goat = temporary %.loc24_28.2, %.loc24_28.3 -// CHECK:STDOUT: %.loc24_30: ref %Goat = converted %.loc24_28.1, %.loc24_28.4 -// CHECK:STDOUT: %.loc24_15.1: type = splice_block %.loc24_15.3 [concrete = constants.%Goat] { -// CHECK:STDOUT: %Goat.ref.loc24_10: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] -// CHECK:STDOUT: %Animal.ref.loc24: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: %Animal.facet.loc24: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness.1bc) [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %.loc24_15.2: %Animal.type = converted %Goat.ref.loc24_10, %Animal.facet.loc24 [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %as_type.loc24: type = facet_access_type %.loc24_15.2 [concrete = constants.%Goat] -// CHECK:STDOUT: %.loc24_15.3: type = converted %.loc24_15.2, %as_type.loc24 [concrete = constants.%Goat] +// CHECK:STDOUT: %.loc22_28.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %Goat.ref.loc22_33: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] +// CHECK:STDOUT: %.loc22_28.2: ref %Goat = temporary_storage +// CHECK:STDOUT: %.loc22_28.3: init %Goat = class_init (), %.loc22_28.2 [concrete = constants.%Goat.val] +// CHECK:STDOUT: %.loc22_28.4: ref %Goat = temporary %.loc22_28.2, %.loc22_28.3 +// CHECK:STDOUT: %.loc22_30: ref %Goat = converted %.loc22_28.1, %.loc22_28.4 +// CHECK:STDOUT: %.loc22_15.1: type = splice_block %.loc22_15.3 [concrete = constants.%Goat] { +// CHECK:STDOUT: %Goat.ref.loc22_10: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] +// CHECK:STDOUT: %Animal.ref.loc22: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: %Animal.facet.loc22: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness.1bc) [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %.loc22_15.2: %Animal.type = converted %Goat.ref.loc22_10, %Animal.facet.loc22 [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %as_type.loc22: type = facet_access_type %.loc22_15.2 [concrete = constants.%Goat] +// CHECK:STDOUT: %.loc22_15.3: type = converted %.loc22_15.2, %as_type.loc22 [concrete = constants.%Goat] // CHECK:STDOUT: } -// CHECK:STDOUT: %x: ref %Goat = bind_name x, %.loc24_30 -// CHECK:STDOUT: %x.ref.loc25: ref %Goat = name_ref x, %x -// CHECK:STDOUT: %Bleet.ref.loc25: %Bleet.type = name_ref Bleet, @Goat.%Bleet.decl [concrete = constants.%Bleet] -// CHECK:STDOUT: %Bleet.call.loc25: init %empty_tuple.type = call %Bleet.ref.loc25() -// CHECK:STDOUT: %x.ref.loc26: ref %Goat = name_ref x, %x -// CHECK:STDOUT: %Eat.ref.loc26: %Eats.assoc_type = name_ref Eat, @Eats.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc26: %.aa8 = impl_witness_access constants.%impl_witness.9a5, element0 [concrete = constants.%Eat.73e] -// CHECK:STDOUT: %Eat.call.loc26: init %empty_tuple.type = call %impl.elem0.loc26() -// CHECK:STDOUT: %.loc28_6.1: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %Goat.ref.loc28_11: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] -// CHECK:STDOUT: %.loc28_6.2: ref %Goat = temporary_storage -// CHECK:STDOUT: %.loc28_6.3: init %Goat = class_init (), %.loc28_6.2 [concrete = constants.%Goat.val] -// CHECK:STDOUT: %.loc28_6.4: ref %Goat = temporary %.loc28_6.2, %.loc28_6.3 -// CHECK:STDOUT: %.loc28_8: ref %Goat = converted %.loc28_6.1, %.loc28_6.4 -// CHECK:STDOUT: %Goat.ref.loc28_21: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] -// CHECK:STDOUT: %Animal.ref.loc28: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: %Animal.facet.loc28: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness.1bc) [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %.loc28_26: %Animal.type = converted %Goat.ref.loc28_21, %Animal.facet.loc28 [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %as_type.loc28: type = facet_access_type %.loc28_26 [concrete = constants.%Goat] -// CHECK:STDOUT: %.loc28_35: type = converted %.loc28_26, %as_type.loc28 [concrete = constants.%Goat] -// CHECK:STDOUT: %Bleet.ref.loc28: %Bleet.type = name_ref Bleet, @Goat.%Bleet.decl [concrete = constants.%Bleet] -// CHECK:STDOUT: %Bleet.call.loc28: init %empty_tuple.type = call %Bleet.ref.loc28() -// CHECK:STDOUT: %.loc29_6.1: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %Goat.ref.loc29_11: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] -// CHECK:STDOUT: %.loc29_6.2: ref %Goat = temporary_storage -// CHECK:STDOUT: %.loc29_6.3: init %Goat = class_init (), %.loc29_6.2 [concrete = constants.%Goat.val] -// CHECK:STDOUT: %.loc29_6.4: ref %Goat = temporary %.loc29_6.2, %.loc29_6.3 -// CHECK:STDOUT: %.loc29_8: ref %Goat = converted %.loc29_6.1, %.loc29_6.4 -// CHECK:STDOUT: %Goat.ref.loc29_21: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] -// CHECK:STDOUT: %Animal.ref.loc29: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: %Animal.facet.loc29: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness.1bc) [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %.loc29_26: %Animal.type = converted %Goat.ref.loc29_21, %Animal.facet.loc29 [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %as_type.loc29: type = facet_access_type %.loc29_26 [concrete = constants.%Goat] -// CHECK:STDOUT: %.loc29_35: type = converted %.loc29_26, %as_type.loc29 [concrete = constants.%Goat] -// CHECK:STDOUT: %Eat.ref.loc29: %Eats.assoc_type = name_ref Eat, @Eats.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc29: %.aa8 = impl_witness_access constants.%impl_witness.9a5, element0 [concrete = constants.%Eat.73e] -// CHECK:STDOUT: %Eat.call.loc29: init %empty_tuple.type = call %impl.elem0.loc29() +// CHECK:STDOUT: %x: ref %Goat = bind_name x, %.loc22_30 +// CHECK:STDOUT: %x.ref.loc23: ref %Goat = name_ref x, %x +// CHECK:STDOUT: %Bleet.ref.loc23: %Bleet.type = name_ref Bleet, @Goat.%Bleet.decl [concrete = constants.%Bleet] +// CHECK:STDOUT: %Bleet.call.loc23: init %empty_tuple.type = call %Bleet.ref.loc23() +// CHECK:STDOUT: %x.ref.loc24: ref %Goat = name_ref x, %x +// CHECK:STDOUT: %Eat.ref.loc24: %Eats.assoc_type = name_ref Eat, @Eats.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc24: %.aa8 = impl_witness_access constants.%impl_witness.9a5, element0 [concrete = constants.%Eat.73e] +// CHECK:STDOUT: %Eat.call.loc24: init %empty_tuple.type = call %impl.elem0.loc24() +// CHECK:STDOUT: %.loc26_6.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %Goat.ref.loc26_11: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] +// CHECK:STDOUT: %.loc26_6.2: ref %Goat = temporary_storage +// CHECK:STDOUT: %.loc26_6.3: init %Goat = class_init (), %.loc26_6.2 [concrete = constants.%Goat.val] +// CHECK:STDOUT: %.loc26_6.4: ref %Goat = temporary %.loc26_6.2, %.loc26_6.3 +// CHECK:STDOUT: %.loc26_8: ref %Goat = converted %.loc26_6.1, %.loc26_6.4 +// CHECK:STDOUT: %Goat.ref.loc26_21: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] +// CHECK:STDOUT: %Animal.ref.loc26: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: %Animal.facet.loc26: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness.1bc) [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %.loc26_26: %Animal.type = converted %Goat.ref.loc26_21, %Animal.facet.loc26 [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %as_type.loc26: type = facet_access_type %.loc26_26 [concrete = constants.%Goat] +// CHECK:STDOUT: %.loc26_35: type = converted %.loc26_26, %as_type.loc26 [concrete = constants.%Goat] +// CHECK:STDOUT: %Bleet.ref.loc26: %Bleet.type = name_ref Bleet, @Goat.%Bleet.decl [concrete = constants.%Bleet] +// CHECK:STDOUT: %Bleet.call.loc26: init %empty_tuple.type = call %Bleet.ref.loc26() +// CHECK:STDOUT: %.loc27_6.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %Goat.ref.loc27_11: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] +// CHECK:STDOUT: %.loc27_6.2: ref %Goat = temporary_storage +// CHECK:STDOUT: %.loc27_6.3: init %Goat = class_init (), %.loc27_6.2 [concrete = constants.%Goat.val] +// CHECK:STDOUT: %.loc27_6.4: ref %Goat = temporary %.loc27_6.2, %.loc27_6.3 +// CHECK:STDOUT: %.loc27_8: ref %Goat = converted %.loc27_6.1, %.loc27_6.4 +// CHECK:STDOUT: %Goat.ref.loc27_21: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] +// CHECK:STDOUT: %Animal.ref.loc27: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: %Animal.facet.loc27: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness.1bc) [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %.loc27_26: %Animal.type = converted %Goat.ref.loc27_21, %Animal.facet.loc27 [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %as_type.loc27: type = facet_access_type %.loc27_26 [concrete = constants.%Goat] +// CHECK:STDOUT: %.loc27_35: type = converted %.loc27_26, %as_type.loc27 [concrete = constants.%Goat] +// CHECK:STDOUT: %Eat.ref.loc27: %Eats.assoc_type = name_ref Eat, @Eats.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc27: %.aa8 = impl_witness_access constants.%impl_witness.9a5, element0 [concrete = constants.%Eat.73e] +// CHECK:STDOUT: %Eat.call.loc27: init %empty_tuple.type = call %impl.elem0.loc27() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -565,3 +376,179 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: specific @Eat.1(constants.%Eats.facet) {} // CHECK:STDOUT: +// CHECK:STDOUT: --- toolchain/testing/min_prelude/convert.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: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .As = %As.decl +// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %As.decl: %As.type.b51 = interface_decl @As [concrete = constants.%As.generic] { +// CHECK:STDOUT: %Dest.patt.loc8_14.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc8_14.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { +// CHECK:STDOUT: %Dest.patt.loc12_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc12_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(%Dest.loc8_14.1: type) { +// CHECK:STDOUT: %Dest.loc8_14.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc8_14.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest.loc8_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.loc8_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.loc9_35.2: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_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.loc9_20.1 (%Self.as_type.7f0) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @As.%Dest.loc8_14.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param call_param0 +// CHECK:STDOUT: %.loc9_20.1: type = splice_block %.loc9_20.3 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] { +// CHECK:STDOUT: %.loc9_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, %.loc9_20.2 [symbolic = %Self (constants.%Self.b4e)] +// CHECK:STDOUT: %Self.as_type.loc9_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: %.loc9_20.3: type = converted %Self.ref, %Self.as_type.loc9_20.2 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.1.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.1.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc9_35.1: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_35.2 (constants.%assoc0.ac5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc9_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc12_22.1: type) { +// CHECK:STDOUT: %Dest.loc12_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc12_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc12_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.loc12_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.loc14_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_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.loc14_20.1 (%Self.as_type.419) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc12_22.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param call_param0 +// CHECK:STDOUT: %.loc14_20.1: type = splice_block %.loc14_20.3 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] { +// CHECK:STDOUT: %.loc14_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, %.loc14_20.2 [symbolic = %Self (constants.%Self.0f3)] +// CHECK:STDOUT: %Self.as_type.loc14_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: %.loc14_20.3: type = converted %Self.ref, %Self.as_type.loc14_20.2 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.2.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.2.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc14_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_35.2 (constants.%assoc0.a50)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc14_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(@As.%Dest.loc8_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.loc9_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(@ImplicitAs.%Dest.loc12_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.loc14_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419)]() -> @Convert.2.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc8_14.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc8_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.loc9_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.loc8_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc12_22.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc12_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.loc14_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.loc12_22.2) {} +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtin_conversions/min_prelude/convert_facet_value_to_facet_value.carbon b/toolchain/check/testdata/facet/min_prelude/convert_facet_value_to_facet_value.carbon similarity index 99% rename from toolchain/check/testdata/builtin_conversions/min_prelude/convert_facet_value_to_facet_value.carbon rename to toolchain/check/testdata/facet/min_prelude/convert_facet_value_to_facet_value.carbon index 941ce9983ddb..135fbe7be280 100644 --- a/toolchain/check/testdata/builtin_conversions/min_prelude/convert_facet_value_to_facet_value.carbon +++ b/toolchain/check/testdata/facet/min_prelude/convert_facet_value_to_facet_value.carbon @@ -7,9 +7,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtin_conversions/min_prelude/convert_facet_value_to_facet_value.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/facet/min_prelude/convert_facet_value_to_facet_value.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtin_conversions/min_prelude/convert_facet_value_to_facet_value.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/facet/min_prelude/convert_facet_value_to_facet_value.carbon // --- convert_facet_value_to_facet_value.carbon library "[[@TEST_NAME]]"; diff --git a/toolchain/check/testdata/facet/min_prelude/convert_facet_value_to_itself.carbon b/toolchain/check/testdata/facet/min_prelude/convert_facet_value_to_itself.carbon new file mode 100644 index 000000000000..49ce768c313e --- /dev/null +++ b/toolchain/check/testdata/facet/min_prelude/convert_facet_value_to_itself.carbon @@ -0,0 +1,352 @@ +// 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 +// +// INCLUDE-FILE: toolchain/testing/min_prelude/convert.carbon +// EXTRA-ARGS: --custom-core +// +// AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/facet/min_prelude/convert_facet_value_to_itself.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/facet/min_prelude/convert_facet_value_to_itself.carbon + +interface Animal {} + +fn FeedAnimal(T:! Animal) {} + +fn HandleAnimal(T:! Animal) { FeedAnimal(T); } + +class Goat {} +impl Goat as Animal {} + +fn F() { + HandleAnimal(Goat); +} + +// CHECK:STDOUT: --- convert_facet_value_to_itself.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Animal.type: type = facet_type <@Animal> [concrete] +// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %T: %Animal.type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.patt: %Animal.type = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %FeedAnimal.type: type = fn_type @FeedAnimal [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %FeedAnimal: %FeedAnimal.type = struct_value () [concrete] +// CHECK:STDOUT: %HandleAnimal.type: type = fn_type @HandleAnimal [concrete] +// CHECK:STDOUT: %HandleAnimal: %HandleAnimal.type = struct_value () [concrete] +// CHECK:STDOUT: %FeedAnimal.specific_fn.ec8: = specific_function %FeedAnimal, @FeedAnimal(%T) [symbolic] +// CHECK:STDOUT: %Goat: type = class_type @Goat [concrete] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] +// CHECK:STDOUT: %impl_witness: = impl_witness () [concrete] +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value %Goat, (%impl_witness) [concrete] +// CHECK:STDOUT: %HandleAnimal.specific_fn: = specific_function %HandleAnimal, @HandleAnimal(%Animal.facet) [concrete] +// CHECK:STDOUT: %FeedAnimal.specific_fn.5d0: = specific_function %FeedAnimal, @FeedAnimal(%Animal.facet) [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// 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: .Animal = %Animal.decl +// CHECK:STDOUT: .FeedAnimal = %FeedAnimal.decl +// CHECK:STDOUT: .HandleAnimal = %HandleAnimal.decl +// CHECK:STDOUT: .Goat = %Goat.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Animal.decl: type = interface_decl @Animal [concrete = constants.%Animal.type] {} {} +// CHECK:STDOUT: %FeedAnimal.decl: %FeedAnimal.type = fn_decl @FeedAnimal [concrete = constants.%FeedAnimal] { +// CHECK:STDOUT: %T.patt.loc16_15.1: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc16_15.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: %T.loc16_15.1: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc16_15.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %HandleAnimal.decl: %HandleAnimal.type = fn_decl @HandleAnimal [concrete = constants.%HandleAnimal] { +// CHECK:STDOUT: %T.patt.loc18_17.1: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc18_17.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: %T.loc18_17.1: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc18_17.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Goat.decl: type = class_decl @Goat [concrete = constants.%Goat] {} {} +// CHECK:STDOUT: impl_decl @impl [concrete] {} { +// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] +// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness: = impl_witness () [concrete = constants.%impl_witness] +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @Animal { +// CHECK:STDOUT: %Self: %Animal.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: impl @impl: %Goat.ref as %Animal.ref { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = file.%impl_witness +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: class @Goat { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type] +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Goat +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @FeedAnimal(%T.loc16_15.1: %Animal.type) { +// CHECK:STDOUT: %T.loc16_15.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc16_15.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc16_15.2: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc16_15.2 (constants.%T.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%T.patt.loc16_15.1: %Animal.type) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @HandleAnimal(%T.loc18_17.1: %Animal.type) { +// CHECK:STDOUT: %T.loc18_17.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc18_17.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc18_17.2: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc18_17.2 (constants.%T.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %FeedAnimal.specific_fn.loc18_31.2: = specific_function constants.%FeedAnimal, @FeedAnimal(%T.loc18_17.2) [symbolic = %FeedAnimal.specific_fn.loc18_31.2 (constants.%FeedAnimal.specific_fn.ec8)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%T.patt.loc18_17.1: %Animal.type) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %FeedAnimal.ref: %FeedAnimal.type = name_ref FeedAnimal, file.%FeedAnimal.decl [concrete = constants.%FeedAnimal] +// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc18_17.1 [symbolic = %T.loc18_17.2 (constants.%T)] +// CHECK:STDOUT: %FeedAnimal.specific_fn.loc18_31.1: = specific_function %FeedAnimal.ref, @FeedAnimal(constants.%T) [symbolic = %FeedAnimal.specific_fn.loc18_31.2 (constants.%FeedAnimal.specific_fn.ec8)] +// CHECK:STDOUT: %FeedAnimal.call: init %empty_tuple.type = call %FeedAnimal.specific_fn.loc18_31.1() +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %HandleAnimal.ref: %HandleAnimal.type = name_ref HandleAnimal, file.%HandleAnimal.decl [concrete = constants.%HandleAnimal] +// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] +// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness) [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %.loc24: %Animal.type = converted %Goat.ref, %Animal.facet [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %HandleAnimal.specific_fn: = specific_function %HandleAnimal.ref, @HandleAnimal(constants.%Animal.facet) [concrete = constants.%HandleAnimal.specific_fn] +// CHECK:STDOUT: %HandleAnimal.call: init %empty_tuple.type = call %HandleAnimal.specific_fn() +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @FeedAnimal(constants.%T) { +// CHECK:STDOUT: %T.loc16_15.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc16_15.2 => constants.%T +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @HandleAnimal(constants.%T) { +// CHECK:STDOUT: %T.loc18_17.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc18_17.2 => constants.%T +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @FeedAnimal(@HandleAnimal.%T.loc18_17.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @HandleAnimal(constants.%Animal.facet) { +// CHECK:STDOUT: %T.loc18_17.2 => constants.%Animal.facet +// CHECK:STDOUT: %T.patt.loc18_17.2 => constants.%Animal.facet +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %FeedAnimal.specific_fn.loc18_31.2 => constants.%FeedAnimal.specific_fn.5d0 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @FeedAnimal(constants.%Animal.facet) { +// CHECK:STDOUT: %T.loc16_15.2 => constants.%Animal.facet +// CHECK:STDOUT: %T.patt.loc16_15.2 => constants.%Animal.facet +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- toolchain/testing/min_prelude/convert.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: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .As = %As.decl +// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %As.decl: %As.type.b51 = interface_decl @As [concrete = constants.%As.generic] { +// CHECK:STDOUT: %Dest.patt.loc8_14.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc8_14.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { +// CHECK:STDOUT: %Dest.patt.loc12_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc12_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(%Dest.loc8_14.1: type) { +// CHECK:STDOUT: %Dest.loc8_14.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc8_14.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest.loc8_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.loc8_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.loc9_35.2: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_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.loc9_20.1 (%Self.as_type.7f0) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @As.%Dest.loc8_14.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param call_param0 +// CHECK:STDOUT: %.loc9_20.1: type = splice_block %.loc9_20.3 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] { +// CHECK:STDOUT: %.loc9_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, %.loc9_20.2 [symbolic = %Self (constants.%Self.b4e)] +// CHECK:STDOUT: %Self.as_type.loc9_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: %.loc9_20.3: type = converted %Self.ref, %Self.as_type.loc9_20.2 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.1.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.1.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc9_35.1: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_35.2 (constants.%assoc0.ac5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc9_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc12_22.1: type) { +// CHECK:STDOUT: %Dest.loc12_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc12_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc12_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.loc12_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.loc14_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_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.loc14_20.1 (%Self.as_type.419) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc12_22.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param call_param0 +// CHECK:STDOUT: %.loc14_20.1: type = splice_block %.loc14_20.3 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] { +// CHECK:STDOUT: %.loc14_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, %.loc14_20.2 [symbolic = %Self (constants.%Self.0f3)] +// CHECK:STDOUT: %Self.as_type.loc14_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: %.loc14_20.3: type = converted %Self.ref, %Self.as_type.loc14_20.2 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.2.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.2.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc14_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_35.2 (constants.%assoc0.a50)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc14_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(@As.%Dest.loc8_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.loc9_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(@ImplicitAs.%Dest.loc12_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.loc14_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419)]() -> @Convert.2.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc8_14.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc8_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.loc9_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.loc8_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc12_22.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc12_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.loc14_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.loc12_22.2) {} +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtin_conversions/min_prelude/convert_facet_value_to_narrowed_facet_type.carbon b/toolchain/check/testdata/facet/min_prelude/convert_facet_value_to_narrowed_facet_type.carbon similarity index 99% rename from toolchain/check/testdata/builtin_conversions/min_prelude/convert_facet_value_to_narrowed_facet_type.carbon rename to toolchain/check/testdata/facet/min_prelude/convert_facet_value_to_narrowed_facet_type.carbon index d2105e4424a8..f4deda4f78ac 100644 --- a/toolchain/check/testdata/builtin_conversions/min_prelude/convert_facet_value_to_narrowed_facet_type.carbon +++ b/toolchain/check/testdata/facet/min_prelude/convert_facet_value_to_narrowed_facet_type.carbon @@ -7,9 +7,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtin_conversions/min_prelude/convert_facet_value_to_narrowed_facet_type.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/facet/min_prelude/convert_facet_value_to_narrowed_facet_type.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtin_conversions/min_prelude/convert_facet_value_to_narrowed_facet_type.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/facet/min_prelude/convert_facet_value_to_narrowed_facet_type.carbon // --- convert_to_narrowed_facet_type.carbon library "[[@TEST_NAME]]"; diff --git a/toolchain/check/testdata/facet/min_prelude/convert_facet_value_value_to_blanket_impl.carbon b/toolchain/check/testdata/facet/min_prelude/convert_facet_value_value_to_blanket_impl.carbon new file mode 100644 index 000000000000..5539e4b6664f --- /dev/null +++ b/toolchain/check/testdata/facet/min_prelude/convert_facet_value_value_to_blanket_impl.carbon @@ -0,0 +1,401 @@ +// 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 +// +// INCLUDE-FILE: toolchain/testing/min_prelude/convert.carbon +// EXTRA-ARGS: --custom-core +// +// AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/facet/min_prelude/convert_facet_value_value_to_blanket_impl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/facet/min_prelude/convert_facet_value_value_to_blanket_impl.carbon + +interface Eats {} +interface Animal {} + +impl forall [A:! Animal] A as Eats {} + +fn Feed[T:! Eats](e: T) {} + +fn HandleAnimal[T:! Animal](a: T) { Feed(a); } + +// CHECK:STDOUT: --- convert_facet_value_value_to_blanket_impl.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Eats.type: type = facet_type <@Eats> [concrete] +// 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: %A: %Animal.type = bind_symbolic_name A, 0 [symbolic] +// CHECK:STDOUT: %A.patt: %Animal.type = symbolic_binding_pattern A, 0 [symbolic] +// CHECK:STDOUT: %A.as_type: type = facet_access_type %A [symbolic] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %impl_witness.11010a.1: = impl_witness (), @impl(%A) [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.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.c75: = require_complete_type %T.as_type.27d [symbolic] +// CHECK:STDOUT: %T.fd4: %Animal.type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.patt.a9c: %Animal.type = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %T.as_type.2ad: type = facet_access_type %T.fd4 [symbolic] +// CHECK:STDOUT: %HandleAnimal.type: type = fn_type @HandleAnimal [concrete] +// CHECK:STDOUT: %HandleAnimal: %HandleAnimal.type = struct_value () [concrete] +// CHECK:STDOUT: %require_complete.234: = require_complete_type %T.as_type.2ad [symbolic] +// CHECK:STDOUT: %impl_witness.11010a.2: = impl_witness (), @impl(%T.fd4) [symbolic] +// CHECK:STDOUT: %Eats.facet: %Eats.type = facet_value %T.as_type.2ad, (%impl_witness.11010a.2) [symbolic] +// CHECK:STDOUT: %Feed.specific_fn: = specific_function %Feed, @Feed(%Eats.facet) [symbolic] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// 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: .Eats = %Eats.decl +// CHECK:STDOUT: .Animal = %Animal.decl +// CHECK:STDOUT: .Feed = %Feed.decl +// CHECK:STDOUT: .HandleAnimal = %HandleAnimal.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Eats.decl: type = interface_decl @Eats [concrete = constants.%Eats.type] {} {} +// CHECK:STDOUT: %Animal.decl: type = interface_decl @Animal [concrete = constants.%Animal.type] {} {} +// CHECK:STDOUT: impl_decl @impl [concrete] { +// CHECK:STDOUT: %A.patt.loc17_14.1: %Animal.type = symbolic_binding_pattern A, 0 [symbolic = %A.patt.loc17_14.2 (constants.%A.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %A.ref: %Animal.type = name_ref A, %A.loc17_14.1 [symbolic = %A.loc17_14.2 (constants.%A)] +// CHECK:STDOUT: %A.as_type.loc17_26.1: type = facet_access_type %A.ref [symbolic = %A.as_type.loc17_26.2 (constants.%A.as_type)] +// CHECK:STDOUT: %.loc17: type = converted %A.ref, %A.as_type.loc17_26.1 [symbolic = %A.as_type.loc17_26.2 (constants.%A.as_type)] +// CHECK:STDOUT: %Eats.ref: type = name_ref Eats, file.%Eats.decl [concrete = constants.%Eats.type] +// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: %A.loc17_14.1: %Animal.type = bind_symbolic_name A, 0 [symbolic = %A.loc17_14.2 (constants.%A)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness: = impl_witness (), @impl(constants.%A) [symbolic = @impl.%impl_witness (constants.%impl_witness.11010a.1)] +// CHECK:STDOUT: %Feed.decl: %Feed.type = fn_decl @Feed [concrete = constants.%Feed] { +// CHECK:STDOUT: %T.patt.loc19_9.1: %Eats.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc19_9.2 (constants.%T.patt.6be)] +// CHECK:STDOUT: %e.patt: @Feed.%T.as_type.loc19_22.2 (%T.as_type.27d) = binding_pattern e +// CHECK:STDOUT: %e.param_patt: @Feed.%T.as_type.loc19_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.loc19_9.1: %Eats.type = bind_symbolic_name T, 0 [symbolic = %T.loc19_9.2 (constants.%T.1b5)] +// CHECK:STDOUT: %e.param: @Feed.%T.as_type.loc19_22.2 (%T.as_type.27d) = value_param call_param0 +// CHECK:STDOUT: %.loc19_22.1: type = splice_block %.loc19_22.2 [symbolic = %T.as_type.loc19_22.2 (constants.%T.as_type.27d)] { +// CHECK:STDOUT: %T.ref: %Eats.type = name_ref T, %T.loc19_9.1 [symbolic = %T.loc19_9.2 (constants.%T.1b5)] +// CHECK:STDOUT: %T.as_type.loc19_22.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc19_22.2 (constants.%T.as_type.27d)] +// CHECK:STDOUT: %.loc19_22.2: type = converted %T.ref, %T.as_type.loc19_22.1 [symbolic = %T.as_type.loc19_22.2 (constants.%T.as_type.27d)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %e: @Feed.%T.as_type.loc19_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.loc21_17.1: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc21_17.2 (constants.%T.patt.a9c)] +// CHECK:STDOUT: %a.patt: @HandleAnimal.%T.as_type.loc21_32.2 (%T.as_type.2ad) = binding_pattern a +// CHECK:STDOUT: %a.param_patt: @HandleAnimal.%T.as_type.loc21_32.2 (%T.as_type.2ad) = value_param_pattern %a.patt, call_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: %T.loc21_17.1: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc21_17.2 (constants.%T.fd4)] +// CHECK:STDOUT: %a.param: @HandleAnimal.%T.as_type.loc21_32.2 (%T.as_type.2ad) = value_param call_param0 +// CHECK:STDOUT: %.loc21_32.1: type = splice_block %.loc21_32.2 [symbolic = %T.as_type.loc21_32.2 (constants.%T.as_type.2ad)] { +// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc21_17.1 [symbolic = %T.loc21_17.2 (constants.%T.fd4)] +// CHECK:STDOUT: %T.as_type.loc21_32.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc21_32.2 (constants.%T.as_type.2ad)] +// CHECK:STDOUT: %.loc21_32.2: type = converted %T.ref, %T.as_type.loc21_32.1 [symbolic = %T.as_type.loc21_32.2 (constants.%T.as_type.2ad)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: @HandleAnimal.%T.as_type.loc21_32.2 (%T.as_type.2ad) = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @Eats { +// CHECK:STDOUT: %Self: %Eats.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1b5] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: witness = () +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @Animal { +// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.fd4] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: witness = () +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl(%A.loc17_14.1: %Animal.type) { +// CHECK:STDOUT: %A.loc17_14.2: %Animal.type = bind_symbolic_name A, 0 [symbolic = %A.loc17_14.2 (constants.%A)] +// CHECK:STDOUT: %A.patt.loc17_14.2: %Animal.type = symbolic_binding_pattern A, 0 [symbolic = %A.patt.loc17_14.2 (constants.%A.patt)] +// CHECK:STDOUT: %A.as_type.loc17_26.2: type = facet_access_type %A.loc17_14.2 [symbolic = %A.as_type.loc17_26.2 (constants.%A.as_type)] +// CHECK:STDOUT: %impl_witness: = impl_witness (), @impl(%A.loc17_14.2) [symbolic = %impl_witness (constants.%impl_witness.11010a.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %.loc17 as %Eats.ref { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = file.%impl_witness +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Feed(%T.loc19_9.1: %Eats.type) { +// CHECK:STDOUT: %T.loc19_9.2: %Eats.type = bind_symbolic_name T, 0 [symbolic = %T.loc19_9.2 (constants.%T.1b5)] +// CHECK:STDOUT: %T.patt.loc19_9.2: %Eats.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc19_9.2 (constants.%T.patt.6be)] +// CHECK:STDOUT: %T.as_type.loc19_22.2: type = facet_access_type %T.loc19_9.2 [symbolic = %T.as_type.loc19_22.2 (constants.%T.as_type.27d)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Feed.%T.as_type.loc19_22.2 (%T.as_type.27d) [symbolic = %require_complete (constants.%require_complete.c75)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%T.patt.loc19_9.1: %Eats.type](%e.param_patt: @Feed.%T.as_type.loc19_22.2 (%T.as_type.27d)) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @HandleAnimal(%T.loc21_17.1: %Animal.type) { +// CHECK:STDOUT: %T.loc21_17.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc21_17.2 (constants.%T.fd4)] +// CHECK:STDOUT: %T.patt.loc21_17.2: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc21_17.2 (constants.%T.patt.a9c)] +// CHECK:STDOUT: %T.as_type.loc21_32.2: type = facet_access_type %T.loc21_17.2 [symbolic = %T.as_type.loc21_32.2 (constants.%T.as_type.2ad)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @HandleAnimal.%T.as_type.loc21_32.2 (%T.as_type.2ad) [symbolic = %require_complete (constants.%require_complete.234)] +// CHECK:STDOUT: %impl_witness: = impl_witness (), @impl(%T.loc21_17.2) [symbolic = %impl_witness (constants.%impl_witness.11010a.2)] +// CHECK:STDOUT: %Eats.facet.loc21_43.3: %Eats.type = facet_value %T.as_type.loc21_32.2, (%impl_witness) [symbolic = %Eats.facet.loc21_43.3 (constants.%Eats.facet)] +// CHECK:STDOUT: %Feed.specific_fn.loc21_37.2: = specific_function constants.%Feed, @Feed(%Eats.facet.loc21_43.3) [symbolic = %Feed.specific_fn.loc21_37.2 (constants.%Feed.specific_fn)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%T.patt.loc21_17.1: %Animal.type](%a.param_patt: @HandleAnimal.%T.as_type.loc21_32.2 (%T.as_type.2ad)) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Feed.ref: %Feed.type = name_ref Feed, file.%Feed.decl [concrete = constants.%Feed] +// CHECK:STDOUT: %a.ref: @HandleAnimal.%T.as_type.loc21_32.2 (%T.as_type.2ad) = name_ref a, %a +// CHECK:STDOUT: %.loc21_43.1: %Animal.type = converted constants.%T.as_type.2ad, constants.%T.fd4 [symbolic = %T.loc21_17.2 (constants.%T.fd4)] +// CHECK:STDOUT: %Eats.facet.loc21_43.1: %Eats.type = facet_value constants.%T.as_type.2ad, (constants.%impl_witness.11010a.2) [symbolic = %Eats.facet.loc21_43.3 (constants.%Eats.facet)] +// CHECK:STDOUT: %.loc21_43.2: %Eats.type = converted constants.%T.as_type.2ad, %Eats.facet.loc21_43.1 [symbolic = %Eats.facet.loc21_43.3 (constants.%Eats.facet)] +// CHECK:STDOUT: %.loc21_43.3: %Animal.type = converted constants.%T.as_type.2ad, constants.%T.fd4 [symbolic = %T.loc21_17.2 (constants.%T.fd4)] +// CHECK:STDOUT: %Eats.facet.loc21_43.2: %Eats.type = facet_value constants.%T.as_type.2ad, (constants.%impl_witness.11010a.2) [symbolic = %Eats.facet.loc21_43.3 (constants.%Eats.facet)] +// CHECK:STDOUT: %.loc21_43.4: %Eats.type = converted constants.%T.as_type.2ad, %Eats.facet.loc21_43.2 [symbolic = %Eats.facet.loc21_43.3 (constants.%Eats.facet)] +// CHECK:STDOUT: %Feed.specific_fn.loc21_37.1: = specific_function %Feed.ref, @Feed(constants.%Eats.facet) [symbolic = %Feed.specific_fn.loc21_37.2 (constants.%Feed.specific_fn)] +// CHECK:STDOUT: %Feed.call: init %empty_tuple.type = call %Feed.specific_fn.loc21_37.1(%a.ref) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl(constants.%A) { +// CHECK:STDOUT: %A.loc17_14.2 => constants.%A +// CHECK:STDOUT: %A.patt.loc17_14.2 => constants.%A +// CHECK:STDOUT: %A.as_type.loc17_26.2 => constants.%A.as_type +// CHECK:STDOUT: %impl_witness => constants.%impl_witness.11010a.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl(%A.loc17_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Feed(constants.%T.1b5) { +// CHECK:STDOUT: %T.loc19_9.2 => constants.%T.1b5 +// CHECK:STDOUT: %T.patt.loc19_9.2 => constants.%T.1b5 +// CHECK:STDOUT: %T.as_type.loc19_22.2 => constants.%T.as_type.27d +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @HandleAnimal(constants.%T.fd4) { +// CHECK:STDOUT: %T.loc21_17.2 => constants.%T.fd4 +// CHECK:STDOUT: %T.patt.loc21_17.2 => constants.%T.fd4 +// CHECK:STDOUT: %T.as_type.loc21_32.2 => constants.%T.as_type.2ad +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl(constants.%T.fd4) { +// CHECK:STDOUT: %A.loc17_14.2 => constants.%T.fd4 +// CHECK:STDOUT: %A.patt.loc17_14.2 => constants.%T.fd4 +// CHECK:STDOUT: %A.as_type.loc17_26.2 => constants.%T.as_type.2ad +// CHECK:STDOUT: %impl_witness => constants.%impl_witness.11010a.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Feed(constants.%Eats.facet) { +// CHECK:STDOUT: %T.loc19_9.2 => constants.%Eats.facet +// CHECK:STDOUT: %T.patt.loc19_9.2 => constants.%Eats.facet +// CHECK:STDOUT: %T.as_type.loc19_22.2 => constants.%T.as_type.2ad +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%require_complete.234 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl(@HandleAnimal.%T.loc21_17.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Feed(@HandleAnimal.%Eats.facet.loc21_43.3) {} +// CHECK:STDOUT: +// CHECK:STDOUT: --- toolchain/testing/min_prelude/convert.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: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .As = %As.decl +// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %As.decl: %As.type.b51 = interface_decl @As [concrete = constants.%As.generic] { +// CHECK:STDOUT: %Dest.patt.loc8_14.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc8_14.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { +// CHECK:STDOUT: %Dest.patt.loc12_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc12_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(%Dest.loc8_14.1: type) { +// CHECK:STDOUT: %Dest.loc8_14.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc8_14.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest.loc8_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.loc8_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.loc9_35.2: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_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.loc9_20.1 (%Self.as_type.7f0) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @As.%Dest.loc8_14.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param call_param0 +// CHECK:STDOUT: %.loc9_20.1: type = splice_block %.loc9_20.3 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] { +// CHECK:STDOUT: %.loc9_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, %.loc9_20.2 [symbolic = %Self (constants.%Self.b4e)] +// CHECK:STDOUT: %Self.as_type.loc9_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: %.loc9_20.3: type = converted %Self.ref, %Self.as_type.loc9_20.2 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.1.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.1.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc9_35.1: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_35.2 (constants.%assoc0.ac5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc9_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc12_22.1: type) { +// CHECK:STDOUT: %Dest.loc12_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc12_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc12_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.loc12_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.loc14_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_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.loc14_20.1 (%Self.as_type.419) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc12_22.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param call_param0 +// CHECK:STDOUT: %.loc14_20.1: type = splice_block %.loc14_20.3 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] { +// CHECK:STDOUT: %.loc14_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, %.loc14_20.2 [symbolic = %Self (constants.%Self.0f3)] +// CHECK:STDOUT: %Self.as_type.loc14_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: %.loc14_20.3: type = converted %Self.ref, %Self.as_type.loc14_20.2 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.2.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.2.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc14_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_35.2 (constants.%assoc0.a50)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc14_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(@As.%Dest.loc8_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.loc9_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(@ImplicitAs.%Dest.loc12_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.loc14_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419)]() -> @Convert.2.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc8_14.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc8_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.loc9_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.loc8_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc12_22.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc12_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.loc14_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.loc12_22.2) {} +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/facet/min_prelude/convert_facet_value_value_to_generic_facet_value_value.carbon b/toolchain/check/testdata/facet/min_prelude/convert_facet_value_value_to_generic_facet_value_value.carbon new file mode 100644 index 000000000000..e857ee91f4a1 --- /dev/null +++ b/toolchain/check/testdata/facet/min_prelude/convert_facet_value_value_to_generic_facet_value_value.carbon @@ -0,0 +1,701 @@ +// 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 +// +// INCLUDE-FILE: toolchain/testing/min_prelude/convert.carbon +// EXTRA-ARGS: --custom-core +// +// AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/facet/min_prelude/convert_facet_value_value_to_generic_facet_value_value.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/facet/min_prelude/convert_facet_value_value_to_generic_facet_value_value.carbon + +interface Edible {} + +class Grass {} +impl Grass as Edible {} + +interface Animal {} +interface Eats(Food:! type) {} + +// When answering a query "does Goat impl Animal", we must avoid trying to deduce +// parameters for this impl. Not only is doing so unnecessary, it would start a new +// "does Goat impl Animal" query, leading to a "cycle in impl lookup" error. +impl forall [T:! Animal, U:! Edible] T as Eats(U) {} + +class Goat {} +impl Goat as Animal {} + +fn Feed[Food:! Edible, T:! Eats(Food)](e: T, food: Food) {} +fn HandleAnimal[T:! Animal, Food:! Edible](a: T, food: Food) { Feed(a, food); } + +fn F() { + HandleAnimal({} as Goat, {} as Grass); +} + +// CHECK:STDOUT: --- convert_facet_value_value_to_generic_facet_value_value.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Edible.type: type = facet_type <@Edible> [concrete] +// CHECK:STDOUT: %Self.9af: %Edible.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Grass: type = class_type @Grass [concrete] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] +// CHECK:STDOUT: %complete_type.357: = complete_type_witness %empty_struct_type [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %impl_witness.1bc: = impl_witness () [concrete] +// CHECK:STDOUT: %Animal.type: type = facet_type <@Animal> [concrete] +// CHECK:STDOUT: %Self.fd4: %Animal.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Food.8b3: type = bind_symbolic_name Food, 0 [symbolic] +// CHECK:STDOUT: %Food.patt.e01: type = symbolic_binding_pattern Food, 0 [symbolic] +// CHECK:STDOUT: %Eats.type.ba2: type = generic_interface_type @Eats [concrete] +// CHECK:STDOUT: %Eats.generic: %Eats.type.ba2 = struct_value () [concrete] +// CHECK:STDOUT: %Eats.type.6c0: type = facet_type <@Eats, @Eats(%Food.8b3)> [symbolic] +// CHECK:STDOUT: %Self.4eb: %Eats.type.6c0 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %T.fd4: %Animal.type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.patt.a9c: %Animal.type = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %U: %Edible.type = bind_symbolic_name U, 1 [symbolic] +// CHECK:STDOUT: %U.patt: %Edible.type = symbolic_binding_pattern U, 1 [symbolic] +// CHECK:STDOUT: %T.as_type.2ad: type = facet_access_type %T.fd4 [symbolic] +// CHECK:STDOUT: %U.as_type: type = facet_access_type %U [symbolic] +// CHECK:STDOUT: %Eats.type.f54c3d.1: type = facet_type <@Eats, @Eats(%U.as_type)> [symbolic] +// CHECK:STDOUT: %require_complete.42532a.1: = require_complete_type %Eats.type.f54c3d.1 [symbolic] +// CHECK:STDOUT: %impl_witness.c7c36b.1: = impl_witness (), @impl.009(%T.fd4, %U) [symbolic] +// CHECK:STDOUT: %Goat: type = class_type @Goat [concrete] +// CHECK:STDOUT: %Food.9af: %Edible.type = bind_symbolic_name Food, 0 [symbolic] +// CHECK:STDOUT: %Food.patt.0b7: %Edible.type = symbolic_binding_pattern Food, 0 [symbolic] +// CHECK:STDOUT: %Food.as_type.952: type = facet_access_type %Food.9af [symbolic] +// CHECK:STDOUT: %Eats.type.b39: type = facet_type <@Eats, @Eats(%Food.as_type.952)> [symbolic] +// CHECK:STDOUT: %T.223: %Eats.type.b39 = bind_symbolic_name T, 1 [symbolic] +// CHECK:STDOUT: %T.patt.f09: %Eats.type.b39 = symbolic_binding_pattern T, 1 [symbolic] +// CHECK:STDOUT: %T.as_type.212: type = facet_access_type %T.223 [symbolic] +// CHECK:STDOUT: %Feed.type: type = fn_type @Feed [concrete] +// CHECK:STDOUT: %Feed: %Feed.type = struct_value () [concrete] +// CHECK:STDOUT: %require_complete.fe6: = require_complete_type %T.as_type.212 [symbolic] +// CHECK:STDOUT: %require_complete.005: = require_complete_type %Food.as_type.952 [symbolic] +// CHECK:STDOUT: %Food.5fe: %Edible.type = bind_symbolic_name Food, 1 [symbolic] +// CHECK:STDOUT: %Food.patt.551: %Edible.type = symbolic_binding_pattern Food, 1 [symbolic] +// CHECK:STDOUT: %Food.as_type.fae: type = facet_access_type %Food.5fe [symbolic] +// CHECK:STDOUT: %HandleAnimal.type: type = fn_type @HandleAnimal [concrete] +// CHECK:STDOUT: %HandleAnimal: %HandleAnimal.type = struct_value () [concrete] +// CHECK:STDOUT: %require_complete.234: = require_complete_type %T.as_type.2ad [symbolic] +// CHECK:STDOUT: %require_complete.444: = require_complete_type %Food.as_type.fae [symbolic] +// CHECK:STDOUT: %Eats.type.f54c3d.2: type = facet_type <@Eats, @Eats(%Food.as_type.fae)> [symbolic] +// CHECK:STDOUT: %require_complete.42532a.2: = require_complete_type %Eats.type.f54c3d.2 [symbolic] +// CHECK:STDOUT: %impl_witness.c7c36b.2: = impl_witness (), @impl.009(%T.fd4, %Food.5fe) [symbolic] +// CHECK:STDOUT: %Eats.facet.97e: %Eats.type.f54c3d.2 = facet_value %T.as_type.2ad, (%impl_witness.c7c36b.2) [symbolic] +// CHECK:STDOUT: %Feed.specific_fn.387: = specific_function %Feed, @Feed(%Food.5fe, %Eats.facet.97e) [symbolic] +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %Goat.val: %Goat = struct_value () [concrete] +// CHECK:STDOUT: %Grass.val: %Grass = struct_value () [concrete] +// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value %Goat, (%impl_witness.1bc) [concrete] +// CHECK:STDOUT: %Edible.facet: %Edible.type = facet_value %Grass, (%impl_witness.1bc) [concrete] +// CHECK:STDOUT: %HandleAnimal.specific_fn: = specific_function %HandleAnimal, @HandleAnimal(%Animal.facet, %Edible.facet) [concrete] +// CHECK:STDOUT: %Eats.type.1ae: type = facet_type <@Eats, @Eats(%Grass)> [concrete] +// CHECK:STDOUT: %complete_type.004: = complete_type_witness %Eats.type.1ae [concrete] +// CHECK:STDOUT: %impl_witness.4f1: = impl_witness (), @impl.009(%Animal.facet, %Edible.facet) [concrete] +// CHECK:STDOUT: %Eats.facet.fa6: %Eats.type.1ae = facet_value %Goat, (%impl_witness.4f1) [concrete] +// CHECK:STDOUT: %Feed.specific_fn.d82: = specific_function %Feed, @Feed(%Edible.facet, %Eats.facet.fa6) [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// 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: .Edible = %Edible.decl +// CHECK:STDOUT: .Grass = %Grass.decl +// CHECK:STDOUT: .Animal = %Animal.decl +// CHECK:STDOUT: .Eats = %Eats.decl +// CHECK:STDOUT: .Goat = %Goat.decl +// CHECK:STDOUT: .Feed = %Feed.decl +// CHECK:STDOUT: .HandleAnimal = %HandleAnimal.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Edible.decl: type = interface_decl @Edible [concrete = constants.%Edible.type] {} {} +// CHECK:STDOUT: %Grass.decl: type = class_decl @Grass [concrete = constants.%Grass] {} {} +// CHECK:STDOUT: impl_decl @impl.592 [concrete] {} { +// CHECK:STDOUT: %Grass.ref: type = name_ref Grass, file.%Grass.decl [concrete = constants.%Grass] +// CHECK:STDOUT: %Edible.ref: type = name_ref Edible, file.%Edible.decl [concrete = constants.%Edible.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness.loc17: = impl_witness () [concrete = constants.%impl_witness.1bc] +// CHECK:STDOUT: %Animal.decl: type = interface_decl @Animal [concrete = constants.%Animal.type] {} {} +// CHECK:STDOUT: %Eats.decl: %Eats.type.ba2 = interface_decl @Eats [concrete = constants.%Eats.generic] { +// CHECK:STDOUT: %Food.patt.loc20_16.1: type = symbolic_binding_pattern Food, 0 [symbolic = %Food.patt.loc20_16.2 (constants.%Food.patt.e01)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Food.loc20_16.1: type = bind_symbolic_name Food, 0 [symbolic = %Food.loc20_16.2 (constants.%Food.8b3)] +// CHECK:STDOUT: } +// CHECK:STDOUT: impl_decl @impl.009 [concrete] { +// CHECK:STDOUT: %T.patt.loc25_14.1: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc25_14.2 (constants.%T.patt.a9c)] +// CHECK:STDOUT: %U.patt.loc25_26.1: %Edible.type = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc25_26.2 (constants.%U.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc25_14.1 [symbolic = %T.loc25_14.2 (constants.%T.fd4)] +// CHECK:STDOUT: %T.as_type.loc25_38.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc25_38.2 (constants.%T.as_type.2ad)] +// CHECK:STDOUT: %.loc25_38: type = converted %T.ref, %T.as_type.loc25_38.1 [symbolic = %T.as_type.loc25_38.2 (constants.%T.as_type.2ad)] +// CHECK:STDOUT: %Eats.ref: %Eats.type.ba2 = name_ref Eats, file.%Eats.decl [concrete = constants.%Eats.generic] +// CHECK:STDOUT: %U.ref: %Edible.type = name_ref U, %U.loc25_26.1 [symbolic = %U.loc25_26.2 (constants.%U)] +// CHECK:STDOUT: %U.as_type.loc25_49.1: type = facet_access_type %U.ref [symbolic = %U.as_type.loc25_49.2 (constants.%U.as_type)] +// CHECK:STDOUT: %.loc25_49: type = converted %U.ref, %U.as_type.loc25_49.1 [symbolic = %U.as_type.loc25_49.2 (constants.%U.as_type)] +// CHECK:STDOUT: %Eats.type.loc25_49.1: type = facet_type <@Eats, @Eats(constants.%U.as_type)> [symbolic = %Eats.type.loc25_49.2 (constants.%Eats.type.f54c3d.1)] +// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: %T.loc25_14.1: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc25_14.2 (constants.%T.fd4)] +// CHECK:STDOUT: %Edible.ref: type = name_ref Edible, file.%Edible.decl [concrete = constants.%Edible.type] +// CHECK:STDOUT: %U.loc25_26.1: %Edible.type = bind_symbolic_name U, 1 [symbolic = %U.loc25_26.2 (constants.%U)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness.loc25: = impl_witness (), @impl.009(constants.%T.fd4, constants.%U) [symbolic = @impl.009.%impl_witness (constants.%impl_witness.c7c36b.1)] +// CHECK:STDOUT: %Goat.decl: type = class_decl @Goat [concrete = constants.%Goat] {} {} +// CHECK:STDOUT: impl_decl @impl.27e [concrete] {} { +// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] +// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness.loc28: = impl_witness () [concrete = constants.%impl_witness.1bc] +// CHECK:STDOUT: %Feed.decl: %Feed.type = fn_decl @Feed [concrete = constants.%Feed] { +// CHECK:STDOUT: %Food.patt.loc30_9.1: %Edible.type = symbolic_binding_pattern Food, 0 [symbolic = %Food.patt.loc30_9.2 (constants.%Food.patt.0b7)] +// CHECK:STDOUT: %T.patt.loc30_24.1: @Feed.%Eats.type.loc30_37.2 (%Eats.type.b39) = symbolic_binding_pattern T, 1 [symbolic = %T.patt.loc30_24.2 (constants.%T.patt.f09)] +// CHECK:STDOUT: %e.patt: @Feed.%T.as_type.loc30_43.2 (%T.as_type.212) = binding_pattern e +// CHECK:STDOUT: %e.param_patt: @Feed.%T.as_type.loc30_43.2 (%T.as_type.212) = value_param_pattern %e.patt, call_param0 +// CHECK:STDOUT: %food.patt: @Feed.%Food.as_type.loc30_37.2 (%Food.as_type.952) = binding_pattern food +// CHECK:STDOUT: %food.param_patt: @Feed.%Food.as_type.loc30_37.2 (%Food.as_type.952) = value_param_pattern %food.patt, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Edible.ref: type = name_ref Edible, file.%Edible.decl [concrete = constants.%Edible.type] +// CHECK:STDOUT: %Food.loc30_9.1: %Edible.type = bind_symbolic_name Food, 0 [symbolic = %Food.loc30_9.2 (constants.%Food.9af)] +// CHECK:STDOUT: %.loc30_37.1: type = splice_block %Eats.type.loc30_37.1 [symbolic = %Eats.type.loc30_37.2 (constants.%Eats.type.b39)] { +// CHECK:STDOUT: %Eats.ref: %Eats.type.ba2 = name_ref Eats, file.%Eats.decl [concrete = constants.%Eats.generic] +// CHECK:STDOUT: %Food.ref.loc30_33: %Edible.type = name_ref Food, %Food.loc30_9.1 [symbolic = %Food.loc30_9.2 (constants.%Food.9af)] +// CHECK:STDOUT: %Food.as_type.loc30_37.1: type = facet_access_type %Food.ref.loc30_33 [symbolic = %Food.as_type.loc30_37.2 (constants.%Food.as_type.952)] +// CHECK:STDOUT: %.loc30_37.2: type = converted %Food.ref.loc30_33, %Food.as_type.loc30_37.1 [symbolic = %Food.as_type.loc30_37.2 (constants.%Food.as_type.952)] +// CHECK:STDOUT: %Eats.type.loc30_37.1: type = facet_type <@Eats, @Eats(constants.%Food.as_type.952)> [symbolic = %Eats.type.loc30_37.2 (constants.%Eats.type.b39)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %T.loc30_24.1: @Feed.%Eats.type.loc30_37.2 (%Eats.type.b39) = bind_symbolic_name T, 1 [symbolic = %T.loc30_24.2 (constants.%T.223)] +// CHECK:STDOUT: %e.param: @Feed.%T.as_type.loc30_43.2 (%T.as_type.212) = value_param call_param0 +// CHECK:STDOUT: %.loc30_43.1: type = splice_block %.loc30_43.2 [symbolic = %T.as_type.loc30_43.2 (constants.%T.as_type.212)] { +// CHECK:STDOUT: %T.ref: @Feed.%Eats.type.loc30_37.2 (%Eats.type.b39) = name_ref T, %T.loc30_24.1 [symbolic = %T.loc30_24.2 (constants.%T.223)] +// CHECK:STDOUT: %T.as_type.loc30_43.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc30_43.2 (constants.%T.as_type.212)] +// CHECK:STDOUT: %.loc30_43.2: type = converted %T.ref, %T.as_type.loc30_43.1 [symbolic = %T.as_type.loc30_43.2 (constants.%T.as_type.212)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %e: @Feed.%T.as_type.loc30_43.2 (%T.as_type.212) = bind_name e, %e.param +// CHECK:STDOUT: %food.param: @Feed.%Food.as_type.loc30_37.2 (%Food.as_type.952) = value_param call_param1 +// CHECK:STDOUT: %.loc30_52.1: type = splice_block %.loc30_52.2 [symbolic = %Food.as_type.loc30_37.2 (constants.%Food.as_type.952)] { +// CHECK:STDOUT: %Food.ref.loc30_52: %Edible.type = name_ref Food, %Food.loc30_9.1 [symbolic = %Food.loc30_9.2 (constants.%Food.9af)] +// CHECK:STDOUT: %Food.as_type.loc30_52: type = facet_access_type %Food.ref.loc30_52 [symbolic = %Food.as_type.loc30_37.2 (constants.%Food.as_type.952)] +// CHECK:STDOUT: %.loc30_52.2: type = converted %Food.ref.loc30_52, %Food.as_type.loc30_52 [symbolic = %Food.as_type.loc30_37.2 (constants.%Food.as_type.952)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %food: @Feed.%Food.as_type.loc30_37.2 (%Food.as_type.952) = bind_name food, %food.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %HandleAnimal.decl: %HandleAnimal.type = fn_decl @HandleAnimal [concrete = constants.%HandleAnimal] { +// CHECK:STDOUT: %T.patt.loc31_17.1: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc31_17.2 (constants.%T.patt.a9c)] +// CHECK:STDOUT: %Food.patt.loc31_29.1: %Edible.type = symbolic_binding_pattern Food, 1 [symbolic = %Food.patt.loc31_29.2 (constants.%Food.patt.551)] +// CHECK:STDOUT: %a.patt: @HandleAnimal.%T.as_type.loc31_47.2 (%T.as_type.2ad) = binding_pattern a +// CHECK:STDOUT: %a.param_patt: @HandleAnimal.%T.as_type.loc31_47.2 (%T.as_type.2ad) = value_param_pattern %a.patt, call_param0 +// CHECK:STDOUT: %food.patt: @HandleAnimal.%Food.as_type.loc31_56.2 (%Food.as_type.fae) = binding_pattern food +// CHECK:STDOUT: %food.param_patt: @HandleAnimal.%Food.as_type.loc31_56.2 (%Food.as_type.fae) = value_param_pattern %food.patt, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: %T.loc31_17.1: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc31_17.2 (constants.%T.fd4)] +// CHECK:STDOUT: %Edible.ref: type = name_ref Edible, file.%Edible.decl [concrete = constants.%Edible.type] +// CHECK:STDOUT: %Food.loc31_29.1: %Edible.type = bind_symbolic_name Food, 1 [symbolic = %Food.loc31_29.2 (constants.%Food.5fe)] +// CHECK:STDOUT: %a.param: @HandleAnimal.%T.as_type.loc31_47.2 (%T.as_type.2ad) = value_param call_param0 +// CHECK:STDOUT: %.loc31_47.1: type = splice_block %.loc31_47.2 [symbolic = %T.as_type.loc31_47.2 (constants.%T.as_type.2ad)] { +// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc31_17.1 [symbolic = %T.loc31_17.2 (constants.%T.fd4)] +// CHECK:STDOUT: %T.as_type.loc31_47.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc31_47.2 (constants.%T.as_type.2ad)] +// CHECK:STDOUT: %.loc31_47.2: type = converted %T.ref, %T.as_type.loc31_47.1 [symbolic = %T.as_type.loc31_47.2 (constants.%T.as_type.2ad)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: @HandleAnimal.%T.as_type.loc31_47.2 (%T.as_type.2ad) = bind_name a, %a.param +// CHECK:STDOUT: %food.param: @HandleAnimal.%Food.as_type.loc31_56.2 (%Food.as_type.fae) = value_param call_param1 +// CHECK:STDOUT: %.loc31_56.1: type = splice_block %.loc31_56.2 [symbolic = %Food.as_type.loc31_56.2 (constants.%Food.as_type.fae)] { +// CHECK:STDOUT: %Food.ref: %Edible.type = name_ref Food, %Food.loc31_29.1 [symbolic = %Food.loc31_29.2 (constants.%Food.5fe)] +// CHECK:STDOUT: %Food.as_type.loc31_56.1: type = facet_access_type %Food.ref [symbolic = %Food.as_type.loc31_56.2 (constants.%Food.as_type.fae)] +// CHECK:STDOUT: %.loc31_56.2: type = converted %Food.ref, %Food.as_type.loc31_56.1 [symbolic = %Food.as_type.loc31_56.2 (constants.%Food.as_type.fae)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %food: @HandleAnimal.%Food.as_type.loc31_56.2 (%Food.as_type.fae) = bind_name food, %food.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @Edible { +// CHECK:STDOUT: %Self: %Edible.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.9af] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: witness = () +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @Animal { +// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.fd4] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: witness = () +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @Eats(%Food.loc20_16.1: type) { +// CHECK:STDOUT: %Food.loc20_16.2: type = bind_symbolic_name Food, 0 [symbolic = %Food.loc20_16.2 (constants.%Food.8b3)] +// CHECK:STDOUT: %Food.patt.loc20_16.2: type = symbolic_binding_pattern Food, 0 [symbolic = %Food.patt.loc20_16.2 (constants.%Food.patt.e01)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Eats.type: type = facet_type <@Eats, @Eats(%Food.loc20_16.2)> [symbolic = %Eats.type (constants.%Eats.type.6c0)] +// CHECK:STDOUT: %Self.2: %Eats.type.6c0 = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.4eb)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: %Self.1: @Eats.%Eats.type (%Eats.type.6c0) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.4eb)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: witness = () +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.592: %Grass.ref as %Edible.ref { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = file.%impl_witness.loc17 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.009(%T.loc25_14.1: %Animal.type, %U.loc25_26.1: %Edible.type) { +// CHECK:STDOUT: %T.loc25_14.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc25_14.2 (constants.%T.fd4)] +// CHECK:STDOUT: %T.patt.loc25_14.2: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc25_14.2 (constants.%T.patt.a9c)] +// CHECK:STDOUT: %U.loc25_26.2: %Edible.type = bind_symbolic_name U, 1 [symbolic = %U.loc25_26.2 (constants.%U)] +// CHECK:STDOUT: %U.patt.loc25_26.2: %Edible.type = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc25_26.2 (constants.%U.patt)] +// CHECK:STDOUT: %T.as_type.loc25_38.2: type = facet_access_type %T.loc25_14.2 [symbolic = %T.as_type.loc25_38.2 (constants.%T.as_type.2ad)] +// CHECK:STDOUT: %U.as_type.loc25_49.2: type = facet_access_type %U.loc25_26.2 [symbolic = %U.as_type.loc25_49.2 (constants.%U.as_type)] +// CHECK:STDOUT: %Eats.type.loc25_49.2: type = facet_type <@Eats, @Eats(%U.as_type.loc25_49.2)> [symbolic = %Eats.type.loc25_49.2 (constants.%Eats.type.f54c3d.1)] +// CHECK:STDOUT: %require_complete: = require_complete_type @impl.009.%Eats.type.loc25_49.2 (%Eats.type.f54c3d.1) [symbolic = %require_complete (constants.%require_complete.42532a.1)] +// CHECK:STDOUT: %impl_witness: = impl_witness (), @impl.009(%T.loc25_14.2, %U.loc25_26.2) [symbolic = %impl_witness (constants.%impl_witness.c7c36b.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %.loc25_38 as %Eats.type.loc25_49.1 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = file.%impl_witness.loc25 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.27e: %Goat.ref as %Animal.ref { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = file.%impl_witness.loc28 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: class @Grass { +// 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.%Grass +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: class @Goat { +// 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.%Goat +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Feed(%Food.loc30_9.1: %Edible.type, %T.loc30_24.1: @Feed.%Eats.type.loc30_37.2 (%Eats.type.b39)) { +// CHECK:STDOUT: %Food.loc30_9.2: %Edible.type = bind_symbolic_name Food, 0 [symbolic = %Food.loc30_9.2 (constants.%Food.9af)] +// CHECK:STDOUT: %Food.patt.loc30_9.2: %Edible.type = symbolic_binding_pattern Food, 0 [symbolic = %Food.patt.loc30_9.2 (constants.%Food.patt.0b7)] +// CHECK:STDOUT: %Food.as_type.loc30_37.2: type = facet_access_type %Food.loc30_9.2 [symbolic = %Food.as_type.loc30_37.2 (constants.%Food.as_type.952)] +// CHECK:STDOUT: %Eats.type.loc30_37.2: type = facet_type <@Eats, @Eats(%Food.as_type.loc30_37.2)> [symbolic = %Eats.type.loc30_37.2 (constants.%Eats.type.b39)] +// CHECK:STDOUT: %T.loc30_24.2: %Eats.type.b39 = bind_symbolic_name T, 1 [symbolic = %T.loc30_24.2 (constants.%T.223)] +// CHECK:STDOUT: %T.patt.loc30_24.2: %Eats.type.b39 = symbolic_binding_pattern T, 1 [symbolic = %T.patt.loc30_24.2 (constants.%T.patt.f09)] +// CHECK:STDOUT: %T.as_type.loc30_43.2: type = facet_access_type %T.loc30_24.2 [symbolic = %T.as_type.loc30_43.2 (constants.%T.as_type.212)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete.loc30_41: = require_complete_type @Feed.%T.as_type.loc30_43.2 (%T.as_type.212) [symbolic = %require_complete.loc30_41 (constants.%require_complete.fe6)] +// CHECK:STDOUT: %require_complete.loc30_50: = require_complete_type @Feed.%Food.as_type.loc30_37.2 (%Food.as_type.952) [symbolic = %require_complete.loc30_50 (constants.%require_complete.005)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%Food.patt.loc30_9.1: %Edible.type, %T.patt.loc30_24.1: @Feed.%Eats.type.loc30_37.2 (%Eats.type.b39)](%e.param_patt: @Feed.%T.as_type.loc30_43.2 (%T.as_type.212), %food.param_patt: @Feed.%Food.as_type.loc30_37.2 (%Food.as_type.952)) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @HandleAnimal(%T.loc31_17.1: %Animal.type, %Food.loc31_29.1: %Edible.type) { +// CHECK:STDOUT: %T.loc31_17.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc31_17.2 (constants.%T.fd4)] +// CHECK:STDOUT: %T.patt.loc31_17.2: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc31_17.2 (constants.%T.patt.a9c)] +// CHECK:STDOUT: %Food.loc31_29.2: %Edible.type = bind_symbolic_name Food, 1 [symbolic = %Food.loc31_29.2 (constants.%Food.5fe)] +// CHECK:STDOUT: %Food.patt.loc31_29.2: %Edible.type = symbolic_binding_pattern Food, 1 [symbolic = %Food.patt.loc31_29.2 (constants.%Food.patt.551)] +// CHECK:STDOUT: %T.as_type.loc31_47.2: type = facet_access_type %T.loc31_17.2 [symbolic = %T.as_type.loc31_47.2 (constants.%T.as_type.2ad)] +// CHECK:STDOUT: %Food.as_type.loc31_56.2: type = facet_access_type %Food.loc31_29.2 [symbolic = %Food.as_type.loc31_56.2 (constants.%Food.as_type.fae)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete.loc31_45: = require_complete_type @HandleAnimal.%T.as_type.loc31_47.2 (%T.as_type.2ad) [symbolic = %require_complete.loc31_45 (constants.%require_complete.234)] +// CHECK:STDOUT: %require_complete.loc31_54: = require_complete_type @HandleAnimal.%Food.as_type.loc31_56.2 (%Food.as_type.fae) [symbolic = %require_complete.loc31_54 (constants.%require_complete.444)] +// CHECK:STDOUT: %Eats.type: type = facet_type <@Eats, @Eats(%Food.as_type.loc31_56.2)> [symbolic = %Eats.type (constants.%Eats.type.f54c3d.2)] +// CHECK:STDOUT: %impl_witness: = impl_witness (), @impl.009(%T.loc31_17.2, %Food.loc31_29.2) [symbolic = %impl_witness (constants.%impl_witness.c7c36b.2)] +// CHECK:STDOUT: %Eats.facet.loc31_76.2: @HandleAnimal.%Eats.type (%Eats.type.f54c3d.2) = facet_value %T.as_type.loc31_47.2, (%impl_witness) [symbolic = %Eats.facet.loc31_76.2 (constants.%Eats.facet.97e)] +// CHECK:STDOUT: %Feed.specific_fn.loc31_64.2: = specific_function constants.%Feed, @Feed(%Food.loc31_29.2, %Eats.facet.loc31_76.2) [symbolic = %Feed.specific_fn.loc31_64.2 (constants.%Feed.specific_fn.387)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%T.patt.loc31_17.1: %Animal.type, %Food.patt.loc31_29.1: %Edible.type](%a.param_patt: @HandleAnimal.%T.as_type.loc31_47.2 (%T.as_type.2ad), %food.param_patt: @HandleAnimal.%Food.as_type.loc31_56.2 (%Food.as_type.fae)) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Feed.ref: %Feed.type = name_ref Feed, file.%Feed.decl [concrete = constants.%Feed] +// CHECK:STDOUT: %a.ref: @HandleAnimal.%T.as_type.loc31_47.2 (%T.as_type.2ad) = name_ref a, %a +// CHECK:STDOUT: %food.ref: @HandleAnimal.%Food.as_type.loc31_56.2 (%Food.as_type.fae) = name_ref food, %food +// CHECK:STDOUT: %.loc31_76.1: %Edible.type = converted constants.%Food.as_type.fae, constants.%Food.5fe [symbolic = %Food.loc31_29.2 (constants.%Food.5fe)] +// CHECK:STDOUT: %.loc31_76.2: %Edible.type = converted constants.%Food.as_type.fae, constants.%Food.5fe [symbolic = %Food.loc31_29.2 (constants.%Food.5fe)] +// CHECK:STDOUT: %.loc31_76.3: %Edible.type = converted constants.%Food.as_type.fae, constants.%Food.5fe [symbolic = %Food.loc31_29.2 (constants.%Food.5fe)] +// CHECK:STDOUT: %.loc31_76.4: %Animal.type = converted constants.%T.as_type.2ad, constants.%T.fd4 [symbolic = %T.loc31_17.2 (constants.%T.fd4)] +// CHECK:STDOUT: %Eats.facet.loc31_76.1: @HandleAnimal.%Eats.type (%Eats.type.f54c3d.2) = facet_value constants.%T.as_type.2ad, (constants.%impl_witness.c7c36b.2) [symbolic = %Eats.facet.loc31_76.2 (constants.%Eats.facet.97e)] +// CHECK:STDOUT: %.loc31_76.5: @HandleAnimal.%Eats.type (%Eats.type.f54c3d.2) = converted constants.%T.as_type.2ad, %Eats.facet.loc31_76.1 [symbolic = %Eats.facet.loc31_76.2 (constants.%Eats.facet.97e)] +// CHECK:STDOUT: %Feed.specific_fn.loc31_64.1: = specific_function %Feed.ref, @Feed(constants.%Food.5fe, constants.%Eats.facet.97e) [symbolic = %Feed.specific_fn.loc31_64.2 (constants.%Feed.specific_fn.387)] +// CHECK:STDOUT: %Feed.call: init %empty_tuple.type = call %Feed.specific_fn.loc31_64.1(%a.ref, %food.ref) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %HandleAnimal.ref: %HandleAnimal.type = name_ref HandleAnimal, file.%HandleAnimal.decl [concrete = constants.%HandleAnimal] +// CHECK:STDOUT: %.loc34_17.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] +// CHECK:STDOUT: %.loc34_17.2: ref %Goat = temporary_storage +// CHECK:STDOUT: %.loc34_17.3: init %Goat = class_init (), %.loc34_17.2 [concrete = constants.%Goat.val] +// CHECK:STDOUT: %.loc34_17.4: ref %Goat = temporary %.loc34_17.2, %.loc34_17.3 +// CHECK:STDOUT: %.loc34_19.1: ref %Goat = converted %.loc34_17.1, %.loc34_17.4 +// CHECK:STDOUT: %.loc34_29.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %Grass.ref: type = name_ref Grass, file.%Grass.decl [concrete = constants.%Grass] +// CHECK:STDOUT: %.loc34_29.2: ref %Grass = temporary_storage +// CHECK:STDOUT: %.loc34_29.3: init %Grass = class_init (), %.loc34_29.2 [concrete = constants.%Grass.val] +// CHECK:STDOUT: %.loc34_29.4: ref %Grass = temporary %.loc34_29.2, %.loc34_29.3 +// CHECK:STDOUT: %.loc34_31.1: ref %Grass = converted %.loc34_29.1, %.loc34_29.4 +// CHECK:STDOUT: %Animal.facet.loc34_39.1: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness.1bc) [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %.loc34_39.1: %Animal.type = converted constants.%Goat, %Animal.facet.loc34_39.1 [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %Animal.facet.loc34_39.2: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness.1bc) [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %.loc34_39.2: %Animal.type = converted constants.%Goat, %Animal.facet.loc34_39.2 [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %Edible.facet.loc34_39.1: %Edible.type = facet_value constants.%Grass, (constants.%impl_witness.1bc) [concrete = constants.%Edible.facet] +// CHECK:STDOUT: %.loc34_39.3: %Edible.type = converted constants.%Grass, %Edible.facet.loc34_39.1 [concrete = constants.%Edible.facet] +// CHECK:STDOUT: %Edible.facet.loc34_39.2: %Edible.type = facet_value constants.%Grass, (constants.%impl_witness.1bc) [concrete = constants.%Edible.facet] +// CHECK:STDOUT: %.loc34_39.4: %Edible.type = converted constants.%Grass, %Edible.facet.loc34_39.2 [concrete = constants.%Edible.facet] +// CHECK:STDOUT: %HandleAnimal.specific_fn: = specific_function %HandleAnimal.ref, @HandleAnimal(constants.%Animal.facet, constants.%Edible.facet) [concrete = constants.%HandleAnimal.specific_fn] +// CHECK:STDOUT: %.loc34_19.2: %Goat = bind_value %.loc34_19.1 +// CHECK:STDOUT: %.loc34_31.2: %Grass = bind_value %.loc34_31.1 +// CHECK:STDOUT: %HandleAnimal.call: init %empty_tuple.type = call %HandleAnimal.specific_fn(%.loc34_19.2, %.loc34_31.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Eats(constants.%Food.8b3) { +// CHECK:STDOUT: %Food.loc20_16.2 => constants.%Food.8b3 +// CHECK:STDOUT: %Food.patt.loc20_16.2 => constants.%Food.8b3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Eats(%Food.loc20_16.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Eats(constants.%U.as_type) { +// CHECK:STDOUT: %Food.loc20_16.2 => constants.%U.as_type +// CHECK:STDOUT: %Food.patt.loc20_16.2 => constants.%U.as_type +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Eats.type => constants.%Eats.type.f54c3d.1 +// CHECK:STDOUT: %Self.2 => constants.%Self.4eb +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.009(constants.%T.fd4, constants.%U) { +// CHECK:STDOUT: %T.loc25_14.2 => constants.%T.fd4 +// CHECK:STDOUT: %T.patt.loc25_14.2 => constants.%T.fd4 +// CHECK:STDOUT: %U.loc25_26.2 => constants.%U +// CHECK:STDOUT: %U.patt.loc25_26.2 => constants.%U +// CHECK:STDOUT: %T.as_type.loc25_38.2 => constants.%T.as_type.2ad +// CHECK:STDOUT: %U.as_type.loc25_49.2 => constants.%U.as_type +// CHECK:STDOUT: %Eats.type.loc25_49.2 => constants.%Eats.type.f54c3d.1 +// CHECK:STDOUT: %require_complete => constants.%require_complete.42532a.1 +// CHECK:STDOUT: %impl_witness => constants.%impl_witness.c7c36b.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Eats(@impl.009.%U.as_type.loc25_49.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.009(%T.loc25_14.2, %U.loc25_26.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Eats(constants.%Food.as_type.952) { +// CHECK:STDOUT: %Food.loc20_16.2 => constants.%Food.as_type.952 +// CHECK:STDOUT: %Food.patt.loc20_16.2 => constants.%Food.as_type.952 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Feed(constants.%Food.9af, constants.%T.223) { +// CHECK:STDOUT: %Food.loc30_9.2 => constants.%Food.9af +// CHECK:STDOUT: %Food.patt.loc30_9.2 => constants.%Food.9af +// CHECK:STDOUT: %Food.as_type.loc30_37.2 => constants.%Food.as_type.952 +// CHECK:STDOUT: %Eats.type.loc30_37.2 => constants.%Eats.type.b39 +// CHECK:STDOUT: %T.loc30_24.2 => constants.%T.223 +// CHECK:STDOUT: %T.patt.loc30_24.2 => constants.%T.223 +// CHECK:STDOUT: %T.as_type.loc30_43.2 => constants.%T.as_type.212 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Eats(@Feed.%Food.as_type.loc30_37.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @HandleAnimal(constants.%T.fd4, constants.%Food.5fe) { +// CHECK:STDOUT: %T.loc31_17.2 => constants.%T.fd4 +// CHECK:STDOUT: %T.patt.loc31_17.2 => constants.%T.fd4 +// CHECK:STDOUT: %Food.loc31_29.2 => constants.%Food.5fe +// CHECK:STDOUT: %Food.patt.loc31_29.2 => constants.%Food.5fe +// CHECK:STDOUT: %T.as_type.loc31_47.2 => constants.%T.as_type.2ad +// CHECK:STDOUT: %Food.as_type.loc31_56.2 => constants.%Food.as_type.fae +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Eats(constants.%Food.as_type.fae) { +// CHECK:STDOUT: %Food.loc20_16.2 => constants.%Food.as_type.fae +// CHECK:STDOUT: %Food.patt.loc20_16.2 => constants.%Food.as_type.fae +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.009(constants.%T.fd4, constants.%Food.5fe) { +// CHECK:STDOUT: %T.loc25_14.2 => constants.%T.fd4 +// CHECK:STDOUT: %T.patt.loc25_14.2 => constants.%T.fd4 +// CHECK:STDOUT: %U.loc25_26.2 => constants.%Food.5fe +// CHECK:STDOUT: %U.patt.loc25_26.2 => constants.%Food.5fe +// CHECK:STDOUT: %T.as_type.loc25_38.2 => constants.%T.as_type.2ad +// CHECK:STDOUT: %U.as_type.loc25_49.2 => constants.%Food.as_type.fae +// CHECK:STDOUT: %Eats.type.loc25_49.2 => constants.%Eats.type.f54c3d.2 +// CHECK:STDOUT: %require_complete => constants.%require_complete.42532a.2 +// CHECK:STDOUT: %impl_witness => constants.%impl_witness.c7c36b.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Feed(constants.%Food.5fe, constants.%Eats.facet.97e) { +// CHECK:STDOUT: %Food.loc30_9.2 => constants.%Food.5fe +// CHECK:STDOUT: %Food.patt.loc30_9.2 => constants.%Food.5fe +// CHECK:STDOUT: %Food.as_type.loc30_37.2 => constants.%Food.as_type.fae +// CHECK:STDOUT: %Eats.type.loc30_37.2 => constants.%Eats.type.f54c3d.2 +// CHECK:STDOUT: %T.loc30_24.2 => constants.%Eats.facet.97e +// CHECK:STDOUT: %T.patt.loc30_24.2 => constants.%Eats.facet.97e +// CHECK:STDOUT: %T.as_type.loc30_43.2 => constants.%T.as_type.2ad +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete.loc30_41 => constants.%require_complete.234 +// CHECK:STDOUT: %require_complete.loc30_50 => constants.%require_complete.444 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Eats(@HandleAnimal.%Food.as_type.loc31_56.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.009(@HandleAnimal.%T.loc31_17.2, @HandleAnimal.%Food.loc31_29.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Feed(@HandleAnimal.%Food.loc31_29.2, @HandleAnimal.%Eats.facet.loc31_76.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @HandleAnimal(constants.%Animal.facet, constants.%Edible.facet) { +// CHECK:STDOUT: %T.loc31_17.2 => constants.%Animal.facet +// CHECK:STDOUT: %T.patt.loc31_17.2 => constants.%Animal.facet +// CHECK:STDOUT: %Food.loc31_29.2 => constants.%Edible.facet +// CHECK:STDOUT: %Food.patt.loc31_29.2 => constants.%Edible.facet +// CHECK:STDOUT: %T.as_type.loc31_47.2 => constants.%Goat +// CHECK:STDOUT: %Food.as_type.loc31_56.2 => constants.%Grass +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete.loc31_45 => constants.%complete_type.357 +// CHECK:STDOUT: %require_complete.loc31_54 => constants.%complete_type.357 +// CHECK:STDOUT: %Eats.type => constants.%Eats.type.1ae +// CHECK:STDOUT: %impl_witness => constants.%impl_witness.4f1 +// CHECK:STDOUT: %Eats.facet.loc31_76.2 => constants.%Eats.facet.fa6 +// CHECK:STDOUT: %Feed.specific_fn.loc31_64.2 => constants.%Feed.specific_fn.d82 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Eats(constants.%Grass) { +// CHECK:STDOUT: %Food.loc20_16.2 => constants.%Grass +// CHECK:STDOUT: %Food.patt.loc20_16.2 => constants.%Grass +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Eats.type => constants.%Eats.type.1ae +// CHECK:STDOUT: %Self.2 => constants.%Self.4eb +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.009(constants.%Animal.facet, constants.%Edible.facet) { +// CHECK:STDOUT: %T.loc25_14.2 => constants.%Animal.facet +// CHECK:STDOUT: %T.patt.loc25_14.2 => constants.%Animal.facet +// CHECK:STDOUT: %U.loc25_26.2 => constants.%Edible.facet +// CHECK:STDOUT: %U.patt.loc25_26.2 => constants.%Edible.facet +// CHECK:STDOUT: %T.as_type.loc25_38.2 => constants.%Goat +// CHECK:STDOUT: %U.as_type.loc25_49.2 => constants.%Grass +// CHECK:STDOUT: %Eats.type.loc25_49.2 => constants.%Eats.type.1ae +// CHECK:STDOUT: %require_complete => constants.%complete_type.004 +// CHECK:STDOUT: %impl_witness => constants.%impl_witness.4f1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Feed(constants.%Edible.facet, constants.%Eats.facet.fa6) { +// CHECK:STDOUT: %Food.loc30_9.2 => constants.%Edible.facet +// CHECK:STDOUT: %Food.patt.loc30_9.2 => constants.%Edible.facet +// CHECK:STDOUT: %Food.as_type.loc30_37.2 => constants.%Grass +// CHECK:STDOUT: %Eats.type.loc30_37.2 => constants.%Eats.type.1ae +// CHECK:STDOUT: %T.loc30_24.2 => constants.%Eats.facet.fa6 +// CHECK:STDOUT: %T.patt.loc30_24.2 => constants.%Eats.facet.fa6 +// CHECK:STDOUT: %T.as_type.loc30_43.2 => constants.%Goat +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- toolchain/testing/min_prelude/convert.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: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .As = %As.decl +// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %As.decl: %As.type.b51 = interface_decl @As [concrete = constants.%As.generic] { +// CHECK:STDOUT: %Dest.patt.loc8_14.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc8_14.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { +// CHECK:STDOUT: %Dest.patt.loc12_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc12_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(%Dest.loc8_14.1: type) { +// CHECK:STDOUT: %Dest.loc8_14.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc8_14.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest.loc8_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.loc8_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.loc9_35.2: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_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.loc9_20.1 (%Self.as_type.7f0) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @As.%Dest.loc8_14.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param call_param0 +// CHECK:STDOUT: %.loc9_20.1: type = splice_block %.loc9_20.3 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] { +// CHECK:STDOUT: %.loc9_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, %.loc9_20.2 [symbolic = %Self (constants.%Self.b4e)] +// CHECK:STDOUT: %Self.as_type.loc9_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: %.loc9_20.3: type = converted %Self.ref, %Self.as_type.loc9_20.2 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.1.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.1.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc9_35.1: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_35.2 (constants.%assoc0.ac5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc9_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc12_22.1: type) { +// CHECK:STDOUT: %Dest.loc12_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc12_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc12_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.loc12_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.loc14_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_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.loc14_20.1 (%Self.as_type.419) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc12_22.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param call_param0 +// CHECK:STDOUT: %.loc14_20.1: type = splice_block %.loc14_20.3 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] { +// CHECK:STDOUT: %.loc14_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, %.loc14_20.2 [symbolic = %Self (constants.%Self.0f3)] +// CHECK:STDOUT: %Self.as_type.loc14_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: %.loc14_20.3: type = converted %Self.ref, %Self.as_type.loc14_20.2 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.2.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.2.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc14_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_35.2 (constants.%assoc0.a50)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc14_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(@As.%Dest.loc8_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.loc9_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(@ImplicitAs.%Dest.loc12_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.loc14_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419)]() -> @Convert.2.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc8_14.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc8_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.loc9_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.loc8_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc12_22.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc12_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.loc14_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.loc12_22.2) {} +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/facet/min_prelude/convert_facet_value_value_to_itself.carbon b/toolchain/check/testdata/facet/min_prelude/convert_facet_value_value_to_itself.carbon new file mode 100644 index 000000000000..03eebd73a959 --- /dev/null +++ b/toolchain/check/testdata/facet/min_prelude/convert_facet_value_value_to_itself.carbon @@ -0,0 +1,393 @@ +// 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 +// +// INCLUDE-FILE: toolchain/testing/min_prelude/convert.carbon +// EXTRA-ARGS: --custom-core +// +// AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/facet/min_prelude/convert_facet_value_value_to_itself.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/facet/min_prelude/convert_facet_value_value_to_itself.carbon + +interface Animal {} + +fn FeedAnimal[T:! Animal](a: T) {} + +fn HandleAnimal[T:! Animal](a: T) { FeedAnimal(a); } + +class Goat {} +impl Goat as Animal {} + +fn F() { + HandleAnimal({} as Goat); +} + +// CHECK:STDOUT: --- convert_facet_value_value_to_itself.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Animal.type: type = facet_type <@Animal> [concrete] +// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %T: %Animal.type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.patt: %Animal.type = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic] +// CHECK:STDOUT: %FeedAnimal.type: type = fn_type @FeedAnimal [concrete] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %FeedAnimal: %FeedAnimal.type = struct_value () [concrete] +// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type [symbolic] +// CHECK:STDOUT: %HandleAnimal.type: type = fn_type @HandleAnimal [concrete] +// CHECK:STDOUT: %HandleAnimal: %HandleAnimal.type = struct_value () [concrete] +// CHECK:STDOUT: %FeedAnimal.specific_fn.ec8: = specific_function %FeedAnimal, @FeedAnimal(%T) [symbolic] +// CHECK:STDOUT: %Goat: type = class_type @Goat [concrete] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] +// CHECK:STDOUT: %impl_witness: = impl_witness () [concrete] +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %Goat.val: %Goat = struct_value () [concrete] +// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value %Goat, (%impl_witness) [concrete] +// CHECK:STDOUT: %HandleAnimal.specific_fn: = specific_function %HandleAnimal, @HandleAnimal(%Animal.facet) [concrete] +// CHECK:STDOUT: %FeedAnimal.specific_fn.5d0: = specific_function %FeedAnimal, @FeedAnimal(%Animal.facet) [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// 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: .Animal = %Animal.decl +// CHECK:STDOUT: .FeedAnimal = %FeedAnimal.decl +// CHECK:STDOUT: .HandleAnimal = %HandleAnimal.decl +// CHECK:STDOUT: .Goat = %Goat.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Animal.decl: type = interface_decl @Animal [concrete = constants.%Animal.type] {} {} +// CHECK:STDOUT: %FeedAnimal.decl: %FeedAnimal.type = fn_decl @FeedAnimal [concrete = constants.%FeedAnimal] { +// CHECK:STDOUT: %T.patt.loc16_15.1: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc16_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %a.patt: @FeedAnimal.%T.as_type.loc16_30.2 (%T.as_type) = binding_pattern a +// CHECK:STDOUT: %a.param_patt: @FeedAnimal.%T.as_type.loc16_30.2 (%T.as_type) = value_param_pattern %a.patt, call_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: %T.loc16_15.1: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc16_15.2 (constants.%T)] +// CHECK:STDOUT: %a.param: @FeedAnimal.%T.as_type.loc16_30.2 (%T.as_type) = value_param call_param0 +// CHECK:STDOUT: %.loc16_30.1: type = splice_block %.loc16_30.2 [symbolic = %T.as_type.loc16_30.2 (constants.%T.as_type)] { +// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc16_15.1 [symbolic = %T.loc16_15.2 (constants.%T)] +// CHECK:STDOUT: %T.as_type.loc16_30.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc16_30.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc16_30.2: type = converted %T.ref, %T.as_type.loc16_30.1 [symbolic = %T.as_type.loc16_30.2 (constants.%T.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: @FeedAnimal.%T.as_type.loc16_30.2 (%T.as_type) = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %HandleAnimal.decl: %HandleAnimal.type = fn_decl @HandleAnimal [concrete = constants.%HandleAnimal] { +// CHECK:STDOUT: %T.patt.loc18_17.1: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc18_17.2 (constants.%T.patt)] +// CHECK:STDOUT: %a.patt: @HandleAnimal.%T.as_type.loc18_32.2 (%T.as_type) = binding_pattern a +// CHECK:STDOUT: %a.param_patt: @HandleAnimal.%T.as_type.loc18_32.2 (%T.as_type) = value_param_pattern %a.patt, call_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: %T.loc18_17.1: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc18_17.2 (constants.%T)] +// CHECK:STDOUT: %a.param: @HandleAnimal.%T.as_type.loc18_32.2 (%T.as_type) = value_param call_param0 +// CHECK:STDOUT: %.loc18_32.1: type = splice_block %.loc18_32.2 [symbolic = %T.as_type.loc18_32.2 (constants.%T.as_type)] { +// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc18_17.1 [symbolic = %T.loc18_17.2 (constants.%T)] +// CHECK:STDOUT: %T.as_type.loc18_32.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc18_32.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc18_32.2: type = converted %T.ref, %T.as_type.loc18_32.1 [symbolic = %T.as_type.loc18_32.2 (constants.%T.as_type)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: @HandleAnimal.%T.as_type.loc18_32.2 (%T.as_type) = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Goat.decl: type = class_decl @Goat [concrete = constants.%Goat] {} {} +// CHECK:STDOUT: impl_decl @impl [concrete] {} { +// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] +// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness: = impl_witness () [concrete = constants.%impl_witness] +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @Animal { +// CHECK:STDOUT: %Self: %Animal.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: impl @impl: %Goat.ref as %Animal.ref { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = file.%impl_witness +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: class @Goat { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type] +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Goat +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @FeedAnimal(%T.loc16_15.1: %Animal.type) { +// CHECK:STDOUT: %T.loc16_15.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc16_15.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc16_15.2: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc16_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.as_type.loc16_30.2: type = facet_access_type %T.loc16_15.2 [symbolic = %T.as_type.loc16_30.2 (constants.%T.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @FeedAnimal.%T.as_type.loc16_30.2 (%T.as_type) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%T.patt.loc16_15.1: %Animal.type](%a.param_patt: @FeedAnimal.%T.as_type.loc16_30.2 (%T.as_type)) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @HandleAnimal(%T.loc18_17.1: %Animal.type) { +// CHECK:STDOUT: %T.loc18_17.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc18_17.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc18_17.2: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc18_17.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.as_type.loc18_32.2: type = facet_access_type %T.loc18_17.2 [symbolic = %T.as_type.loc18_32.2 (constants.%T.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @HandleAnimal.%T.as_type.loc18_32.2 (%T.as_type) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %FeedAnimal.specific_fn.loc18_37.2: = specific_function constants.%FeedAnimal, @FeedAnimal(%T.loc18_17.2) [symbolic = %FeedAnimal.specific_fn.loc18_37.2 (constants.%FeedAnimal.specific_fn.ec8)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%T.patt.loc18_17.1: %Animal.type](%a.param_patt: @HandleAnimal.%T.as_type.loc18_32.2 (%T.as_type)) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %FeedAnimal.ref: %FeedAnimal.type = name_ref FeedAnimal, file.%FeedAnimal.decl [concrete = constants.%FeedAnimal] +// CHECK:STDOUT: %a.ref: @HandleAnimal.%T.as_type.loc18_32.2 (%T.as_type) = name_ref a, %a +// CHECK:STDOUT: %.loc18_49.1: %Animal.type = converted constants.%T.as_type, constants.%T [symbolic = %T.loc18_17.2 (constants.%T)] +// CHECK:STDOUT: %.loc18_49.2: %Animal.type = converted constants.%T.as_type, constants.%T [symbolic = %T.loc18_17.2 (constants.%T)] +// CHECK:STDOUT: %FeedAnimal.specific_fn.loc18_37.1: = specific_function %FeedAnimal.ref, @FeedAnimal(constants.%T) [symbolic = %FeedAnimal.specific_fn.loc18_37.2 (constants.%FeedAnimal.specific_fn.ec8)] +// CHECK:STDOUT: %FeedAnimal.call: init %empty_tuple.type = call %FeedAnimal.specific_fn.loc18_37.1(%a.ref) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %HandleAnimal.ref: %HandleAnimal.type = name_ref HandleAnimal, file.%HandleAnimal.decl [concrete = constants.%HandleAnimal] +// CHECK:STDOUT: %.loc24_17.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] +// CHECK:STDOUT: %.loc24_17.2: ref %Goat = temporary_storage +// CHECK:STDOUT: %.loc24_17.3: init %Goat = class_init (), %.loc24_17.2 [concrete = constants.%Goat.val] +// CHECK:STDOUT: %.loc24_17.4: ref %Goat = temporary %.loc24_17.2, %.loc24_17.3 +// CHECK:STDOUT: %.loc24_19.1: ref %Goat = converted %.loc24_17.1, %.loc24_17.4 +// CHECK:STDOUT: %Animal.facet.loc24_26.1: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness) [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %.loc24_26.1: %Animal.type = converted constants.%Goat, %Animal.facet.loc24_26.1 [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %Animal.facet.loc24_26.2: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness) [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %.loc24_26.2: %Animal.type = converted constants.%Goat, %Animal.facet.loc24_26.2 [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %HandleAnimal.specific_fn: = specific_function %HandleAnimal.ref, @HandleAnimal(constants.%Animal.facet) [concrete = constants.%HandleAnimal.specific_fn] +// CHECK:STDOUT: %.loc24_19.2: %Goat = bind_value %.loc24_19.1 +// CHECK:STDOUT: %HandleAnimal.call: init %empty_tuple.type = call %HandleAnimal.specific_fn(%.loc24_19.2) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @FeedAnimal(constants.%T) { +// CHECK:STDOUT: %T.loc16_15.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc16_15.2 => constants.%T +// CHECK:STDOUT: %T.as_type.loc16_30.2 => constants.%T.as_type +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%require_complete +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @HandleAnimal(constants.%T) { +// CHECK:STDOUT: %T.loc18_17.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc18_17.2 => constants.%T +// CHECK:STDOUT: %T.as_type.loc18_32.2 => constants.%T.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @FeedAnimal(@HandleAnimal.%T.loc18_17.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @HandleAnimal(constants.%Animal.facet) { +// CHECK:STDOUT: %T.loc18_17.2 => constants.%Animal.facet +// CHECK:STDOUT: %T.patt.loc18_17.2 => constants.%Animal.facet +// CHECK:STDOUT: %T.as_type.loc18_32.2 => constants.%Goat +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %FeedAnimal.specific_fn.loc18_37.2 => constants.%FeedAnimal.specific_fn.5d0 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @FeedAnimal(constants.%Animal.facet) { +// CHECK:STDOUT: %T.loc16_15.2 => constants.%Animal.facet +// CHECK:STDOUT: %T.patt.loc16_15.2 => constants.%Animal.facet +// CHECK:STDOUT: %T.as_type.loc16_30.2 => constants.%Goat +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- toolchain/testing/min_prelude/convert.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: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .As = %As.decl +// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %As.decl: %As.type.b51 = interface_decl @As [concrete = constants.%As.generic] { +// CHECK:STDOUT: %Dest.patt.loc8_14.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc8_14.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { +// CHECK:STDOUT: %Dest.patt.loc12_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc12_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(%Dest.loc8_14.1: type) { +// CHECK:STDOUT: %Dest.loc8_14.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc8_14.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest.loc8_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.loc8_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.loc9_35.2: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_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.loc9_20.1 (%Self.as_type.7f0) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @As.%Dest.loc8_14.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param call_param0 +// CHECK:STDOUT: %.loc9_20.1: type = splice_block %.loc9_20.3 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] { +// CHECK:STDOUT: %.loc9_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, %.loc9_20.2 [symbolic = %Self (constants.%Self.b4e)] +// CHECK:STDOUT: %Self.as_type.loc9_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: %.loc9_20.3: type = converted %Self.ref, %Self.as_type.loc9_20.2 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.1.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.1.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc9_35.1: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_35.2 (constants.%assoc0.ac5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc9_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc12_22.1: type) { +// CHECK:STDOUT: %Dest.loc12_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc12_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc12_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.loc12_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.loc14_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_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.loc14_20.1 (%Self.as_type.419) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc12_22.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param call_param0 +// CHECK:STDOUT: %.loc14_20.1: type = splice_block %.loc14_20.3 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] { +// CHECK:STDOUT: %.loc14_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, %.loc14_20.2 [symbolic = %Self (constants.%Self.0f3)] +// CHECK:STDOUT: %Self.as_type.loc14_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: %.loc14_20.3: type = converted %Self.ref, %Self.as_type.loc14_20.2 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.2.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.2.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc14_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_35.2 (constants.%assoc0.a50)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc14_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(@As.%Dest.loc8_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.loc9_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(@ImplicitAs.%Dest.loc12_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.loc14_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419)]() -> @Convert.2.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc8_14.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc8_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.loc9_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.loc8_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc12_22.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc12_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.loc14_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.loc12_22.2) {} +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/facet/min_prelude/convert_interface.carbon b/toolchain/check/testdata/facet/min_prelude/convert_interface.carbon new file mode 100644 index 000000000000..3eb3bf14045c --- /dev/null +++ b/toolchain/check/testdata/facet/min_prelude/convert_interface.carbon @@ -0,0 +1,284 @@ +// 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 +// +// INCLUDE-FILE: toolchain/testing/min_prelude/convert.carbon +// EXTRA-ARGS: --custom-core +// +// AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/facet/min_prelude/convert_interface.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/facet/min_prelude/convert_interface.carbon + +interface Eats {} +interface Animal {} + +// TODO: This may be rejected in the future. +// https://github.com/carbon-language/carbon-lang/issues/4853 +impl Animal as Eats {} + +fn F(e: Eats) {} +fn G() { F(Animal); } + +// CHECK:STDOUT: --- convert_interface.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Eats.type: type = facet_type <@Eats> [concrete] +// 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: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %impl_witness: = impl_witness () [concrete] +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %G.type: type = fn_type @G [concrete] +// CHECK:STDOUT: %G: %G.type = struct_value () [concrete] +// CHECK:STDOUT: %Eats.facet: %Eats.type = facet_value %Animal.type, (%impl_witness) [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// 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: .Eats = %Eats.decl +// CHECK:STDOUT: .Animal = %Animal.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Eats.decl: type = interface_decl @Eats [concrete = constants.%Eats.type] {} {} +// CHECK:STDOUT: %Animal.decl: type = interface_decl @Animal [concrete = constants.%Animal.type] {} {} +// CHECK:STDOUT: impl_decl @impl [concrete] {} { +// 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: } +// CHECK:STDOUT: %impl_witness: = impl_witness () [concrete = constants.%impl_witness] +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { +// CHECK:STDOUT: %e.patt: %Eats.type = binding_pattern e +// CHECK:STDOUT: %e.param_patt: %Eats.type = value_param_pattern %e.patt, call_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %e.param: %Eats.type = value_param call_param0 +// CHECK:STDOUT: %Eats.ref: type = name_ref Eats, file.%Eats.decl [concrete = constants.%Eats.type] +// CHECK:STDOUT: %e: %Eats.type = bind_name e, %e.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @Eats { +// CHECK:STDOUT: %Self: %Eats.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1b5] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: witness = () +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @Animal { +// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.fd4] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: witness = () +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl: %Animal.ref as %Eats.ref { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = file.%impl_witness +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F(%e.param_patt: %Eats.type) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @G() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] +// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: %Eats.facet: %Eats.type = facet_value constants.%Animal.type, (constants.%impl_witness) [concrete = constants.%Eats.facet] +// CHECK:STDOUT: %.loc22: %Eats.type = converted %Animal.ref, %Eats.facet [concrete = constants.%Eats.facet] +// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref(%.loc22) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- toolchain/testing/min_prelude/convert.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: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .As = %As.decl +// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %As.decl: %As.type.b51 = interface_decl @As [concrete = constants.%As.generic] { +// CHECK:STDOUT: %Dest.patt.loc8_14.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc8_14.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { +// CHECK:STDOUT: %Dest.patt.loc12_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc12_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(%Dest.loc8_14.1: type) { +// CHECK:STDOUT: %Dest.loc8_14.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc8_14.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest.loc8_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.loc8_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.loc9_35.2: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_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.loc9_20.1 (%Self.as_type.7f0) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @As.%Dest.loc8_14.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param call_param0 +// CHECK:STDOUT: %.loc9_20.1: type = splice_block %.loc9_20.3 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] { +// CHECK:STDOUT: %.loc9_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, %.loc9_20.2 [symbolic = %Self (constants.%Self.b4e)] +// CHECK:STDOUT: %Self.as_type.loc9_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: %.loc9_20.3: type = converted %Self.ref, %Self.as_type.loc9_20.2 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.1.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.1.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc9_35.1: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_35.2 (constants.%assoc0.ac5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc9_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc12_22.1: type) { +// CHECK:STDOUT: %Dest.loc12_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc12_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc12_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.loc12_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.loc14_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_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.loc14_20.1 (%Self.as_type.419) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc12_22.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param call_param0 +// CHECK:STDOUT: %.loc14_20.1: type = splice_block %.loc14_20.3 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] { +// CHECK:STDOUT: %.loc14_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, %.loc14_20.2 [symbolic = %Self (constants.%Self.0f3)] +// CHECK:STDOUT: %Self.as_type.loc14_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: %.loc14_20.3: type = converted %Self.ref, %Self.as_type.loc14_20.2 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.2.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.2.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc14_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_35.2 (constants.%assoc0.a50)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc14_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(@As.%Dest.loc8_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.loc9_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(@ImplicitAs.%Dest.loc12_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.loc14_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419)]() -> @Convert.2.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc8_14.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc8_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.loc9_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.loc8_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc12_22.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc12_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.loc14_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.loc12_22.2) {} +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtin_conversions/no_prelude/fail_convert_class_type_to_generic_facet_value.carbon b/toolchain/check/testdata/facet/min_prelude/fail_convert_class_type_to_generic_facet_value.carbon similarity index 55% rename from toolchain/check/testdata/builtin_conversions/no_prelude/fail_convert_class_type_to_generic_facet_value.carbon rename to toolchain/check/testdata/facet/min_prelude/fail_convert_class_type_to_generic_facet_value.carbon index 5ade4dfbbd54..d40f3df20d45 100644 --- a/toolchain/check/testdata/builtin_conversions/no_prelude/fail_convert_class_type_to_generic_facet_value.carbon +++ b/toolchain/check/testdata/facet/min_prelude/fail_convert_class_type_to_generic_facet_value.carbon @@ -2,23 +2,14 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// INCLUDE-FILE: toolchain/testing/min_prelude/convert.carbon +// EXTRA-ARGS: --custom-core +// // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtin_conversions/no_prelude/fail_convert_class_type_to_generic_facet_value.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/facet/min_prelude/fail_convert_class_type_to_generic_facet_value.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtin_conversions/no_prelude/fail_convert_class_type_to_generic_facet_value.carbon - -// --- core.carbon - -package Core; - -interface ImplicitAs(Dest:! type) { - fn Convert[self: Self]() -> Dest; -} - -// --- fail_convert_class_type_to_generic_facet_value.carbon - -import Core; +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/facet/min_prelude/fail_convert_class_type_to_generic_facet_value.carbon interface Generic(Scalar:! type) { fn F(); @@ -48,100 +39,6 @@ fn G() { CallGenericMethod(WrongGenericParam, ImplsGeneric); } -// CHECK:STDOUT: --- core.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic] -// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic] -// CHECK:STDOUT: %ImplicitAs.type.96f: type = generic_interface_type @ImplicitAs [concrete] -// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.96f = struct_value () [concrete] -// CHECK:STDOUT: %ImplicitAs.type.07f: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic] -// CHECK:STDOUT: %Self: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] -// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic] -// CHECK:STDOUT: %Convert: %Convert.type = struct_value () [symbolic] -// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type %ImplicitAs.type.07f [symbolic] -// CHECK:STDOUT: %assoc0: %ImplicitAs.assoc_type = assoc_entity element0, @ImplicitAs.%Convert.decl [symbolic] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { -// CHECK:STDOUT: %Dest.patt.loc4_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc4_22.2 (constants.%Dest.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.loc4_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc4_22.2 (constants.%Dest)] -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc4_22.1: type) { -// CHECK:STDOUT: %Dest.loc4_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc4_22.2 (constants.%Dest)] -// CHECK:STDOUT: %Dest.patt.loc4_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc4_22.2 (constants.%Dest.patt)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc4_22.2)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.07f)] -// CHECK:STDOUT: %Self.2: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest.loc4_22.2) [symbolic = %Convert.type (constants.%Convert.type)] -// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type) = struct_value () [symbolic = %Convert (constants.%Convert)] -// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type)] -// CHECK:STDOUT: %assoc0.loc5_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc5_35.2 (constants.%assoc0)] -// CHECK:STDOUT: -// CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %Convert.decl: @ImplicitAs.%Convert.type (%Convert.type) = fn_decl @Convert [symbolic = @ImplicitAs.%Convert (constants.%Convert)] { -// CHECK:STDOUT: %self.patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = binding_pattern self -// CHECK:STDOUT: %self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = value_param_pattern %self.patt, call_param0 -// CHECK:STDOUT: %return.patt: @Convert.%Dest (%Dest) = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: @Convert.%Dest (%Dest) = out_param_pattern %return.patt, call_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc4_22.1 [symbolic = %Dest (constants.%Dest)] -// CHECK:STDOUT: %self.param: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc5_20.1: type = splice_block %.loc5_20.3 [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] { -// CHECK:STDOUT: %.loc5_20.2: @Convert.%ImplicitAs.type (%ImplicitAs.type.07f) = specific_constant @ImplicitAs.%Self.1, @ImplicitAs(constants.%Dest) [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.ref: @Convert.%ImplicitAs.type (%ImplicitAs.type.07f) = name_ref Self, %.loc5_20.2 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc5_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc5_20.3: type = converted %Self.ref, %Self.as_type.loc5_20.2 [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = bind_name self, %self.param -// CHECK:STDOUT: %return.param: ref @Convert.%Dest (%Dest) = out_param call_param1 -// CHECK:STDOUT: %return: ref @Convert.%Dest (%Dest) = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %assoc0.loc5_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc5_35.2 (constants.%assoc0)] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .Dest = -// CHECK:STDOUT: .Convert = %assoc0.loc5_35.1 -// CHECK:STDOUT: witness = (%Convert.decl) -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert(@ImplicitAs.%Dest.loc4_22.1: type, @ImplicitAs.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f)) { -// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.07f)] -// CHECK:STDOUT: %Self: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc5_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type)]() -> @Convert.%Dest (%Dest); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { -// CHECK:STDOUT: %Dest.loc4_22.2 => constants.%Dest -// CHECK:STDOUT: %Dest.patt.loc4_22.2 => constants.%Dest -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self) { -// CHECK:STDOUT: %Dest => constants.%Dest -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.07f -// CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.as_type.loc5_20.1 => constants.%Self.as_type -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(%Dest.loc4_22.2) {} -// CHECK:STDOUT: // CHECK:STDOUT: --- fail_convert_class_type_to_generic_facet_value.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -200,15 +97,15 @@ fn G() { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs -// CHECK:STDOUT: import Core//default +// CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import_ref.5ab3ec.1: type = import_ref Core//default, loc4_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] -// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst24 [no loc], unloaded -// CHECK:STDOUT: %Core.import_ref.630: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = import_ref Core//default, loc5_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.43d)] -// CHECK:STDOUT: %Core.Convert = import_ref Core//default, Convert, unloaded -// CHECK:STDOUT: %Core.import_ref.5ab3ec.2: type = import_ref Core//default, loc4_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] -// CHECK:STDOUT: %Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) = import_ref Core//default, inst24 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] -// CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, loc5_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] +// CHECK:STDOUT: %Core.import_ref.5ab3ec.1: type = import_ref Core//prelude, loc12_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//prelude, inst65 [no loc], unloaded +// CHECK:STDOUT: %Core.import_ref.630: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = import_ref Core//prelude, loc14_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.43d)] +// CHECK:STDOUT: %Core.Convert = import_ref Core//prelude, Convert, unloaded +// CHECK:STDOUT: %Core.import_ref.5ab3ec.2: type = import_ref Core//prelude, loc12_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) = import_ref Core//prelude, inst65 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] +// CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//prelude, loc14_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -223,9 +120,9 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Generic.decl: %Generic.type.c21 = interface_decl @Generic [concrete = constants.%Generic.generic] { -// CHECK:STDOUT: %Scalar.patt.loc4_19.1: type = symbolic_binding_pattern Scalar, 0 [symbolic = %Scalar.patt.loc4_19.2 (constants.%Scalar.patt)] +// CHECK:STDOUT: %Scalar.patt.loc14_19.1: type = symbolic_binding_pattern Scalar, 0 [symbolic = %Scalar.patt.loc14_19.2 (constants.%Scalar.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %Scalar.loc4_19.1: type = bind_symbolic_name Scalar, 0 [symbolic = %Scalar.loc4_19.2 (constants.%Scalar)] +// CHECK:STDOUT: %Scalar.loc14_19.1: type = bind_symbolic_name Scalar, 0 [symbolic = %Scalar.loc14_19.2 (constants.%Scalar)] // CHECK:STDOUT: } // CHECK:STDOUT: %GenericParam.decl: type = class_decl @GenericParam [concrete = constants.%GenericParam] {} {} // CHECK:STDOUT: %WrongGenericParam.decl: type = class_decl @WrongGenericParam [concrete = constants.%WrongGenericParam] {} {} @@ -238,45 +135,45 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%F.decl) [concrete = constants.%impl_witness] // CHECK:STDOUT: %CallGenericMethod.decl: %CallGenericMethod.type = fn_decl @CallGenericMethod [concrete = constants.%CallGenericMethod] { -// CHECK:STDOUT: %T.patt.loc16_22.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc16_22.2 (constants.%T.patt)] -// CHECK:STDOUT: %U.patt.loc16_32.1: @CallGenericMethod.%Generic.type.loc16_45.2 (%Generic.type.91ccba.2) = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc16_32.2 (constants.%U.patt)] +// CHECK:STDOUT: %T.patt.loc26_22.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc26_22.2 (constants.%T.patt)] +// CHECK:STDOUT: %U.patt.loc26_32.1: @CallGenericMethod.%Generic.type.loc26_45.2 (%Generic.type.91ccba.2) = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc26_32.2 (constants.%U.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %T.loc16_22.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc16_22.2 (constants.%T)] -// CHECK:STDOUT: %.loc16: type = splice_block %Generic.type.loc16_45.1 [symbolic = %Generic.type.loc16_45.2 (constants.%Generic.type.91ccba.2)] { +// CHECK:STDOUT: %T.loc26_22.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc26_22.2 (constants.%T)] +// CHECK:STDOUT: %.loc26: type = splice_block %Generic.type.loc26_45.1 [symbolic = %Generic.type.loc26_45.2 (constants.%Generic.type.91ccba.2)] { // CHECK:STDOUT: %Generic.ref: %Generic.type.c21 = name_ref Generic, file.%Generic.decl [concrete = constants.%Generic.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc16_22.1 [symbolic = %T.loc16_22.2 (constants.%T)] -// CHECK:STDOUT: %Generic.type.loc16_45.1: type = facet_type <@Generic, @Generic(constants.%T)> [symbolic = %Generic.type.loc16_45.2 (constants.%Generic.type.91ccba.2)] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc26_22.1 [symbolic = %T.loc26_22.2 (constants.%T)] +// CHECK:STDOUT: %Generic.type.loc26_45.1: type = facet_type <@Generic, @Generic(constants.%T)> [symbolic = %Generic.type.loc26_45.2 (constants.%Generic.type.91ccba.2)] // CHECK:STDOUT: } -// CHECK:STDOUT: %U.loc16_32.1: @CallGenericMethod.%Generic.type.loc16_45.2 (%Generic.type.91ccba.2) = bind_symbolic_name U, 1 [symbolic = %U.loc16_32.2 (constants.%U)] +// CHECK:STDOUT: %U.loc26_32.1: @CallGenericMethod.%Generic.type.loc26_45.2 (%Generic.type.91ccba.2) = bind_symbolic_name U, 1 [symbolic = %U.loc26_32.2 (constants.%U)] // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Generic(%Scalar.loc4_19.1: type) { -// CHECK:STDOUT: %Scalar.loc4_19.2: type = bind_symbolic_name Scalar, 0 [symbolic = %Scalar.loc4_19.2 (constants.%Scalar)] -// CHECK:STDOUT: %Scalar.patt.loc4_19.2: type = symbolic_binding_pattern Scalar, 0 [symbolic = %Scalar.patt.loc4_19.2 (constants.%Scalar.patt)] +// CHECK:STDOUT: generic interface @Generic(%Scalar.loc14_19.1: type) { +// CHECK:STDOUT: %Scalar.loc14_19.2: type = bind_symbolic_name Scalar, 0 [symbolic = %Scalar.loc14_19.2 (constants.%Scalar)] +// CHECK:STDOUT: %Scalar.patt.loc14_19.2: type = symbolic_binding_pattern Scalar, 0 [symbolic = %Scalar.patt.loc14_19.2 (constants.%Scalar.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Generic.type: type = facet_type <@Generic, @Generic(%Scalar.loc4_19.2)> [symbolic = %Generic.type (constants.%Generic.type.91ccba.1)] +// CHECK:STDOUT: %Generic.type: type = facet_type <@Generic, @Generic(%Scalar.loc14_19.2)> [symbolic = %Generic.type (constants.%Generic.type.91ccba.1)] // CHECK:STDOUT: %Self.2: %Generic.type.91ccba.1 = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.dee)] -// CHECK:STDOUT: %F.type: type = fn_type @F.1, @Generic(%Scalar.loc4_19.2) [symbolic = %F.type (constants.%F.type.f43)] +// CHECK:STDOUT: %F.type: type = fn_type @F.1, @Generic(%Scalar.loc14_19.2) [symbolic = %F.type (constants.%F.type.f43)] // CHECK:STDOUT: %F: @Generic.%F.type (%F.type.f43) = struct_value () [symbolic = %F (constants.%F.8a2)] // CHECK:STDOUT: %Generic.assoc_type: type = assoc_entity_type @Generic.%Generic.type (%Generic.type.91ccba.1) [symbolic = %Generic.assoc_type (constants.%Generic.assoc_type.de9)] -// CHECK:STDOUT: %assoc0.loc5_9.2: @Generic.%Generic.assoc_type (%Generic.assoc_type.de9) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc5_9.2 (constants.%assoc0.29c)] +// CHECK:STDOUT: %assoc0.loc15_9.2: @Generic.%Generic.assoc_type (%Generic.assoc_type.de9) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc15_9.2 (constants.%assoc0.29c)] // CHECK:STDOUT: // CHECK:STDOUT: interface { // CHECK:STDOUT: %Self.1: @Generic.%Generic.type (%Generic.type.91ccba.1) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.dee)] // CHECK:STDOUT: %F.decl: @Generic.%F.type (%F.type.f43) = fn_decl @F.1 [symbolic = @Generic.%F (constants.%F.8a2)] {} {} -// CHECK:STDOUT: %assoc0.loc5_9.1: @Generic.%Generic.assoc_type (%Generic.assoc_type.de9) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc5_9.2 (constants.%assoc0.29c)] +// CHECK:STDOUT: %assoc0.loc15_9.1: @Generic.%Generic.assoc_type (%Generic.assoc_type.de9) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc15_9.2 (constants.%assoc0.29c)] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .F = %assoc0.loc5_9.1 +// CHECK:STDOUT: .F = %assoc0.loc15_9.1 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.5ab3ec.1: type) [from "core.carbon"] { +// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.5ab3ec.1: type) [from "toolchain/testing/min_prelude/convert.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: @@ -328,7 +225,7 @@ fn G() { // CHECK:STDOUT: .Self = constants.%ImplsGeneric // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F.1(@Generic.%Scalar.loc4_19.1: type, @Generic.%Self.1: @Generic.%Generic.type (%Generic.type.91ccba.1)) { +// CHECK:STDOUT: generic fn @F.1(@Generic.%Scalar.loc14_19.1: type, @Generic.%Self.1: @Generic.%Generic.type (%Generic.type.91ccba.1)) { // CHECK:STDOUT: fn(); // CHECK:STDOUT: } // CHECK:STDOUT: @@ -337,16 +234,16 @@ fn G() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @CallGenericMethod(%T.loc16_22.1: type, %U.loc16_32.1: @CallGenericMethod.%Generic.type.loc16_45.2 (%Generic.type.91ccba.2)) { -// CHECK:STDOUT: %T.loc16_22.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc16_22.2 (constants.%T)] -// CHECK:STDOUT: %T.patt.loc16_22.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc16_22.2 (constants.%T.patt)] -// CHECK:STDOUT: %Generic.type.loc16_45.2: type = facet_type <@Generic, @Generic(%T.loc16_22.2)> [symbolic = %Generic.type.loc16_45.2 (constants.%Generic.type.91ccba.2)] -// CHECK:STDOUT: %U.loc16_32.2: %Generic.type.91ccba.2 = bind_symbolic_name U, 1 [symbolic = %U.loc16_32.2 (constants.%U)] -// CHECK:STDOUT: %U.patt.loc16_32.2: %Generic.type.91ccba.2 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc16_32.2 (constants.%U.patt)] +// CHECK:STDOUT: generic fn @CallGenericMethod(%T.loc26_22.1: type, %U.loc26_32.1: @CallGenericMethod.%Generic.type.loc26_45.2 (%Generic.type.91ccba.2)) { +// CHECK:STDOUT: %T.loc26_22.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc26_22.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc26_22.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc26_22.2 (constants.%T.patt)] +// CHECK:STDOUT: %Generic.type.loc26_45.2: type = facet_type <@Generic, @Generic(%T.loc26_22.2)> [symbolic = %Generic.type.loc26_45.2 (constants.%Generic.type.91ccba.2)] +// CHECK:STDOUT: %U.loc26_32.2: %Generic.type.91ccba.2 = bind_symbolic_name U, 1 [symbolic = %U.loc26_32.2 (constants.%U)] +// CHECK:STDOUT: %U.patt.loc26_32.2: %Generic.type.91ccba.2 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc26_32.2 (constants.%U.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: fn(%T.patt.loc16_22.1: type, %U.patt.loc16_32.1: @CallGenericMethod.%Generic.type.loc16_45.2 (%Generic.type.91ccba.2)) { +// CHECK:STDOUT: fn(%T.patt.loc26_22.1: type, %U.patt.loc26_32.1: @CallGenericMethod.%Generic.type.loc26_45.2 (%Generic.type.91ccba.2)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -357,13 +254,13 @@ fn G() { // CHECK:STDOUT: %CallGenericMethod.ref: %CallGenericMethod.type = name_ref CallGenericMethod, file.%CallGenericMethod.decl [concrete = constants.%CallGenericMethod] // CHECK:STDOUT: %WrongGenericParam.ref: type = name_ref WrongGenericParam, file.%WrongGenericParam.decl [concrete = constants.%WrongGenericParam] // CHECK:STDOUT: %ImplsGeneric.ref: type = name_ref ImplsGeneric, file.%ImplsGeneric.decl [concrete = constants.%ImplsGeneric] -// CHECK:STDOUT: %.loc29: %Generic.type.c3b = converted constants.%ImplsGeneric, [concrete = ] +// CHECK:STDOUT: %.loc39: %Generic.type.c3b = converted constants.%ImplsGeneric, [concrete = ] // CHECK:STDOUT: %CallGenericMethod.specific_fn: = specific_function %CallGenericMethod.ref, @CallGenericMethod(constants.%WrongGenericParam, ) [concrete = ] // CHECK:STDOUT: %CallGenericMethod.call: init %empty_tuple.type = call %CallGenericMethod.specific_fn() [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.5ab3ec.2: type, imports.%Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62)) [from "core.carbon"] { +// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.5ab3ec.2: type, imports.%Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62)) [from "toolchain/testing/min_prelude/convert.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)] @@ -373,17 +270,17 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Generic(constants.%Scalar) { -// CHECK:STDOUT: %Scalar.loc4_19.2 => constants.%Scalar -// CHECK:STDOUT: %Scalar.patt.loc4_19.2 => constants.%Scalar +// CHECK:STDOUT: %Scalar.loc14_19.2 => constants.%Scalar +// CHECK:STDOUT: %Scalar.patt.loc14_19.2 => constants.%Scalar // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F.1(constants.%Scalar, constants.%Self.dee) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Generic(%Scalar.loc4_19.2) {} +// CHECK:STDOUT: specific @Generic(%Scalar.loc14_19.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Generic(constants.%GenericParam) { -// CHECK:STDOUT: %Scalar.loc4_19.2 => constants.%GenericParam -// CHECK:STDOUT: %Scalar.patt.loc4_19.2 => constants.%GenericParam +// CHECK:STDOUT: %Scalar.loc14_19.2 => constants.%GenericParam +// CHECK:STDOUT: %Scalar.patt.loc14_19.2 => constants.%GenericParam // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Generic.type => constants.%Generic.type.769 @@ -391,29 +288,29 @@ fn G() { // CHECK:STDOUT: %F.type => constants.%F.type.4cf // CHECK:STDOUT: %F => constants.%F.118 // CHECK:STDOUT: %Generic.assoc_type => constants.%Generic.assoc_type.9f1 -// CHECK:STDOUT: %assoc0.loc5_9.2 => constants.%assoc0.9b7 +// CHECK:STDOUT: %assoc0.loc15_9.2 => constants.%assoc0.9b7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F.1(constants.%GenericParam, constants.%Generic.facet) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Generic(constants.%T) { -// CHECK:STDOUT: %Scalar.loc4_19.2 => constants.%T -// CHECK:STDOUT: %Scalar.patt.loc4_19.2 => constants.%T +// CHECK:STDOUT: %Scalar.loc14_19.2 => constants.%T +// CHECK:STDOUT: %Scalar.patt.loc14_19.2 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @CallGenericMethod(constants.%T, constants.%U) { -// CHECK:STDOUT: %T.loc16_22.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc16_22.2 => constants.%T -// CHECK:STDOUT: %Generic.type.loc16_45.2 => constants.%Generic.type.91ccba.2 -// CHECK:STDOUT: %U.loc16_32.2 => constants.%U -// CHECK:STDOUT: %U.patt.loc16_32.2 => constants.%U +// CHECK:STDOUT: %T.loc26_22.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc26_22.2 => constants.%T +// CHECK:STDOUT: %Generic.type.loc26_45.2 => constants.%Generic.type.91ccba.2 +// CHECK:STDOUT: %U.loc26_32.2 => constants.%U +// CHECK:STDOUT: %U.patt.loc26_32.2 => constants.%U // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Generic(@CallGenericMethod.%T.loc16_22.2) {} +// CHECK:STDOUT: specific @Generic(@CallGenericMethod.%T.loc26_22.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Generic(constants.%WrongGenericParam) { -// CHECK:STDOUT: %Scalar.loc4_19.2 => constants.%WrongGenericParam -// CHECK:STDOUT: %Scalar.patt.loc4_19.2 => constants.%WrongGenericParam +// CHECK:STDOUT: %Scalar.loc14_19.2 => constants.%WrongGenericParam +// CHECK:STDOUT: %Scalar.patt.loc14_19.2 => constants.%WrongGenericParam // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { @@ -446,12 +343,188 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @CallGenericMethod(constants.%WrongGenericParam, ) { -// CHECK:STDOUT: %T.loc16_22.2 => constants.%WrongGenericParam -// CHECK:STDOUT: %T.patt.loc16_22.2 => constants.%WrongGenericParam -// CHECK:STDOUT: %Generic.type.loc16_45.2 => constants.%Generic.type.c3b -// CHECK:STDOUT: %U.loc16_32.2 => -// CHECK:STDOUT: %U.patt.loc16_32.2 => +// CHECK:STDOUT: %T.loc26_22.2 => constants.%WrongGenericParam +// CHECK:STDOUT: %T.patt.loc26_22.2 => constants.%WrongGenericParam +// CHECK:STDOUT: %Generic.type.loc26_45.2 => constants.%Generic.type.c3b +// CHECK:STDOUT: %U.loc26_32.2 => +// CHECK:STDOUT: %U.patt.loc26_32.2 => // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: --- toolchain/testing/min_prelude/convert.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: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .As = %As.decl +// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %As.decl: %As.type.b51 = interface_decl @As [concrete = constants.%As.generic] { +// CHECK:STDOUT: %Dest.patt.loc8_14.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc8_14.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { +// CHECK:STDOUT: %Dest.patt.loc12_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc12_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(%Dest.loc8_14.1: type) { +// CHECK:STDOUT: %Dest.loc8_14.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc8_14.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest.loc8_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.loc8_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.loc9_35.2: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_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.loc9_20.1 (%Self.as_type.7f0) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @As.%Dest.loc8_14.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param call_param0 +// CHECK:STDOUT: %.loc9_20.1: type = splice_block %.loc9_20.3 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] { +// CHECK:STDOUT: %.loc9_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, %.loc9_20.2 [symbolic = %Self (constants.%Self.b4e)] +// CHECK:STDOUT: %Self.as_type.loc9_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: %.loc9_20.3: type = converted %Self.ref, %Self.as_type.loc9_20.2 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.1.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.1.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc9_35.1: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_35.2 (constants.%assoc0.ac5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc9_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc12_22.1: type) { +// CHECK:STDOUT: %Dest.loc12_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc12_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc12_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.loc12_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.loc14_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_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.loc14_20.1 (%Self.as_type.419) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc12_22.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param call_param0 +// CHECK:STDOUT: %.loc14_20.1: type = splice_block %.loc14_20.3 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] { +// CHECK:STDOUT: %.loc14_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, %.loc14_20.2 [symbolic = %Self (constants.%Self.0f3)] +// CHECK:STDOUT: %Self.as_type.loc14_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: %.loc14_20.3: type = converted %Self.ref, %Self.as_type.loc14_20.2 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.2.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.2.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc14_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_35.2 (constants.%assoc0.a50)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc14_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(@As.%Dest.loc8_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.loc9_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(@ImplicitAs.%Dest.loc12_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.loc14_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419)]() -> @Convert.2.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc8_14.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc8_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.loc9_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.loc8_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc12_22.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc12_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.loc14_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.loc12_22.2) {} +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtin_conversions/no_prelude/fail_convert_facet_value_shouldnt_know_concrete_type.carbon b/toolchain/check/testdata/facet/min_prelude/fail_convert_facet_value_shouldnt_know_concrete_type.carbon similarity index 75% rename from toolchain/check/testdata/builtin_conversions/no_prelude/fail_convert_facet_value_shouldnt_know_concrete_type.carbon rename to toolchain/check/testdata/facet/min_prelude/fail_convert_facet_value_shouldnt_know_concrete_type.carbon index 70d5c3f18985..b6d3214b1948 100644 --- a/toolchain/check/testdata/builtin_conversions/no_prelude/fail_convert_facet_value_shouldnt_know_concrete_type.carbon +++ b/toolchain/check/testdata/facet/min_prelude/fail_convert_facet_value_shouldnt_know_concrete_type.carbon @@ -2,29 +2,14 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// INCLUDE-FILE: toolchain/testing/min_prelude/convert.carbon +// EXTRA-ARGS: --custom-core +// // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtin_conversions/no_prelude/fail_convert_facet_value_shouldnt_know_concrete_type.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/facet/min_prelude/fail_convert_facet_value_shouldnt_know_concrete_type.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtin_conversions/no_prelude/fail_convert_facet_value_shouldnt_know_concrete_type.carbon - -// --- core.carbon - -package Core; - -interface As(Dest:! type) { - fn Convert[self: Self]() -> Dest; -} - -interface ImplicitAs(Dest:! type) { - fn Convert[self: Self]() -> Dest; -} - -// --- fail_convert_facet_value_shouldnt_know_concrete_type.carbon - -library "[[@TEST_NAME]]"; - -import Core; +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/facet/min_prelude/fail_convert_facet_value_shouldnt_know_concrete_type.carbon interface Eats {} interface Animal {} @@ -49,182 +34,6 @@ fn F() { Feed(Goat as Animal); } -// 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: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .As = %As.decl -// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %As.decl: %As.type.b51 = interface_decl @As [concrete = constants.%As.generic] { -// CHECK:STDOUT: %Dest.patt.loc4_14.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc4_14.2 (constants.%Dest.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.loc4_14.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc4_14.2 (constants.%Dest)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { -// CHECK:STDOUT: %Dest.patt.loc8_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_22.2 (constants.%Dest.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.loc8_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_22.2 (constants.%Dest)] -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic interface @As(%Dest.loc4_14.1: type) { -// CHECK:STDOUT: %Dest.loc4_14.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc4_14.2 (constants.%Dest)] -// CHECK:STDOUT: %Dest.patt.loc4_14.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc4_14.2 (constants.%Dest.patt)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest.loc4_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.loc4_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.loc5_35.2: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc5_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.loc5_20.1 (%Self.as_type.7f0) = binding_pattern self -// CHECK:STDOUT: %self.param_patt: @Convert.1.%Self.as_type.loc5_20.1 (%Self.as_type.7f0) = value_param_pattern %self.patt, call_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, call_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @As.%Dest.loc4_14.1 [symbolic = %Dest (constants.%Dest)] -// CHECK:STDOUT: %self.param: @Convert.1.%Self.as_type.loc5_20.1 (%Self.as_type.7f0) = 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.7f0)] { -// CHECK:STDOUT: %.loc5_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, %.loc5_20.2 [symbolic = %Self (constants.%Self.b4e)] -// 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.7f0)] -// 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.7f0)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: @Convert.1.%Self.as_type.loc5_20.1 (%Self.as_type.7f0) = bind_name self, %self.param -// CHECK:STDOUT: %return.param: ref @Convert.1.%Dest (%Dest) = out_param call_param1 -// CHECK:STDOUT: %return: ref @Convert.1.%Dest (%Dest) = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %assoc0.loc5_35.1: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc5_35.2 (constants.%assoc0.ac5)] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .Dest = -// CHECK:STDOUT: .Convert = %assoc0.loc5_35.1 -// CHECK:STDOUT: witness = (%Convert.decl) -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc8_22.1: type) { -// CHECK:STDOUT: %Dest.loc8_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_22.2 (constants.%Dest)] -// CHECK:STDOUT: %Dest.patt.loc8_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_22.2 (constants.%Dest.patt)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc8_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.loc8_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.loc9_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_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.loc9_20.1 (%Self.as_type.419) = binding_pattern self -// CHECK:STDOUT: %self.param_patt: @Convert.2.%Self.as_type.loc9_20.1 (%Self.as_type.419) = value_param_pattern %self.patt, call_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, call_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc8_22.1 [symbolic = %Dest (constants.%Dest)] -// CHECK:STDOUT: %self.param: @Convert.2.%Self.as_type.loc9_20.1 (%Self.as_type.419) = value_param call_param0 -// CHECK:STDOUT: %.loc9_20.1: type = splice_block %.loc9_20.3 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.419)] { -// CHECK:STDOUT: %.loc9_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, %.loc9_20.2 [symbolic = %Self (constants.%Self.0f3)] -// CHECK:STDOUT: %Self.as_type.loc9_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.419)] -// CHECK:STDOUT: %.loc9_20.3: type = converted %Self.ref, %Self.as_type.loc9_20.2 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.419)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: @Convert.2.%Self.as_type.loc9_20.1 (%Self.as_type.419) = bind_name self, %self.param -// CHECK:STDOUT: %return.param: ref @Convert.2.%Dest (%Dest) = out_param call_param1 -// CHECK:STDOUT: %return: ref @Convert.2.%Dest (%Dest) = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %assoc0.loc9_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_35.2 (constants.%assoc0.a50)] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .Dest = -// CHECK:STDOUT: .Convert = %assoc0.loc9_35.1 -// CHECK:STDOUT: witness = (%Convert.decl) -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert.1(@As.%Dest.loc4_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.loc5_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type.7f0)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self.as_type.loc5_20.1 (%Self.as_type.7f0)]() -> @Convert.1.%Dest (%Dest); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert.2(@ImplicitAs.%Dest.loc8_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.loc9_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.419)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Convert.2.%Self.as_type.loc9_20.1 (%Self.as_type.419)]() -> @Convert.2.%Dest (%Dest); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @As(constants.%Dest) { -// CHECK:STDOUT: %Dest.loc4_14.2 => constants.%Dest -// CHECK:STDOUT: %Dest.patt.loc4_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.loc5_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.loc4_14.2) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { -// CHECK:STDOUT: %Dest.loc8_22.2 => constants.%Dest -// CHECK:STDOUT: %Dest.patt.loc8_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.loc9_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.loc8_22.2) {} -// CHECK:STDOUT: // CHECK:STDOUT: --- fail_convert_facet_value_shouldnt_know_concrete_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -263,15 +72,15 @@ fn F() { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs -// CHECK:STDOUT: import Core//default +// CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import_ref.5ab3ec.1: type = import_ref Core//default, loc8_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] -// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst65 [no loc], unloaded -// CHECK:STDOUT: %Core.import_ref.630: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = import_ref Core//default, loc9_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.43d)] -// CHECK:STDOUT: %Core.Convert = import_ref Core//default, Convert, unloaded -// CHECK:STDOUT: %Core.import_ref.5ab3ec.2: type = import_ref Core//default, loc8_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] -// CHECK:STDOUT: %Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) = import_ref Core//default, inst65 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] -// CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, loc9_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] +// CHECK:STDOUT: %Core.import_ref.5ab3ec.1: type = import_ref Core//prelude, loc12_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//prelude, inst65 [no loc], unloaded +// CHECK:STDOUT: %Core.import_ref.630: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = import_ref Core//prelude, loc14_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.43d)] +// CHECK:STDOUT: %Core.Convert = import_ref Core//prelude, Convert, unloaded +// CHECK:STDOUT: %Core.import_ref.5ab3ec.2: type = import_ref Core//prelude, loc12_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) = import_ref Core//prelude, inst65 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] +// CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//prelude, loc14_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -291,17 +100,17 @@ fn F() { // CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] // CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %impl_witness.loc10: = impl_witness () [concrete = constants.%impl_witness] +// CHECK:STDOUT: %impl_witness.loc18: = impl_witness () [concrete = constants.%impl_witness] // CHECK:STDOUT: impl_decl @impl.b88 [concrete] {} { // CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] // CHECK:STDOUT: %Eats.ref: type = name_ref Eats, file.%Eats.decl [concrete = constants.%Eats.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %impl_witness.loc11: = impl_witness () [concrete = constants.%impl_witness] +// CHECK:STDOUT: %impl_witness.loc19: = impl_witness () [concrete = constants.%impl_witness] // CHECK:STDOUT: %Feed.decl: %Feed.type = fn_decl @Feed [concrete = constants.%Feed] { -// CHECK:STDOUT: %e.patt.loc13_9.1: %Eats.type = symbolic_binding_pattern e, 0 [symbolic = %e.patt.loc13_9.2 (constants.%e.patt)] +// CHECK:STDOUT: %e.patt.loc21_9.1: %Eats.type = symbolic_binding_pattern e, 0 [symbolic = %e.patt.loc21_9.2 (constants.%e.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %Eats.ref: type = name_ref Eats, file.%Eats.decl [concrete = constants.%Eats.type] -// CHECK:STDOUT: %e.loc13_9.1: %Eats.type = bind_symbolic_name e, 0 [symbolic = %e.loc13_9.2 (constants.%e)] +// CHECK:STDOUT: %e.loc21_9.1: %Eats.type = bind_symbolic_name e, 0 [symbolic = %e.loc21_9.2 (constants.%e)] // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: } @@ -322,7 +131,7 @@ fn F() { // CHECK:STDOUT: witness = () // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.5ab3ec.1: type) [from "core.carbon"] { +// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.5ab3ec.1: type) [from "toolchain/testing/min_prelude/convert.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: @@ -344,12 +153,12 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.27e: %Goat.ref as %Animal.ref { // CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = file.%impl_witness.loc10 +// CHECK:STDOUT: witness = file.%impl_witness.loc18 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.b88: %Goat.ref as %Eats.ref { // CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = file.%impl_witness.loc11 +// CHECK:STDOUT: witness = file.%impl_witness.loc19 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Goat { @@ -360,13 +169,13 @@ fn F() { // CHECK:STDOUT: .Self = constants.%Goat // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Feed(%e.loc13_9.1: %Eats.type) { -// CHECK:STDOUT: %e.loc13_9.2: %Eats.type = bind_symbolic_name e, 0 [symbolic = %e.loc13_9.2 (constants.%e)] -// CHECK:STDOUT: %e.patt.loc13_9.2: %Eats.type = symbolic_binding_pattern e, 0 [symbolic = %e.patt.loc13_9.2 (constants.%e.patt)] +// CHECK:STDOUT: generic fn @Feed(%e.loc21_9.1: %Eats.type) { +// CHECK:STDOUT: %e.loc21_9.2: %Eats.type = bind_symbolic_name e, 0 [symbolic = %e.loc21_9.2 (constants.%e)] +// CHECK:STDOUT: %e.patt.loc21_9.2: %Eats.type = symbolic_binding_pattern e, 0 [symbolic = %e.patt.loc21_9.2 (constants.%e.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: fn(%e.patt.loc13_9.1: %Eats.type) { +// CHECK:STDOUT: fn(%e.patt.loc21_9.1: %Eats.type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -378,12 +187,12 @@ fn F() { // CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] // CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] // CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness) [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %.loc26_13: %Animal.type = converted %Goat.ref, %Animal.facet [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %.loc26_22: %Eats.type = converted %.loc26_13, [concrete = ] +// CHECK:STDOUT: %.loc34_13: %Animal.type = converted %Goat.ref, %Animal.facet [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %.loc34_22: %Eats.type = converted %.loc34_13, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.5ab3ec.2: type, imports.%Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62)) [from "core.carbon"] { +// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.5ab3ec.2: type, imports.%Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62)) [from "toolchain/testing/min_prelude/convert.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)] @@ -393,8 +202,8 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Feed(constants.%e) { -// CHECK:STDOUT: %e.loc13_9.2 => constants.%e -// CHECK:STDOUT: %e.patt.loc13_9.2 => constants.%e +// CHECK:STDOUT: %e.loc21_9.2 => constants.%e +// CHECK:STDOUT: %e.patt.loc21_9.2 => constants.%e // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { @@ -426,3 +235,179 @@ fn F() { // CHECK:STDOUT: %assoc0 => constants.%assoc0.ceb // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: --- toolchain/testing/min_prelude/convert.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: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .As = %As.decl +// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %As.decl: %As.type.b51 = interface_decl @As [concrete = constants.%As.generic] { +// CHECK:STDOUT: %Dest.patt.loc8_14.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc8_14.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { +// CHECK:STDOUT: %Dest.patt.loc12_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc12_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(%Dest.loc8_14.1: type) { +// CHECK:STDOUT: %Dest.loc8_14.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc8_14.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest.loc8_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.loc8_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.loc9_35.2: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_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.loc9_20.1 (%Self.as_type.7f0) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @As.%Dest.loc8_14.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param call_param0 +// CHECK:STDOUT: %.loc9_20.1: type = splice_block %.loc9_20.3 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] { +// CHECK:STDOUT: %.loc9_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, %.loc9_20.2 [symbolic = %Self (constants.%Self.b4e)] +// CHECK:STDOUT: %Self.as_type.loc9_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: %.loc9_20.3: type = converted %Self.ref, %Self.as_type.loc9_20.2 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.1.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.1.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc9_35.1: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_35.2 (constants.%assoc0.ac5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc9_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc12_22.1: type) { +// CHECK:STDOUT: %Dest.loc12_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc12_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc12_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.loc12_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.loc14_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_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.loc14_20.1 (%Self.as_type.419) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc12_22.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param call_param0 +// CHECK:STDOUT: %.loc14_20.1: type = splice_block %.loc14_20.3 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] { +// CHECK:STDOUT: %.loc14_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, %.loc14_20.2 [symbolic = %Self (constants.%Self.0f3)] +// CHECK:STDOUT: %Self.as_type.loc14_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: %.loc14_20.3: type = converted %Self.ref, %Self.as_type.loc14_20.2 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.2.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.2.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc14_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_35.2 (constants.%assoc0.a50)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc14_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(@As.%Dest.loc8_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.loc9_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(@ImplicitAs.%Dest.loc12_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.loc14_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419)]() -> @Convert.2.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc8_14.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc8_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.loc9_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.loc8_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc12_22.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc12_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.loc14_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.loc12_22.2) {} +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/facet/min_prelude/fail_convert_facet_value_to_missing_impl.carbon b/toolchain/check/testdata/facet/min_prelude/fail_convert_facet_value_to_missing_impl.carbon new file mode 100644 index 000000000000..af8694c48f1e --- /dev/null +++ b/toolchain/check/testdata/facet/min_prelude/fail_convert_facet_value_to_missing_impl.carbon @@ -0,0 +1,416 @@ +// 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 +// +// INCLUDE-FILE: toolchain/testing/min_prelude/convert.carbon +// EXTRA-ARGS: --custom-core +// +// AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/facet/min_prelude/fail_convert_facet_value_to_missing_impl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/facet/min_prelude/fail_convert_facet_value_to_missing_impl.carbon + +interface Eats {} +interface Animal {} + +fn Feed[T:! Eats](e: T) {} + +// CHECK:STDERR: fail_convert_facet_value_to_missing_impl.carbon:[[@LINE+10]]:37: error: cannot implicitly convert type `T` that implements `Animal` into type implementing `Eats` [ConversionFailureFacetToFacet] +// CHECK:STDERR: fn HandleAnimal[T:! Animal](a: T) { Feed(a); } +// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_convert_facet_value_to_missing_impl.carbon:[[@LINE+7]]:37: note: type `type` does not implement interface `Core.ImplicitAs(Eats)` [MissingImplInMemberAccessNote] +// CHECK:STDERR: fn HandleAnimal[T:! Animal](a: T) { Feed(a); } +// CHECK:STDERR: ^~~~~~~ +// CHECK:STDERR: fail_convert_facet_value_to_missing_impl.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](a: T) { Feed(a); } + +// CHECK:STDOUT: --- fail_convert_facet_value_to_missing_impl.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Eats.type: type = facet_type <@Eats> [concrete] +// 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.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.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.c75: = require_complete_type %T.as_type.27d [symbolic] +// CHECK:STDOUT: %T.fd4: %Animal.type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.patt.a9c: %Animal.type = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %T.as_type.2ad: type = facet_access_type %T.fd4 [symbolic] +// CHECK:STDOUT: %HandleAnimal.type: type = fn_type @HandleAnimal [concrete] +// CHECK:STDOUT: %HandleAnimal: %HandleAnimal.type = struct_value () [concrete] +// CHECK:STDOUT: %require_complete.234: = require_complete_type %T.as_type.2ad [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.02f: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.1c7 [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.ceb: %ImplicitAs.assoc_type.9a7 = assoc_entity element0, imports.%Core.import_ref.1c7 [concrete] +// CHECK:STDOUT: %assoc0.43d: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207 [symbolic] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import_ref.5ab3ec.1: type = import_ref Core//prelude, loc12_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//prelude, inst65 [no loc], unloaded +// CHECK:STDOUT: %Core.import_ref.630: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = import_ref Core//prelude, loc14_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.43d)] +// CHECK:STDOUT: %Core.Convert = import_ref Core//prelude, Convert, unloaded +// CHECK:STDOUT: %Core.import_ref.5ab3ec.2: type = import_ref Core//prelude, loc12_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) = import_ref Core//prelude, inst65 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] +// CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//prelude, loc14_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Eats = %Eats.decl +// CHECK:STDOUT: .Animal = %Animal.decl +// CHECK:STDOUT: .Feed = %Feed.decl +// CHECK:STDOUT: .HandleAnimal = %HandleAnimal.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Eats.decl: type = interface_decl @Eats [concrete = constants.%Eats.type] {} {} +// 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.loc17_9.1: %Eats.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc17_9.2 (constants.%T.patt.6be)] +// CHECK:STDOUT: %e.patt: @Feed.%T.as_type.loc17_22.2 (%T.as_type.27d) = binding_pattern e +// CHECK:STDOUT: %e.param_patt: @Feed.%T.as_type.loc17_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.loc17_9.1: %Eats.type = bind_symbolic_name T, 0 [symbolic = %T.loc17_9.2 (constants.%T.1b5)] +// CHECK:STDOUT: %e.param: @Feed.%T.as_type.loc17_22.2 (%T.as_type.27d) = value_param call_param0 +// CHECK:STDOUT: %.loc17_22.1: type = splice_block %.loc17_22.2 [symbolic = %T.as_type.loc17_22.2 (constants.%T.as_type.27d)] { +// CHECK:STDOUT: %T.ref: %Eats.type = name_ref T, %T.loc17_9.1 [symbolic = %T.loc17_9.2 (constants.%T.1b5)] +// CHECK:STDOUT: %T.as_type.loc17_22.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc17_22.2 (constants.%T.as_type.27d)] +// CHECK:STDOUT: %.loc17_22.2: type = converted %T.ref, %T.as_type.loc17_22.1 [symbolic = %T.as_type.loc17_22.2 (constants.%T.as_type.27d)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %e: @Feed.%T.as_type.loc17_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.loc29_17.1: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc29_17.2 (constants.%T.patt.a9c)] +// CHECK:STDOUT: %a.patt: @HandleAnimal.%T.as_type.loc29_32.2 (%T.as_type.2ad) = binding_pattern a +// CHECK:STDOUT: %a.param_patt: @HandleAnimal.%T.as_type.loc29_32.2 (%T.as_type.2ad) = value_param_pattern %a.patt, call_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: %T.loc29_17.1: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc29_17.2 (constants.%T.fd4)] +// CHECK:STDOUT: %a.param: @HandleAnimal.%T.as_type.loc29_32.2 (%T.as_type.2ad) = value_param call_param0 +// CHECK:STDOUT: %.loc29_32.1: type = splice_block %.loc29_32.2 [symbolic = %T.as_type.loc29_32.2 (constants.%T.as_type.2ad)] { +// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc29_17.1 [symbolic = %T.loc29_17.2 (constants.%T.fd4)] +// CHECK:STDOUT: %T.as_type.loc29_32.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc29_32.2 (constants.%T.as_type.2ad)] +// CHECK:STDOUT: %.loc29_32.2: type = converted %T.ref, %T.as_type.loc29_32.1 [symbolic = %T.as_type.loc29_32.2 (constants.%T.as_type.2ad)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: @HandleAnimal.%T.as_type.loc29_32.2 (%T.as_type.2ad) = bind_name a, %a.param +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @Eats { +// CHECK:STDOUT: %Self: %Eats.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1b5] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: witness = () +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @Animal { +// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.fd4] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: witness = () +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.5ab3ec.1: type) [from "toolchain/testing/min_prelude/convert.carbon"] { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.d62)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.d62 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.519)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.275)] +// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = struct_value () [symbolic = %Convert (constants.%Convert.42e)] +// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type.837)] +// CHECK:STDOUT: %assoc0: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = assoc_entity element0, imports.%Core.import_ref.1c7 [symbolic = %assoc0 (constants.%assoc0.02f)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%Core.import_ref.ff5 +// CHECK:STDOUT: .Convert = imports.%Core.import_ref.630 +// CHECK:STDOUT: witness = (imports.%Core.Convert) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Feed(%T.loc17_9.1: %Eats.type) { +// CHECK:STDOUT: %T.loc17_9.2: %Eats.type = bind_symbolic_name T, 0 [symbolic = %T.loc17_9.2 (constants.%T.1b5)] +// CHECK:STDOUT: %T.patt.loc17_9.2: %Eats.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc17_9.2 (constants.%T.patt.6be)] +// CHECK:STDOUT: %T.as_type.loc17_22.2: type = facet_access_type %T.loc17_9.2 [symbolic = %T.as_type.loc17_22.2 (constants.%T.as_type.27d)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Feed.%T.as_type.loc17_22.2 (%T.as_type.27d) [symbolic = %require_complete (constants.%require_complete.c75)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%T.patt.loc17_9.1: %Eats.type](%e.param_patt: @Feed.%T.as_type.loc17_22.2 (%T.as_type.27d)) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @HandleAnimal(%T.loc29_17.1: %Animal.type) { +// CHECK:STDOUT: %T.loc29_17.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc29_17.2 (constants.%T.fd4)] +// CHECK:STDOUT: %T.patt.loc29_17.2: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc29_17.2 (constants.%T.patt.a9c)] +// CHECK:STDOUT: %T.as_type.loc29_32.2: type = facet_access_type %T.loc29_17.2 [symbolic = %T.as_type.loc29_32.2 (constants.%T.as_type.2ad)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @HandleAnimal.%T.as_type.loc29_32.2 (%T.as_type.2ad) [symbolic = %require_complete (constants.%require_complete.234)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%T.patt.loc29_17.1: %Animal.type](%a.param_patt: @HandleAnimal.%T.as_type.loc29_32.2 (%T.as_type.2ad)) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Feed.ref: %Feed.type = name_ref Feed, file.%Feed.decl [concrete = constants.%Feed] +// CHECK:STDOUT: %a.ref: @HandleAnimal.%T.as_type.loc29_32.2 (%T.as_type.2ad) = name_ref a, %a +// CHECK:STDOUT: %.loc29_43: %Eats.type = converted constants.%T.as_type.2ad, [concrete = ] +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.5ab3ec.2: type, imports.%Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62)) [from "toolchain/testing/min_prelude/convert.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 @Feed(constants.%T.1b5) { +// CHECK:STDOUT: %T.loc17_9.2 => constants.%T.1b5 +// CHECK:STDOUT: %T.patt.loc17_9.2 => constants.%T.1b5 +// CHECK:STDOUT: %T.as_type.loc17_22.2 => constants.%T.as_type.27d +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @HandleAnimal(constants.%T.fd4) { +// CHECK:STDOUT: %T.loc29_17.2 => constants.%T.fd4 +// CHECK:STDOUT: %T.patt.loc29_17.2 => constants.%T.fd4 +// CHECK:STDOUT: %T.as_type.loc29_32.2 => constants.%T.as_type.2ad +// 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.%Eats.type) { +// CHECK:STDOUT: %Dest => constants.%Eats.type +// CHECK:STDOUT: %Dest.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.ceb +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- toolchain/testing/min_prelude/convert.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: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .As = %As.decl +// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %As.decl: %As.type.b51 = interface_decl @As [concrete = constants.%As.generic] { +// CHECK:STDOUT: %Dest.patt.loc8_14.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc8_14.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { +// CHECK:STDOUT: %Dest.patt.loc12_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc12_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(%Dest.loc8_14.1: type) { +// CHECK:STDOUT: %Dest.loc8_14.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc8_14.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest.loc8_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.loc8_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.loc9_35.2: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_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.loc9_20.1 (%Self.as_type.7f0) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @As.%Dest.loc8_14.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param call_param0 +// CHECK:STDOUT: %.loc9_20.1: type = splice_block %.loc9_20.3 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] { +// CHECK:STDOUT: %.loc9_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, %.loc9_20.2 [symbolic = %Self (constants.%Self.b4e)] +// CHECK:STDOUT: %Self.as_type.loc9_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: %.loc9_20.3: type = converted %Self.ref, %Self.as_type.loc9_20.2 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.1.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.1.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc9_35.1: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_35.2 (constants.%assoc0.ac5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc9_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc12_22.1: type) { +// CHECK:STDOUT: %Dest.loc12_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc12_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc12_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.loc12_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.loc14_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_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.loc14_20.1 (%Self.as_type.419) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc12_22.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param call_param0 +// CHECK:STDOUT: %.loc14_20.1: type = splice_block %.loc14_20.3 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] { +// CHECK:STDOUT: %.loc14_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, %.loc14_20.2 [symbolic = %Self (constants.%Self.0f3)] +// CHECK:STDOUT: %Self.as_type.loc14_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: %.loc14_20.3: type = converted %Self.ref, %Self.as_type.loc14_20.2 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.2.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.2.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc14_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_35.2 (constants.%assoc0.a50)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc14_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(@As.%Dest.loc8_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.loc9_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(@ImplicitAs.%Dest.loc12_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.loc14_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419)]() -> @Convert.2.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc8_14.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc8_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.loc9_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.loc8_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc12_22.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc12_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.loc14_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.loc12_22.2) {} +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtin_conversions/no_prelude/fail_convert_type_erased_type_to_facet.carbon b/toolchain/check/testdata/facet/min_prelude/fail_convert_type_erased_type_to_facet.carbon similarity index 75% rename from toolchain/check/testdata/builtin_conversions/no_prelude/fail_convert_type_erased_type_to_facet.carbon rename to toolchain/check/testdata/facet/min_prelude/fail_convert_type_erased_type_to_facet.carbon index 3289b54e26ba..242efe47cd9f 100644 --- a/toolchain/check/testdata/builtin_conversions/no_prelude/fail_convert_type_erased_type_to_facet.carbon +++ b/toolchain/check/testdata/facet/min_prelude/fail_convert_type_erased_type_to_facet.carbon @@ -2,29 +2,14 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// INCLUDE-FILE: toolchain/testing/min_prelude/convert.carbon +// EXTRA-ARGS: --custom-core +// // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtin_conversions/no_prelude/fail_convert_type_erased_type_to_facet.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/facet/min_prelude/fail_convert_type_erased_type_to_facet.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtin_conversions/no_prelude/fail_convert_type_erased_type_to_facet.carbon - -// --- core.carbon - -package Core; - -interface As(Dest:! type) { - fn Convert[self: Self]() -> Dest; -} - -interface ImplicitAs(Dest:! type) { - fn Convert[self: Self]() -> Dest; -} - -// --- fail_convert_type_erased_type_to_facet.carbon - -library "[[@TEST_NAME]]"; - -import Core; +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/facet/min_prelude/fail_convert_type_erased_type_to_facet.carbon interface Animal {} @@ -48,182 +33,6 @@ fn F() { WalkAnimal(x); } -// 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: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .As = %As.decl -// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %As.decl: %As.type.b51 = interface_decl @As [concrete = constants.%As.generic] { -// CHECK:STDOUT: %Dest.patt.loc4_14.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc4_14.2 (constants.%Dest.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.loc4_14.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc4_14.2 (constants.%Dest)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { -// CHECK:STDOUT: %Dest.patt.loc8_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_22.2 (constants.%Dest.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.loc8_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_22.2 (constants.%Dest)] -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic interface @As(%Dest.loc4_14.1: type) { -// CHECK:STDOUT: %Dest.loc4_14.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc4_14.2 (constants.%Dest)] -// CHECK:STDOUT: %Dest.patt.loc4_14.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc4_14.2 (constants.%Dest.patt)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest.loc4_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.loc4_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.loc5_35.2: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc5_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.loc5_20.1 (%Self.as_type.7f0) = binding_pattern self -// CHECK:STDOUT: %self.param_patt: @Convert.1.%Self.as_type.loc5_20.1 (%Self.as_type.7f0) = value_param_pattern %self.patt, call_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, call_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @As.%Dest.loc4_14.1 [symbolic = %Dest (constants.%Dest)] -// CHECK:STDOUT: %self.param: @Convert.1.%Self.as_type.loc5_20.1 (%Self.as_type.7f0) = 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.7f0)] { -// CHECK:STDOUT: %.loc5_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, %.loc5_20.2 [symbolic = %Self (constants.%Self.b4e)] -// 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.7f0)] -// 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.7f0)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: @Convert.1.%Self.as_type.loc5_20.1 (%Self.as_type.7f0) = bind_name self, %self.param -// CHECK:STDOUT: %return.param: ref @Convert.1.%Dest (%Dest) = out_param call_param1 -// CHECK:STDOUT: %return: ref @Convert.1.%Dest (%Dest) = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %assoc0.loc5_35.1: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc5_35.2 (constants.%assoc0.ac5)] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .Dest = -// CHECK:STDOUT: .Convert = %assoc0.loc5_35.1 -// CHECK:STDOUT: witness = (%Convert.decl) -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc8_22.1: type) { -// CHECK:STDOUT: %Dest.loc8_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_22.2 (constants.%Dest)] -// CHECK:STDOUT: %Dest.patt.loc8_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_22.2 (constants.%Dest.patt)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc8_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.loc8_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.loc9_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_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.loc9_20.1 (%Self.as_type.419) = binding_pattern self -// CHECK:STDOUT: %self.param_patt: @Convert.2.%Self.as_type.loc9_20.1 (%Self.as_type.419) = value_param_pattern %self.patt, call_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, call_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc8_22.1 [symbolic = %Dest (constants.%Dest)] -// CHECK:STDOUT: %self.param: @Convert.2.%Self.as_type.loc9_20.1 (%Self.as_type.419) = value_param call_param0 -// CHECK:STDOUT: %.loc9_20.1: type = splice_block %.loc9_20.3 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.419)] { -// CHECK:STDOUT: %.loc9_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, %.loc9_20.2 [symbolic = %Self (constants.%Self.0f3)] -// CHECK:STDOUT: %Self.as_type.loc9_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.419)] -// CHECK:STDOUT: %.loc9_20.3: type = converted %Self.ref, %Self.as_type.loc9_20.2 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.419)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: @Convert.2.%Self.as_type.loc9_20.1 (%Self.as_type.419) = bind_name self, %self.param -// CHECK:STDOUT: %return.param: ref @Convert.2.%Dest (%Dest) = out_param call_param1 -// CHECK:STDOUT: %return: ref @Convert.2.%Dest (%Dest) = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %assoc0.loc9_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_35.2 (constants.%assoc0.a50)] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .Dest = -// CHECK:STDOUT: .Convert = %assoc0.loc9_35.1 -// CHECK:STDOUT: witness = (%Convert.decl) -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert.1(@As.%Dest.loc4_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.loc5_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type.7f0)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self.as_type.loc5_20.1 (%Self.as_type.7f0)]() -> @Convert.1.%Dest (%Dest); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert.2(@ImplicitAs.%Dest.loc8_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.loc9_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.419)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Convert.2.%Self.as_type.loc9_20.1 (%Self.as_type.419)]() -> @Convert.2.%Dest (%Dest); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @As(constants.%Dest) { -// CHECK:STDOUT: %Dest.loc4_14.2 => constants.%Dest -// CHECK:STDOUT: %Dest.patt.loc4_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.loc5_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.loc4_14.2) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { -// CHECK:STDOUT: %Dest.loc8_22.2 => constants.%Dest -// CHECK:STDOUT: %Dest.patt.loc8_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.loc9_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.loc8_22.2) {} -// CHECK:STDOUT: // CHECK:STDOUT: --- fail_convert_type_erased_type_to_facet.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -261,15 +70,15 @@ fn F() { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs -// CHECK:STDOUT: import Core//default +// CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import_ref.5ab3ec.1: type = import_ref Core//default, loc8_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] -// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst65 [no loc], unloaded -// CHECK:STDOUT: %Core.import_ref.630: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = import_ref Core//default, loc9_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.43d)] -// CHECK:STDOUT: %Core.Convert = import_ref Core//default, Convert, unloaded -// CHECK:STDOUT: %Core.import_ref.5ab3ec.2: type = import_ref Core//default, loc8_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] -// CHECK:STDOUT: %Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) = import_ref Core//default, inst65 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] -// CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, loc9_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] +// CHECK:STDOUT: %Core.import_ref.5ab3ec.1: type = import_ref Core//prelude, loc12_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//prelude, inst65 [no loc], unloaded +// CHECK:STDOUT: %Core.import_ref.630: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = import_ref Core//prelude, loc14_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.43d)] +// CHECK:STDOUT: %Core.Convert = import_ref Core//prelude, Convert, unloaded +// CHECK:STDOUT: %Core.import_ref.5ab3ec.2: type = import_ref Core//prelude, loc12_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) = import_ref Core//prelude, inst65 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] +// CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//prelude, loc14_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -289,10 +98,10 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: %impl_witness: = impl_witness () [concrete = constants.%impl_witness] // CHECK:STDOUT: %WalkAnimal.decl: %WalkAnimal.type = fn_decl @WalkAnimal [concrete = constants.%WalkAnimal] { -// CHECK:STDOUT: %a.patt.loc11_15.1: %Animal.type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc11_15.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.patt.loc19_15.1: %Animal.type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc19_15.2 (constants.%a.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: %a.loc11_15.1: %Animal.type = bind_symbolic_name a, 0 [symbolic = %a.loc11_15.2 (constants.%a)] +// CHECK:STDOUT: %a.loc19_15.1: %Animal.type = bind_symbolic_name a, 0 [symbolic = %a.loc19_15.2 (constants.%a)] // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: } @@ -305,7 +114,7 @@ fn F() { // CHECK:STDOUT: witness = () // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.5ab3ec.1: type) [from "core.carbon"] { +// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.5ab3ec.1: type) [from "toolchain/testing/min_prelude/convert.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: @@ -338,13 +147,13 @@ fn F() { // CHECK:STDOUT: .Self = constants.%Goat // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @WalkAnimal(%a.loc11_15.1: %Animal.type) { -// CHECK:STDOUT: %a.loc11_15.2: %Animal.type = bind_symbolic_name a, 0 [symbolic = %a.loc11_15.2 (constants.%a)] -// CHECK:STDOUT: %a.patt.loc11_15.2: %Animal.type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc11_15.2 (constants.%a.patt)] +// CHECK:STDOUT: generic fn @WalkAnimal(%a.loc19_15.1: %Animal.type) { +// CHECK:STDOUT: %a.loc19_15.2: %Animal.type = bind_symbolic_name a, 0 [symbolic = %a.loc19_15.2 (constants.%a)] +// CHECK:STDOUT: %a.patt.loc19_15.2: %Animal.type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc19_15.2 (constants.%a.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: fn(%a.patt.loc11_15.1: %Animal.type) { +// CHECK:STDOUT: fn(%a.patt.loc19_15.1: %Animal.type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -359,11 +168,11 @@ fn F() { // CHECK:STDOUT: %x: type = bind_symbolic_name x, 0, %Goat.ref [symbolic = constants.%x] // CHECK:STDOUT: %WalkAnimal.ref: %WalkAnimal.type = name_ref WalkAnimal, file.%WalkAnimal.decl [concrete = constants.%WalkAnimal] // CHECK:STDOUT: %x.ref: type = name_ref x, %x [symbolic = constants.%x] -// CHECK:STDOUT: %.loc25: %Animal.type = converted %x.ref, [concrete = ] +// CHECK:STDOUT: %.loc33: %Animal.type = converted %x.ref, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.5ab3ec.2: type, imports.%Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62)) [from "core.carbon"] { +// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.5ab3ec.2: type, imports.%Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62)) [from "toolchain/testing/min_prelude/convert.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)] @@ -373,8 +182,8 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @WalkAnimal(constants.%a) { -// CHECK:STDOUT: %a.loc11_15.2 => constants.%a -// CHECK:STDOUT: %a.patt.loc11_15.2 => constants.%a +// CHECK:STDOUT: %a.loc19_15.2 => constants.%a +// CHECK:STDOUT: %a.patt.loc19_15.2 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { @@ -406,3 +215,179 @@ fn F() { // CHECK:STDOUT: %assoc0 => constants.%assoc0.560 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: --- toolchain/testing/min_prelude/convert.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: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .As = %As.decl +// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %As.decl: %As.type.b51 = interface_decl @As [concrete = constants.%As.generic] { +// CHECK:STDOUT: %Dest.patt.loc8_14.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc8_14.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { +// CHECK:STDOUT: %Dest.patt.loc12_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc12_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(%Dest.loc8_14.1: type) { +// CHECK:STDOUT: %Dest.loc8_14.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc8_14.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest.loc8_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.loc8_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.loc9_35.2: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_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.loc9_20.1 (%Self.as_type.7f0) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @As.%Dest.loc8_14.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param call_param0 +// CHECK:STDOUT: %.loc9_20.1: type = splice_block %.loc9_20.3 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] { +// CHECK:STDOUT: %.loc9_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, %.loc9_20.2 [symbolic = %Self (constants.%Self.b4e)] +// CHECK:STDOUT: %Self.as_type.loc9_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: %.loc9_20.3: type = converted %Self.ref, %Self.as_type.loc9_20.2 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.1.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.1.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc9_35.1: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_35.2 (constants.%assoc0.ac5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc9_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc12_22.1: type) { +// CHECK:STDOUT: %Dest.loc12_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc12_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc12_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.loc12_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.loc14_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_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.loc14_20.1 (%Self.as_type.419) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc12_22.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param call_param0 +// CHECK:STDOUT: %.loc14_20.1: type = splice_block %.loc14_20.3 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] { +// CHECK:STDOUT: %.loc14_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, %.loc14_20.2 [symbolic = %Self (constants.%Self.0f3)] +// CHECK:STDOUT: %Self.as_type.loc14_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: %.loc14_20.3: type = converted %Self.ref, %Self.as_type.loc14_20.2 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.2.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.2.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc14_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_35.2 (constants.%assoc0.a50)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc14_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(@As.%Dest.loc8_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.loc9_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(@ImplicitAs.%Dest.loc12_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.loc14_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419)]() -> @Convert.2.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc8_14.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc8_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.loc9_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.loc8_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc12_22.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc12_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.loc14_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.loc12_22.2) {} +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtin_conversions/no_prelude/fail_deduction_uses_runtime_type_conversion.carbon b/toolchain/check/testdata/facet/min_prelude/fail_deduction_uses_runtime_type_conversion.carbon similarity index 55% rename from toolchain/check/testdata/builtin_conversions/no_prelude/fail_deduction_uses_runtime_type_conversion.carbon rename to toolchain/check/testdata/facet/min_prelude/fail_deduction_uses_runtime_type_conversion.carbon index 643f40e4651b..cbbed7e95e37 100644 --- a/toolchain/check/testdata/builtin_conversions/no_prelude/fail_deduction_uses_runtime_type_conversion.carbon +++ b/toolchain/check/testdata/facet/min_prelude/fail_deduction_uses_runtime_type_conversion.carbon @@ -2,23 +2,14 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// INCLUDE-FILE: toolchain/testing/min_prelude/convert.carbon +// EXTRA-ARGS: --custom-core +// // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtin_conversions/no_prelude/fail_deduction_uses_runtime_type_conversion.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/facet/min_prelude/fail_deduction_uses_runtime_type_conversion.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtin_conversions/no_prelude/fail_deduction_uses_runtime_type_conversion.carbon - -// --- core.carbon - -package Core; - -interface ImplicitAs(Dest:! type) { - fn Convert[self: Self]() -> Dest; -} - -// --- fail_deduction_uses_runtime_type_conversion.carbon - -import Core; +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/facet/min_prelude/fail_deduction_uses_runtime_type_conversion.carbon // Uses a tuple to allow using the inner type as a type that isn't directly // deducible, without deducing through HoldsType. @@ -49,100 +40,6 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, ))) { F(from, holds_to); } -// CHECK:STDOUT: --- core.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic] -// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic] -// CHECK:STDOUT: %ImplicitAs.type.96f: type = generic_interface_type @ImplicitAs [concrete] -// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.96f = struct_value () [concrete] -// CHECK:STDOUT: %ImplicitAs.type.07f: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic] -// CHECK:STDOUT: %Self: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] -// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic] -// CHECK:STDOUT: %Convert: %Convert.type = struct_value () [symbolic] -// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type %ImplicitAs.type.07f [symbolic] -// CHECK:STDOUT: %assoc0: %ImplicitAs.assoc_type = assoc_entity element0, @ImplicitAs.%Convert.decl [symbolic] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { -// CHECK:STDOUT: %Dest.patt.loc4_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc4_22.2 (constants.%Dest.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.loc4_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc4_22.2 (constants.%Dest)] -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc4_22.1: type) { -// CHECK:STDOUT: %Dest.loc4_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc4_22.2 (constants.%Dest)] -// CHECK:STDOUT: %Dest.patt.loc4_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc4_22.2 (constants.%Dest.patt)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc4_22.2)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.07f)] -// CHECK:STDOUT: %Self.2: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest.loc4_22.2) [symbolic = %Convert.type (constants.%Convert.type)] -// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type) = struct_value () [symbolic = %Convert (constants.%Convert)] -// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type)] -// CHECK:STDOUT: %assoc0.loc5_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc5_35.2 (constants.%assoc0)] -// CHECK:STDOUT: -// CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %Convert.decl: @ImplicitAs.%Convert.type (%Convert.type) = fn_decl @Convert [symbolic = @ImplicitAs.%Convert (constants.%Convert)] { -// CHECK:STDOUT: %self.patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = binding_pattern self -// CHECK:STDOUT: %self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = value_param_pattern %self.patt, call_param0 -// CHECK:STDOUT: %return.patt: @Convert.%Dest (%Dest) = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: @Convert.%Dest (%Dest) = out_param_pattern %return.patt, call_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc4_22.1 [symbolic = %Dest (constants.%Dest)] -// CHECK:STDOUT: %self.param: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc5_20.1: type = splice_block %.loc5_20.3 [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] { -// CHECK:STDOUT: %.loc5_20.2: @Convert.%ImplicitAs.type (%ImplicitAs.type.07f) = specific_constant @ImplicitAs.%Self.1, @ImplicitAs(constants.%Dest) [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.ref: @Convert.%ImplicitAs.type (%ImplicitAs.type.07f) = name_ref Self, %.loc5_20.2 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc5_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc5_20.3: type = converted %Self.ref, %Self.as_type.loc5_20.2 [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = bind_name self, %self.param -// CHECK:STDOUT: %return.param: ref @Convert.%Dest (%Dest) = out_param call_param1 -// CHECK:STDOUT: %return: ref @Convert.%Dest (%Dest) = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %assoc0.loc5_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc5_35.2 (constants.%assoc0)] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .Dest = -// CHECK:STDOUT: .Convert = %assoc0.loc5_35.1 -// CHECK:STDOUT: witness = (%Convert.decl) -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert(@ImplicitAs.%Dest.loc4_22.1: type, @ImplicitAs.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f)) { -// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.07f)] -// CHECK:STDOUT: %Self: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc5_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type)]() -> @Convert.%Dest (%Dest); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { -// CHECK:STDOUT: %Dest.loc4_22.2 => constants.%Dest -// CHECK:STDOUT: %Dest.patt.loc4_22.2 => constants.%Dest -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self) { -// CHECK:STDOUT: %Dest => constants.%Dest -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.07f -// CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.as_type.loc5_20.1 => constants.%Self.as_type -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(%Dest.loc4_22.2) {} -// CHECK:STDOUT: // CHECK:STDOUT: --- fail_deduction_uses_runtime_type_conversion.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -200,16 +97,16 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, ))) { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs -// CHECK:STDOUT: import Core//default +// CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: } -// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//default, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] -// CHECK:STDOUT: %Core.import_ref.5ab3ec.1: type = import_ref Core//default, loc4_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] -// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst24 [no loc], unloaded -// CHECK:STDOUT: %Core.import_ref.630: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = import_ref Core//default, loc5_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.43d)] -// CHECK:STDOUT: %Core.Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, Convert, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] -// CHECK:STDOUT: %Core.import_ref.5ab3ec.2: type = import_ref Core//default, loc4_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] -// CHECK:STDOUT: %Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) = import_ref Core//default, inst24 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self)] -// CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, loc5_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] +// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] +// CHECK:STDOUT: %Core.import_ref.5ab3ec.1: type = import_ref Core//prelude, loc12_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//prelude, inst65 [no loc], unloaded +// CHECK:STDOUT: %Core.import_ref.630: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = import_ref Core//prelude, loc14_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.43d)] +// CHECK:STDOUT: %Core.Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//prelude, Convert, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] +// CHECK:STDOUT: %Core.import_ref.5ab3ec.2: type = import_ref Core//prelude, loc12_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) = import_ref Core//prelude, inst65 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self)] +// CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//prelude, loc14_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -223,13 +120,13 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, ))) { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %HoldsType.decl: %HoldsType.type = class_decl @HoldsType [concrete = constants.%HoldsType.generic] { -// CHECK:STDOUT: %T.patt.loc6_17.1: %tuple.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_17.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc16_17.1: %tuple.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc16_17.2 (constants.%T.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc6_28.1: type = splice_block %.loc6_28.3 [concrete = constants.%tuple.type] { -// CHECK:STDOUT: %.loc6_28.2: %tuple.type = tuple_literal (type) -// CHECK:STDOUT: %.loc6_28.3: type = converted %.loc6_28.2, constants.%tuple.type [concrete = constants.%tuple.type] +// CHECK:STDOUT: %.loc16_28.1: type = splice_block %.loc16_28.3 [concrete = constants.%tuple.type] { +// CHECK:STDOUT: %.loc16_28.2: %tuple.type = tuple_literal (type) +// CHECK:STDOUT: %.loc16_28.3: type = converted %.loc16_28.2, constants.%tuple.type [concrete = constants.%tuple.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc6_17.1: %tuple.type = bind_symbolic_name T, 0 [symbolic = %T.loc6_17.2 (constants.%T)] +// CHECK:STDOUT: %T.loc16_17.1: %tuple.type = bind_symbolic_name T, 0 [symbolic = %T.loc16_17.2 (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: %RuntimeConvertFrom.decl: type = class_decl @RuntimeConvertFrom [concrete = constants.%RuntimeConvertFrom] {} {} // CHECK:STDOUT: %RuntimeConvertTo.decl: type = class_decl @RuntimeConvertTo [concrete = constants.%RuntimeConvertTo] {} {} @@ -242,48 +139,48 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, ))) { // CHECK:STDOUT: } // CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%Convert.decl) [concrete = constants.%impl_witness] // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { -// CHECK:STDOUT: %T.patt.loc16_6.1: %tuple.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc16_6.2 (constants.%T.patt)] -// CHECK:STDOUT: %A.patt.loc16_20.1: @F.%tuple.elem0.loc16_25.2 (%tuple.elem0) = symbolic_binding_pattern A, 1 [symbolic = %A.patt.loc16_20.2 (constants.%A.patt)] -// CHECK:STDOUT: %x.patt: @F.%HoldsType.loc16_43.2 (%HoldsType.cc9) = binding_pattern x -// CHECK:STDOUT: %x.param_patt: @F.%HoldsType.loc16_43.2 (%HoldsType.cc9) = value_param_pattern %x.patt, call_param0 +// CHECK:STDOUT: %T.patt.loc26_6.1: %tuple.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc26_6.2 (constants.%T.patt)] +// CHECK:STDOUT: %A.patt.loc26_20.1: @F.%tuple.elem0.loc26_25.2 (%tuple.elem0) = symbolic_binding_pattern A, 1 [symbolic = %A.patt.loc26_20.2 (constants.%A.patt)] +// CHECK:STDOUT: %x.patt: @F.%HoldsType.loc26_43.2 (%HoldsType.cc9) = binding_pattern x +// CHECK:STDOUT: %x.param_patt: @F.%HoldsType.loc26_43.2 (%HoldsType.cc9) = value_param_pattern %x.patt, call_param0 // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc16_17.1: type = splice_block %.loc16_17.3 [concrete = constants.%tuple.type] { -// CHECK:STDOUT: %.loc16_17.2: %tuple.type = tuple_literal (type) -// CHECK:STDOUT: %.loc16_17.3: type = converted %.loc16_17.2, constants.%tuple.type [concrete = constants.%tuple.type] +// CHECK:STDOUT: %.loc26_17.1: type = splice_block %.loc26_17.3 [concrete = constants.%tuple.type] { +// CHECK:STDOUT: %.loc26_17.2: %tuple.type = tuple_literal (type) +// CHECK:STDOUT: %.loc26_17.3: type = converted %.loc26_17.2, constants.%tuple.type [concrete = constants.%tuple.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc16_6.1: %tuple.type = bind_symbolic_name T, 0 [symbolic = %T.loc16_6.2 (constants.%T)] -// CHECK:STDOUT: %.loc16_25: type = splice_block %tuple.elem0.loc16_25.1 [symbolic = %tuple.elem0.loc16_25.2 (constants.%tuple.elem0)] { -// CHECK:STDOUT: %T.ref.loc16_24: %tuple.type = name_ref T, %T.loc16_6.1 [symbolic = %T.loc16_6.2 (constants.%T)] +// CHECK:STDOUT: %T.loc26_6.1: %tuple.type = bind_symbolic_name T, 0 [symbolic = %T.loc26_6.2 (constants.%T)] +// CHECK:STDOUT: %.loc26_25: type = splice_block %tuple.elem0.loc26_25.1 [symbolic = %tuple.elem0.loc26_25.2 (constants.%tuple.elem0)] { +// CHECK:STDOUT: %T.ref.loc26_24: %tuple.type = name_ref T, %T.loc26_6.1 [symbolic = %T.loc26_6.2 (constants.%T)] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] -// CHECK:STDOUT: %tuple.elem0.loc16_25.1: type = tuple_access %T.ref.loc16_24, element0 [symbolic = %tuple.elem0.loc16_25.2 (constants.%tuple.elem0)] +// CHECK:STDOUT: %tuple.elem0.loc26_25.1: type = tuple_access %T.ref.loc26_24, element0 [symbolic = %tuple.elem0.loc26_25.2 (constants.%tuple.elem0)] // CHECK:STDOUT: } -// CHECK:STDOUT: %A.loc16_20.1: @F.%tuple.elem0.loc16_25.2 (%tuple.elem0) = bind_symbolic_name A, 1 [symbolic = %A.loc16_20.2 (constants.%A)] -// CHECK:STDOUT: %x.param: @F.%HoldsType.loc16_43.2 (%HoldsType.cc9) = value_param call_param0 -// CHECK:STDOUT: %.loc16_43: type = splice_block %HoldsType.loc16_43.1 [symbolic = %HoldsType.loc16_43.2 (constants.%HoldsType.cc9)] { +// CHECK:STDOUT: %A.loc26_20.1: @F.%tuple.elem0.loc26_25.2 (%tuple.elem0) = bind_symbolic_name A, 1 [symbolic = %A.loc26_20.2 (constants.%A)] +// CHECK:STDOUT: %x.param: @F.%HoldsType.loc26_43.2 (%HoldsType.cc9) = value_param call_param0 +// CHECK:STDOUT: %.loc26_43: type = splice_block %HoldsType.loc26_43.1 [symbolic = %HoldsType.loc26_43.2 (constants.%HoldsType.cc9)] { // CHECK:STDOUT: %HoldsType.ref: %HoldsType.type = name_ref HoldsType, file.%HoldsType.decl [concrete = constants.%HoldsType.generic] -// CHECK:STDOUT: %T.ref.loc16_42: %tuple.type = name_ref T, %T.loc16_6.1 [symbolic = %T.loc16_6.2 (constants.%T)] -// CHECK:STDOUT: %HoldsType.loc16_43.1: type = class_type @HoldsType, @HoldsType(constants.%T) [symbolic = %HoldsType.loc16_43.2 (constants.%HoldsType.cc9)] +// CHECK:STDOUT: %T.ref.loc26_42: %tuple.type = name_ref T, %T.loc26_6.1 [symbolic = %T.loc26_6.2 (constants.%T)] +// CHECK:STDOUT: %HoldsType.loc26_43.1: type = class_type @HoldsType, @HoldsType(constants.%T) [symbolic = %HoldsType.loc26_43.2 (constants.%HoldsType.cc9)] // CHECK:STDOUT: } -// CHECK:STDOUT: %x: @F.%HoldsType.loc16_43.2 (%HoldsType.cc9) = bind_name x, %x.param +// CHECK:STDOUT: %x: @F.%HoldsType.loc26_43.2 (%HoldsType.cc9) = bind_name x, %x.param // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] { // CHECK:STDOUT: %holds_to.patt: %HoldsType.066 = binding_pattern holds_to // CHECK:STDOUT: %holds_to.param_patt: %HoldsType.066 = value_param_pattern %holds_to.patt, call_param0 // CHECK:STDOUT: } { // CHECK:STDOUT: %holds_to.param: %HoldsType.066 = value_param call_param0 -// CHECK:STDOUT: %.loc18_46.1: type = splice_block %HoldsType [concrete = constants.%HoldsType.066] { +// CHECK:STDOUT: %.loc28_46.1: type = splice_block %HoldsType [concrete = constants.%HoldsType.066] { // CHECK:STDOUT: %HoldsType.ref: %HoldsType.type = name_ref HoldsType, file.%HoldsType.decl [concrete = constants.%HoldsType.generic] // CHECK:STDOUT: %RuntimeConvertTo.ref: type = name_ref RuntimeConvertTo, file.%RuntimeConvertTo.decl [concrete = constants.%RuntimeConvertTo] -// CHECK:STDOUT: %.loc18_45: %tuple.type = tuple_literal (%RuntimeConvertTo.ref) +// CHECK:STDOUT: %.loc28_45: %tuple.type = tuple_literal (%RuntimeConvertTo.ref) // CHECK:STDOUT: %tuple: %tuple.type = tuple_value (%RuntimeConvertTo.ref) [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc18_46.2: %tuple.type = converted %.loc18_45, %tuple [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc28_46.2: %tuple.type = converted %.loc28_45, %tuple [concrete = constants.%tuple] // CHECK:STDOUT: %HoldsType: type = class_type @HoldsType, @HoldsType(constants.%tuple) [concrete = constants.%HoldsType.066] // CHECK:STDOUT: } // CHECK:STDOUT: %holds_to: %HoldsType.066 = bind_name holds_to, %holds_to.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.5ab3ec.1: type) [from "core.carbon"] { +// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.5ab3ec.1: type) [from "toolchain/testing/min_prelude/convert.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: @@ -324,9 +221,9 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, ))) { // CHECK:STDOUT: witness = file.%impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @HoldsType(%T.loc6_17.1: %tuple.type) { -// CHECK:STDOUT: %T.loc6_17.2: %tuple.type = bind_symbolic_name T, 0 [symbolic = %T.loc6_17.2 (constants.%T)] -// CHECK:STDOUT: %T.patt.loc6_17.2: %tuple.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_17.2 (constants.%T.patt)] +// CHECK:STDOUT: generic class @HoldsType(%T.loc16_17.1: %tuple.type) { +// CHECK:STDOUT: %T.loc16_17.2: %tuple.type = bind_symbolic_name T, 0 [symbolic = %T.loc16_17.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc16_17.2: %tuple.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc16_17.2 (constants.%T.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -355,7 +252,7 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, ))) { // CHECK:STDOUT: .Self = constants.%RuntimeConvertTo // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert.1(imports.%Core.import_ref.5ab3ec.2: type, imports.%Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62)) [from "core.carbon"] { +// CHECK:STDOUT: generic fn @Convert.1(imports.%Core.import_ref.5ab3ec.2: type, imports.%Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62)) [from "toolchain/testing/min_prelude/convert.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)] @@ -366,24 +263,24 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, ))) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Convert.2[%self.param_patt: %RuntimeConvertFrom]() -> %return.param_patt: %RuntimeConvertTo { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc13_58.1: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %.loc13_58.2: init %RuntimeConvertTo = class_init (), %return [concrete = constants.%RuntimeConvertTo.val] -// CHECK:STDOUT: %.loc13_59: init %RuntimeConvertTo = converted %.loc13_58.1, %.loc13_58.2 [concrete = constants.%RuntimeConvertTo.val] -// CHECK:STDOUT: return %.loc13_59 to %return +// CHECK:STDOUT: %.loc23_58.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc23_58.2: init %RuntimeConvertTo = class_init (), %return [concrete = constants.%RuntimeConvertTo.val] +// CHECK:STDOUT: %.loc23_59: init %RuntimeConvertTo = converted %.loc23_58.1, %.loc23_58.2 [concrete = constants.%RuntimeConvertTo.val] +// CHECK:STDOUT: return %.loc23_59 to %return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F(%T.loc16_6.1: %tuple.type, %A.loc16_20.1: @F.%tuple.elem0.loc16_25.2 (%tuple.elem0)) { -// CHECK:STDOUT: %T.loc16_6.2: %tuple.type = bind_symbolic_name T, 0 [symbolic = %T.loc16_6.2 (constants.%T)] -// CHECK:STDOUT: %T.patt.loc16_6.2: %tuple.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc16_6.2 (constants.%T.patt)] -// CHECK:STDOUT: %tuple.elem0.loc16_25.2: type = tuple_access %T.loc16_6.2, element0 [symbolic = %tuple.elem0.loc16_25.2 (constants.%tuple.elem0)] -// CHECK:STDOUT: %A.loc16_20.2: %tuple.elem0 = bind_symbolic_name A, 1 [symbolic = %A.loc16_20.2 (constants.%A)] -// CHECK:STDOUT: %A.patt.loc16_20.2: %tuple.elem0 = symbolic_binding_pattern A, 1 [symbolic = %A.patt.loc16_20.2 (constants.%A.patt)] -// CHECK:STDOUT: %HoldsType.loc16_43.2: type = class_type @HoldsType, @HoldsType(%T.loc16_6.2) [symbolic = %HoldsType.loc16_43.2 (constants.%HoldsType.cc9)] +// CHECK:STDOUT: generic fn @F(%T.loc26_6.1: %tuple.type, %A.loc26_20.1: @F.%tuple.elem0.loc26_25.2 (%tuple.elem0)) { +// CHECK:STDOUT: %T.loc26_6.2: %tuple.type = bind_symbolic_name T, 0 [symbolic = %T.loc26_6.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc26_6.2: %tuple.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc26_6.2 (constants.%T.patt)] +// CHECK:STDOUT: %tuple.elem0.loc26_25.2: type = tuple_access %T.loc26_6.2, element0 [symbolic = %tuple.elem0.loc26_25.2 (constants.%tuple.elem0)] +// CHECK:STDOUT: %A.loc26_20.2: %tuple.elem0 = bind_symbolic_name A, 1 [symbolic = %A.loc26_20.2 (constants.%A)] +// CHECK:STDOUT: %A.patt.loc26_20.2: %tuple.elem0 = symbolic_binding_pattern A, 1 [symbolic = %A.patt.loc26_20.2 (constants.%A.patt)] +// CHECK:STDOUT: %HoldsType.loc26_43.2: type = class_type @HoldsType, @HoldsType(%T.loc26_6.2) [symbolic = %HoldsType.loc26_43.2 (constants.%HoldsType.cc9)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type @F.%HoldsType.loc16_43.2 (%HoldsType.cc9) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type @F.%HoldsType.loc26_43.2 (%HoldsType.cc9) [symbolic = %require_complete (constants.%require_complete)] // CHECK:STDOUT: -// CHECK:STDOUT: fn[%T.patt.loc16_6.1: %tuple.type](%A.patt.loc16_20.1: @F.%tuple.elem0.loc16_25.2 (%tuple.elem0), %x.param_patt: @F.%HoldsType.loc16_43.2 (%HoldsType.cc9)) { +// CHECK:STDOUT: fn[%T.patt.loc26_6.1: %tuple.type](%A.patt.loc26_20.1: @F.%tuple.elem0.loc26_25.2 (%tuple.elem0), %x.param_patt: @F.%HoldsType.loc26_43.2 (%HoldsType.cc9)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -394,32 +291,32 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, ))) { // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %from.patt: %RuntimeConvertFrom = symbolic_binding_pattern from, 0 [symbolic = constants.%from.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc19_36.1: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %RuntimeConvertFrom.ref.loc19_41: type = name_ref RuntimeConvertFrom, file.%RuntimeConvertFrom.decl [concrete = constants.%RuntimeConvertFrom] -// CHECK:STDOUT: %.loc19_36.2: ref %RuntimeConvertFrom = temporary_storage -// CHECK:STDOUT: %.loc19_36.3: init %RuntimeConvertFrom = class_init (), %.loc19_36.2 [concrete = constants.%RuntimeConvertFrom.val] -// CHECK:STDOUT: %.loc19_36.4: ref %RuntimeConvertFrom = temporary %.loc19_36.2, %.loc19_36.3 -// CHECK:STDOUT: %.loc19_38: ref %RuntimeConvertFrom = converted %.loc19_36.1, %.loc19_36.4 -// CHECK:STDOUT: %RuntimeConvertFrom.ref.loc19_14: type = name_ref RuntimeConvertFrom, file.%RuntimeConvertFrom.decl [concrete = constants.%RuntimeConvertFrom] -// CHECK:STDOUT: %from: %RuntimeConvertFrom = bind_symbolic_name from, 0, %.loc19_38 [symbolic = constants.%from] +// CHECK:STDOUT: %.loc29_36.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %RuntimeConvertFrom.ref.loc29_41: type = name_ref RuntimeConvertFrom, file.%RuntimeConvertFrom.decl [concrete = constants.%RuntimeConvertFrom] +// CHECK:STDOUT: %.loc29_36.2: ref %RuntimeConvertFrom = temporary_storage +// CHECK:STDOUT: %.loc29_36.3: init %RuntimeConvertFrom = class_init (), %.loc29_36.2 [concrete = constants.%RuntimeConvertFrom.val] +// CHECK:STDOUT: %.loc29_36.4: ref %RuntimeConvertFrom = temporary %.loc29_36.2, %.loc29_36.3 +// CHECK:STDOUT: %.loc29_38: ref %RuntimeConvertFrom = converted %.loc29_36.1, %.loc29_36.4 +// CHECK:STDOUT: %RuntimeConvertFrom.ref.loc29_14: type = name_ref RuntimeConvertFrom, file.%RuntimeConvertFrom.decl [concrete = constants.%RuntimeConvertFrom] +// CHECK:STDOUT: %from: %RuntimeConvertFrom = bind_symbolic_name from, 0, %.loc29_38 [symbolic = constants.%from] // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] // CHECK:STDOUT: %from.ref: %RuntimeConvertFrom = name_ref from, %from [symbolic = constants.%from] // CHECK:STDOUT: %holds_to.ref: %HoldsType.066 = name_ref holds_to, %holds_to // CHECK:STDOUT: %impl.elem0: %.31e = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%Convert.e81] // CHECK:STDOUT: %bound_method: = bound_method constants.%from, %impl.elem0 [symbolic = constants.%Convert.bound] -// CHECK:STDOUT: %.loc30_19.1: ref %RuntimeConvertTo = temporary_storage -// CHECK:STDOUT: %Convert.call: init %RuntimeConvertTo = call %bound_method(constants.%from) to %.loc30_19.1 -// CHECK:STDOUT: %.loc30_19.2: init %RuntimeConvertTo = converted constants.%from, %Convert.call -// CHECK:STDOUT: %.loc30_19.3: ref %RuntimeConvertTo = temporary %.loc30_19.1, %.loc30_19.2 -// CHECK:STDOUT: %.loc30_19.4: %RuntimeConvertTo = bind_value %.loc30_19.3 +// CHECK:STDOUT: %.loc40_19.1: ref %RuntimeConvertTo = temporary_storage +// CHECK:STDOUT: %Convert.call: init %RuntimeConvertTo = call %bound_method(constants.%from) to %.loc40_19.1 +// CHECK:STDOUT: %.loc40_19.2: init %RuntimeConvertTo = converted constants.%from, %Convert.call +// CHECK:STDOUT: %.loc40_19.3: ref %RuntimeConvertTo = temporary %.loc40_19.1, %.loc40_19.2 +// CHECK:STDOUT: %.loc40_19.4: %RuntimeConvertTo = bind_value %.loc40_19.3 // CHECK:STDOUT: %F.specific_fn: = specific_function %F.ref, @F(constants.%tuple, ) [concrete = ] // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn(%holds_to.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @HoldsType(constants.%T) { -// CHECK:STDOUT: %T.loc6_17.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc6_17.2 => constants.%T +// CHECK:STDOUT: %T.loc16_17.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc16_17.2 => constants.%T // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } @@ -461,32 +358,208 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, ))) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F(constants.%T, constants.%A) { -// CHECK:STDOUT: %T.loc16_6.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc16_6.2 => constants.%T -// CHECK:STDOUT: %tuple.elem0.loc16_25.2 => constants.%tuple.elem0 -// CHECK:STDOUT: %A.loc16_20.2 => constants.%A -// CHECK:STDOUT: %A.patt.loc16_20.2 => constants.%A -// CHECK:STDOUT: %HoldsType.loc16_43.2 => constants.%HoldsType.cc9 +// CHECK:STDOUT: %T.loc26_6.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc26_6.2 => constants.%T +// CHECK:STDOUT: %tuple.elem0.loc26_25.2 => constants.%tuple.elem0 +// CHECK:STDOUT: %A.loc26_20.2 => constants.%A +// CHECK:STDOUT: %A.patt.loc26_20.2 => constants.%A +// CHECK:STDOUT: %HoldsType.loc26_43.2 => constants.%HoldsType.cc9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @HoldsType(@F.%T.loc16_6.2) {} +// CHECK:STDOUT: specific @HoldsType(@F.%T.loc26_6.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @HoldsType(constants.%tuple) { -// CHECK:STDOUT: %T.loc6_17.2 => constants.%tuple -// CHECK:STDOUT: %T.patt.loc6_17.2 => constants.%tuple +// CHECK:STDOUT: %T.loc16_17.2 => constants.%tuple +// CHECK:STDOUT: %T.patt.loc16_17.2 => constants.%tuple // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F(constants.%tuple, ) { -// CHECK:STDOUT: %T.loc16_6.2 => constants.%tuple -// CHECK:STDOUT: %T.patt.loc16_6.2 => constants.%tuple -// CHECK:STDOUT: %tuple.elem0.loc16_25.2 => constants.%RuntimeConvertTo -// CHECK:STDOUT: %A.loc16_20.2 => -// CHECK:STDOUT: %A.patt.loc16_20.2 => -// CHECK:STDOUT: %HoldsType.loc16_43.2 => constants.%HoldsType.066 +// CHECK:STDOUT: %T.loc26_6.2 => constants.%tuple +// CHECK:STDOUT: %T.patt.loc26_6.2 => constants.%tuple +// CHECK:STDOUT: %tuple.elem0.loc26_25.2 => constants.%RuntimeConvertTo +// CHECK:STDOUT: %A.loc26_20.2 => +// CHECK:STDOUT: %A.patt.loc26_20.2 => +// CHECK:STDOUT: %HoldsType.loc26_43.2 => constants.%HoldsType.066 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete => constants.%complete_type // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: --- toolchain/testing/min_prelude/convert.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: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .As = %As.decl +// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %As.decl: %As.type.b51 = interface_decl @As [concrete = constants.%As.generic] { +// CHECK:STDOUT: %Dest.patt.loc8_14.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc8_14.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { +// CHECK:STDOUT: %Dest.patt.loc12_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc12_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(%Dest.loc8_14.1: type) { +// CHECK:STDOUT: %Dest.loc8_14.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc8_14.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc8_14.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc8_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest.loc8_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.loc8_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.loc9_35.2: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_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.loc9_20.1 (%Self.as_type.7f0) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @As.%Dest.loc8_14.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = value_param call_param0 +// CHECK:STDOUT: %.loc9_20.1: type = splice_block %.loc9_20.3 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] { +// CHECK:STDOUT: %.loc9_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, %.loc9_20.2 [symbolic = %Self (constants.%Self.b4e)] +// CHECK:STDOUT: %Self.as_type.loc9_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: %.loc9_20.3: type = converted %Self.ref, %Self.as_type.loc9_20.2 [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.1.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.1.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc9_35.1: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc9_35.2 (constants.%assoc0.ac5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc9_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc12_22.1: type) { +// CHECK:STDOUT: %Dest.loc12_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc12_22.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc12_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc12_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc12_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.loc12_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.loc14_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_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.loc14_20.1 (%Self.as_type.419) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param_pattern %self.patt, call_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, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc12_22.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param call_param0 +// CHECK:STDOUT: %.loc14_20.1: type = splice_block %.loc14_20.3 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] { +// CHECK:STDOUT: %.loc14_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, %.loc14_20.2 [symbolic = %Self (constants.%Self.0f3)] +// CHECK:STDOUT: %Self.as_type.loc14_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: %.loc14_20.3: type = converted %Self.ref, %Self.as_type.loc14_20.2 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.2.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.2.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc14_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_35.2 (constants.%assoc0.a50)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc14_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(@As.%Dest.loc8_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.loc9_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self.as_type.loc9_20.1 (%Self.as_type.7f0)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(@ImplicitAs.%Dest.loc12_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.loc14_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419)]() -> @Convert.2.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc8_14.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc8_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.loc9_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.loc8_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc12_22.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc12_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.loc14_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.loc12_22.2) {} +// CHECK:STDOUT: diff --git a/toolchain/testing/min_prelude/convert.carbon b/toolchain/testing/min_prelude/convert.carbon new file mode 100644 index 000000000000..e54fdc4bcd8d --- /dev/null +++ b/toolchain/testing/min_prelude/convert.carbon @@ -0,0 +1,15 @@ +// 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 + +// A minimal prelude for testing conversion between types. +package Core library "prelude"; + +interface As(Dest:! type) { + fn Convert[self: Self]() -> Dest; +} + +interface ImplicitAs(Dest:! type) { + // TODO: extend As(Dest); + fn Convert[self: Self]() -> Dest; +}