Просмотр исходного кода

Don't incorrectly find cycle in a generic impl (#4990)

If the `impl as` clause is on a generic interface, the parameters to the
generic may be constrained by _other_ interfaces. This then requires
another impl lookup, but it should be looking for a different impl since
it's for a different interface.

To avoid considering the same impl again, we discard it from
consideration if the interface itself does not match the interface being
queried.

Note that the query FacetType can have more than one interface in it
eventually, and a `context.TODO()` call is left to notify when we run
into this.
Dana Jansens 1 год назад
Родитель
Сommit
2ca3f92131

+ 36 - 4
toolchain/check/impl_lookup.cpp

@@ -7,6 +7,7 @@
 #include "toolchain/check/deduce.h"
 #include "toolchain/check/generic.h"
 #include "toolchain/check/import_ref.h"
+#include "toolchain/check/type_completion.h"
 #include "toolchain/sem_ir/ids.h"
 #include "toolchain/sem_ir/impl.h"
 #include "toolchain/sem_ir/inst.h"
@@ -115,6 +116,7 @@ static auto FindAssociatedImportIRs(Context& context,
 static auto GetWitnessIdForImpl(Context& context, SemIR::LocId loc_id,
                                 SemIR::ConstantId type_const_id,
                                 SemIR::ConstantId interface_const_id,
+                                SemIR::InterfaceId interface_id,
                                 const SemIR::Impl& impl) -> SemIR::InstId {
   // If impl.constraint_id is not symbolic, and doesn't match the query, then
   // we don't need to proceed.
@@ -125,9 +127,15 @@ static auto GetWitnessIdForImpl(Context& context, SemIR::LocId loc_id,
     return SemIR::InstId::None;
   }
 
-  // TODO: If the interface id of the `impl` and the query are not the same,
-  // then we can skip this `impl`. (The interface id is the root of the
-  // constraint, the unique `interface` declaration.)
+  // This is the (single) interface named in the query `interface_const_id`.
+  // If the impl's interface_id differs from the query, then this impl can not
+  // possibly provide the queried interface, and we don't need to proceed.
+  // Unlike the early-out above comparing the `impl.constraint_id`, this also
+  // elides looking at impls of generic interfaces where the interface itself
+  // does not match the query.
+  if (impl.interface.interface_id != interface_id) {
+    return SemIR::InstId::None;
+  }
 
   auto specific_id = SemIR::SpecificId::None;
   // This check comes first to avoid deduction with an invalid impl. We use an
@@ -218,6 +226,30 @@ auto LookupImplWitness(Context& context, SemIR::LocId loc_id,
     }
   }
 
+  // The `interface_id` is the single interface in the `interface_const_id`
+  // facet type. In the future, a facet type may include more than a single
+  // interface, but for now that is unhandled with a TODO.
+  auto interface_id = [&] {
+    auto facet_type_inst_id =
+        context.constant_values().GetInstId(interface_const_id);
+    auto facet_type_id = context.insts()
+                             .GetAs<SemIR::FacetType>(facet_type_inst_id)
+                             .facet_type_id;
+    const auto& facet_type_info = context.facet_types().Get(facet_type_id);
+    if (facet_type_info.impls_constraints.empty()) {
+      context.TODO(loc_id,
+                   "impl lookup for a FacetType with no interface (using "
+                   "`where .Self impls ...` instead?)");
+      return SemIR::InterfaceId::None;
+    }
+    if (facet_type_info.impls_constraints.size() > 1) {
+      context.TODO(loc_id,
+                   "impl lookup for a FacetType with more than one interface");
+      return SemIR::InterfaceId::None;
+    }
+    return facet_type_info.impls_constraints[0].interface_id;
+  }();
+
   auto witness_id = SemIR::InstId::None;
 
   stack.push_back({
@@ -226,7 +258,7 @@ auto LookupImplWitness(Context& context, SemIR::LocId loc_id,
   });
   for (const auto& impl : context.impls().array_ref()) {
     witness_id = GetWitnessIdForImpl(context, loc_id, type_const_id,
-                                     interface_const_id, impl);
+                                     interface_const_id, interface_id, impl);
     if (witness_id.has_value()) {
       // We found a matching impl, don't keep looking.
       break;

+ 222 - 247
toolchain/check/testdata/builtin_conversions/no_prelude/fail_todo_convert_facet_value_value_to_generic_facet_value_value.carbon → toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_value_to_generic_facet_value_value.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/no_prelude/fail_todo_convert_facet_value_value_to_generic_facet_value_value.carbon
+// 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/fail_todo_convert_facet_value_value_to_generic_facet_value_value.carbon
+// 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
 
@@ -16,7 +16,7 @@ interface ImplicitAs(T:! type) {
   fn Convert[self: Self]() -> T;
 }
 
-// --- fail_todo_convert_facet_value_value_to_generic_facet_value_value.carbon
+// --- convert_facet_value_value_to_generic_facet_value_value.carbon
 
 library "[[@TEST_NAME]]";
 
@@ -30,10 +30,9 @@ impl Grass as Edible {}
 interface Animal {}
 interface Eats(Food:! type) {}
 
-// This impl is looked at for "does Goat impl Animal" first, which requires a
-// recursive query in deduction that is the same "does Goat impl Animal", which
-// can land us back looking at this impl again. So we require a way to eliminate
-// this impl without doing deduction in order to avoid the cycle.
+// 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 {}
@@ -43,26 +42,6 @@ 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() {
-  // CHECK:STDERR: fail_todo_convert_facet_value_value_to_generic_facet_value_value.carbon:[[@LINE+20]]:3: error: cycle found in lookup of interface <TODO: interface name> for type `Goat` [ImplLookupCycle]
-  // CHECK:STDERR:   HandleAnimal({} as Goat, {} as Grass);
-  // CHECK:STDERR:   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-  // CHECK:STDERR: fail_todo_convert_facet_value_value_to_generic_facet_value_value.carbon:[[@LINE-12]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
-  // CHECK:STDERR: impl forall [T:! Animal, U:! Edible] T as Eats(U) {}
-  // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-  // CHECK:STDERR: fail_todo_convert_facet_value_value_to_generic_facet_value_value.carbon:[[@LINE-9]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
-  // CHECK:STDERR: fn HandleAnimal[T:! Animal, Food:! Edible](a: T, food: Food) { Feed(a, food); }
-  // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-  // CHECK:STDERR:
-  // CHECK:STDERR: fail_todo_convert_facet_value_value_to_generic_facet_value_value.carbon:[[@LINE+10]]:3: error: cycle found in lookup of interface <TODO: interface name> for type `Goat` [ImplLookupCycle]
-  // CHECK:STDERR:   HandleAnimal({} as Goat, {} as Grass);
-  // CHECK:STDERR:   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-  // CHECK:STDERR: fail_todo_convert_facet_value_value_to_generic_facet_value_value.carbon:[[@LINE-22]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
-  // CHECK:STDERR: impl forall [T:! Animal, U:! Edible] T as Eats(U) {}
-  // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-  // CHECK:STDERR: fail_todo_convert_facet_value_value_to_generic_facet_value_value.carbon:[[@LINE-19]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
-  // CHECK:STDERR: fn HandleAnimal[T:! Animal, Food:! Edible](a: T, food: Food) { Feed(a, food); }
-  // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-  // CHECK:STDERR:
   HandleAnimal({} as Goat, {} as Grass);
 }
 
@@ -162,7 +141,7 @@ fn F() {
 // CHECK:STDOUT:
 // CHECK:STDOUT: specific @ImplicitAs(%T.loc4_22.2) {}
 // CHECK:STDOUT:
-// CHECK:STDOUT: --- fail_todo_convert_facet_value_value_to_generic_facet_value_value.carbon
+// 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]
@@ -262,100 +241,100 @@ fn F() {
 // CHECK:STDOUT:     %Food.loc12_16.1: type = bind_symbolic_name Food, 0, %Food.param [symbolic = %Food.loc12_16.2 (constants.%Food.8b3)]
 // CHECK:STDOUT:   }
 // CHECK:STDOUT:   impl_decl @impl.2 [concrete] {
-// CHECK:STDOUT:     %T.patt.loc18_14.1: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc18_14.2 (constants.%T.patt.a9c)]
-// CHECK:STDOUT:     %T.param_patt: %Animal.type = value_param_pattern %T.patt.loc18_14.1, runtime_param<none> [symbolic = %T.patt.loc18_14.2 (constants.%T.patt.a9c)]
-// CHECK:STDOUT:     %U.patt.loc18_26.1: %Edible.type = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc18_26.2 (constants.%U.patt)]
-// CHECK:STDOUT:     %U.param_patt: %Edible.type = value_param_pattern %U.patt.loc18_26.1, runtime_param<none> [symbolic = %U.patt.loc18_26.2 (constants.%U.patt)]
+// 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:     %T.param_patt: %Animal.type = value_param_pattern %T.patt.loc17_14.1, runtime_param<none> [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:     %U.param_patt: %Edible.type = value_param_pattern %U.patt.loc17_26.1, runtime_param<none> [symbolic = %U.patt.loc17_26.2 (constants.%U.patt)]
 // CHECK:STDOUT:   } {
-// CHECK:STDOUT:     %T.ref: %Animal.type = name_ref T, %T.loc18_14.1 [symbolic = %T.loc18_14.2 (constants.%T.fd4)]
-// CHECK:STDOUT:     %T.as_type.loc18_38.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc18_38.2 (constants.%T.as_type.2ad)]
-// CHECK:STDOUT:     %.loc18_38: type = converted %T.ref, %T.as_type.loc18_38.1 [symbolic = %T.as_type.loc18_38.2 (constants.%T.as_type.2ad)]
+// 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.loc18_26.1 [symbolic = %U.loc18_26.2 (constants.%U)]
-// CHECK:STDOUT:     %U.as_type.loc18_49.1: type = facet_access_type %U.ref [symbolic = %U.as_type.loc18_49.2 (constants.%U.as_type)]
-// CHECK:STDOUT:     %.loc18_49: type = converted %U.ref, %U.as_type.loc18_49.1 [symbolic = %U.as_type.loc18_49.2 (constants.%U.as_type)]
-// CHECK:STDOUT:     %Eats.type.loc18_49.1: type = facet_type <@Eats, @Eats(constants.%U.as_type)> [symbolic = %Eats.type.loc18_49.2 (constants.%Eats.type.f54c3d.1)]
+// 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:     %T.param: %Animal.type = value_param runtime_param<none>
 // CHECK:STDOUT:     %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type]
-// CHECK:STDOUT:     %T.loc18_14.1: %Animal.type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc18_14.2 (constants.%T.fd4)]
+// CHECK:STDOUT:     %T.loc17_14.1: %Animal.type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc17_14.2 (constants.%T.fd4)]
 // CHECK:STDOUT:     %U.param: %Edible.type = value_param runtime_param<none>
 // CHECK:STDOUT:     %Edible.ref: type = name_ref Edible, file.%Edible.decl [concrete = constants.%Edible.type]
-// CHECK:STDOUT:     %U.loc18_26.1: %Edible.type = bind_symbolic_name U, 1, %U.param [symbolic = %U.loc18_26.2 (constants.%U)]
+// CHECK:STDOUT:     %U.loc17_26.1: %Edible.type = bind_symbolic_name U, 1, %U.param [symbolic = %U.loc17_26.2 (constants.%U)]
 // CHECK:STDOUT:   }
-// CHECK:STDOUT:   %impl_witness.loc18: <witness> = impl_witness (), @impl.2(constants.%T.fd4, constants.%U) [symbolic = @impl.2.%impl_witness (constants.%impl_witness.c7c36b.1)]
+// CHECK:STDOUT:   %impl_witness.loc17: <witness> = impl_witness (), @impl.2(constants.%T.fd4, constants.%U) [symbolic = @impl.2.%impl_witness (constants.%impl_witness.c7c36b.1)]
 // CHECK:STDOUT:   %Goat.decl: type = class_decl @Goat [concrete = constants.%Goat] {} {}
 // CHECK:STDOUT:   impl_decl @impl.3 [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.loc21: <witness> = impl_witness () [concrete = constants.%impl_witness.1bc]
+// CHECK:STDOUT:   %impl_witness.loc20: <witness> = impl_witness () [concrete = constants.%impl_witness.1bc]
 // CHECK:STDOUT:   %Feed.decl: %Feed.type = fn_decl @Feed [concrete = constants.%Feed] {
-// CHECK:STDOUT:     %Food.patt.loc23_9.1: %Edible.type = symbolic_binding_pattern Food, 0 [symbolic = %Food.patt.loc23_9.2 (constants.%Food.patt.0b7)]
-// CHECK:STDOUT:     %Food.param_patt: %Edible.type = value_param_pattern %Food.patt.loc23_9.1, runtime_param<none> [symbolic = %Food.patt.loc23_9.2 (constants.%Food.patt.0b7)]
-// CHECK:STDOUT:     %T.patt.loc23_24.1: @Feed.%Eats.type.loc23_37.2 (%Eats.type.b39) = symbolic_binding_pattern T, 1 [symbolic = %T.patt.loc23_24.2 (constants.%T.patt.f09)]
-// CHECK:STDOUT:     %T.param_patt: @Feed.%Eats.type.loc23_37.2 (%Eats.type.b39) = value_param_pattern %T.patt.loc23_24.1, runtime_param<none> [symbolic = %T.patt.loc23_24.2 (constants.%T.patt.f09)]
-// CHECK:STDOUT:     %e.patt: @Feed.%T.as_type.loc23_43.2 (%T.as_type.212) = binding_pattern e
-// CHECK:STDOUT:     %e.param_patt: @Feed.%T.as_type.loc23_43.2 (%T.as_type.212) = value_param_pattern %e.patt, runtime_param0
-// CHECK:STDOUT:     %food.patt: @Feed.%Food.as_type.loc23_37.2 (%Food.as_type.952) = binding_pattern food
-// CHECK:STDOUT:     %food.param_patt: @Feed.%Food.as_type.loc23_37.2 (%Food.as_type.952) = value_param_pattern %food.patt, runtime_param1
+// 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:     %Food.param_patt: %Edible.type = value_param_pattern %Food.patt.loc22_9.1, runtime_param<none> [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:     %T.param_patt: @Feed.%Eats.type.loc22_37.2 (%Eats.type.b39) = value_param_pattern %T.patt.loc22_24.1, runtime_param<none> [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, runtime_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, runtime_param1
 // CHECK:STDOUT:   } {
 // CHECK:STDOUT:     %Food.param: %Edible.type = value_param runtime_param<none>
 // CHECK:STDOUT:     %Edible.ref: type = name_ref Edible, file.%Edible.decl [concrete = constants.%Edible.type]
-// CHECK:STDOUT:     %Food.loc23_9.1: %Edible.type = bind_symbolic_name Food, 0, %Food.param [symbolic = %Food.loc23_9.2 (constants.%Food.9af)]
-// CHECK:STDOUT:     %T.param: @Feed.%Eats.type.loc23_37.2 (%Eats.type.b39) = value_param runtime_param<none>
-// CHECK:STDOUT:     %.loc23_37.1: type = splice_block %Eats.type.loc23_37.1 [symbolic = %Eats.type.loc23_37.2 (constants.%Eats.type.b39)] {
+// CHECK:STDOUT:     %Food.loc22_9.1: %Edible.type = bind_symbolic_name Food, 0, %Food.param [symbolic = %Food.loc22_9.2 (constants.%Food.9af)]
+// CHECK:STDOUT:     %T.param: @Feed.%Eats.type.loc22_37.2 (%Eats.type.b39) = value_param runtime_param<none>
+// 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.loc23_33: %Edible.type = name_ref Food, %Food.loc23_9.1 [symbolic = %Food.loc23_9.2 (constants.%Food.9af)]
-// CHECK:STDOUT:       %Food.as_type.loc23_37.1: type = facet_access_type %Food.ref.loc23_33 [symbolic = %Food.as_type.loc23_37.2 (constants.%Food.as_type.952)]
-// CHECK:STDOUT:       %.loc23_37.2: type = converted %Food.ref.loc23_33, %Food.as_type.loc23_37.1 [symbolic = %Food.as_type.loc23_37.2 (constants.%Food.as_type.952)]
-// CHECK:STDOUT:       %Eats.type.loc23_37.1: type = facet_type <@Eats, @Eats(constants.%Food.as_type.952)> [symbolic = %Eats.type.loc23_37.2 (constants.%Eats.type.b39)]
+// 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.loc23_24.1: @Feed.%Eats.type.loc23_37.2 (%Eats.type.b39) = bind_symbolic_name T, 1, %T.param [symbolic = %T.loc23_24.2 (constants.%T.223)]
-// CHECK:STDOUT:     %e.param: @Feed.%T.as_type.loc23_43.2 (%T.as_type.212) = value_param runtime_param0
-// CHECK:STDOUT:     %.loc23_43.1: type = splice_block %.loc23_43.2 [symbolic = %T.as_type.loc23_43.2 (constants.%T.as_type.212)] {
-// CHECK:STDOUT:       %T.ref: @Feed.%Eats.type.loc23_37.2 (%Eats.type.b39) = name_ref T, %T.loc23_24.1 [symbolic = %T.loc23_24.2 (constants.%T.223)]
-// CHECK:STDOUT:       %T.as_type.loc23_43.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc23_43.2 (constants.%T.as_type.212)]
-// CHECK:STDOUT:       %.loc23_43.2: type = converted %T.ref, %T.as_type.loc23_43.1 [symbolic = %T.as_type.loc23_43.2 (constants.%T.as_type.212)]
+// CHECK:STDOUT:     %T.loc22_24.1: @Feed.%Eats.type.loc22_37.2 (%Eats.type.b39) = bind_symbolic_name T, 1, %T.param [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 runtime_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.loc23_43.2 (%T.as_type.212) = bind_name e, %e.param
-// CHECK:STDOUT:     %food.param: @Feed.%Food.as_type.loc23_37.2 (%Food.as_type.952) = value_param runtime_param1
-// CHECK:STDOUT:     %.loc23_52.1: type = splice_block %.loc23_52.2 [symbolic = %Food.as_type.loc23_37.2 (constants.%Food.as_type.952)] {
-// CHECK:STDOUT:       %Food.ref.loc23_52: %Edible.type = name_ref Food, %Food.loc23_9.1 [symbolic = %Food.loc23_9.2 (constants.%Food.9af)]
-// CHECK:STDOUT:       %Food.as_type.loc23_52: type = facet_access_type %Food.ref.loc23_52 [symbolic = %Food.as_type.loc23_37.2 (constants.%Food.as_type.952)]
-// CHECK:STDOUT:       %.loc23_52.2: type = converted %Food.ref.loc23_52, %Food.as_type.loc23_52 [symbolic = %Food.as_type.loc23_37.2 (constants.%Food.as_type.952)]
+// 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 runtime_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.loc23_37.2 (%Food.as_type.952) = bind_name food, %food.param
+// 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.loc24_17.1: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc24_17.2 (constants.%T.patt.a9c)]
-// CHECK:STDOUT:     %T.param_patt: %Animal.type = value_param_pattern %T.patt.loc24_17.1, runtime_param<none> [symbolic = %T.patt.loc24_17.2 (constants.%T.patt.a9c)]
-// CHECK:STDOUT:     %Food.patt.loc24_29.1: %Edible.type = symbolic_binding_pattern Food, 1 [symbolic = %Food.patt.loc24_29.2 (constants.%Food.patt.551)]
-// CHECK:STDOUT:     %Food.param_patt: %Edible.type = value_param_pattern %Food.patt.loc24_29.1, runtime_param<none> [symbolic = %Food.patt.loc24_29.2 (constants.%Food.patt.551)]
-// CHECK:STDOUT:     %a.patt: @HandleAnimal.%T.as_type.loc24_47.2 (%T.as_type.2ad) = binding_pattern a
-// CHECK:STDOUT:     %a.param_patt: @HandleAnimal.%T.as_type.loc24_47.2 (%T.as_type.2ad) = value_param_pattern %a.patt, runtime_param0
-// CHECK:STDOUT:     %food.patt: @HandleAnimal.%Food.as_type.loc24_56.2 (%Food.as_type.fae) = binding_pattern food
-// CHECK:STDOUT:     %food.param_patt: @HandleAnimal.%Food.as_type.loc24_56.2 (%Food.as_type.fae) = value_param_pattern %food.patt, runtime_param1
+// 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:     %T.param_patt: %Animal.type = value_param_pattern %T.patt.loc23_17.1, runtime_param<none> [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:     %Food.param_patt: %Edible.type = value_param_pattern %Food.patt.loc23_29.1, runtime_param<none> [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, runtime_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, runtime_param1
 // CHECK:STDOUT:   } {
 // CHECK:STDOUT:     %T.param: %Animal.type = value_param runtime_param<none>
 // CHECK:STDOUT:     %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type]
-// CHECK:STDOUT:     %T.loc24_17.1: %Animal.type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc24_17.2 (constants.%T.fd4)]
+// CHECK:STDOUT:     %T.loc23_17.1: %Animal.type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc23_17.2 (constants.%T.fd4)]
 // CHECK:STDOUT:     %Food.param: %Edible.type = value_param runtime_param<none>
 // CHECK:STDOUT:     %Edible.ref: type = name_ref Edible, file.%Edible.decl [concrete = constants.%Edible.type]
-// CHECK:STDOUT:     %Food.loc24_29.1: %Edible.type = bind_symbolic_name Food, 1, %Food.param [symbolic = %Food.loc24_29.2 (constants.%Food.5fe)]
-// CHECK:STDOUT:     %a.param: @HandleAnimal.%T.as_type.loc24_47.2 (%T.as_type.2ad) = value_param runtime_param0
-// CHECK:STDOUT:     %.loc24_47.1: type = splice_block %.loc24_47.2 [symbolic = %T.as_type.loc24_47.2 (constants.%T.as_type.2ad)] {
-// CHECK:STDOUT:       %T.ref: %Animal.type = name_ref T, %T.loc24_17.1 [symbolic = %T.loc24_17.2 (constants.%T.fd4)]
-// CHECK:STDOUT:       %T.as_type.loc24_47.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc24_47.2 (constants.%T.as_type.2ad)]
-// CHECK:STDOUT:       %.loc24_47.2: type = converted %T.ref, %T.as_type.loc24_47.1 [symbolic = %T.as_type.loc24_47.2 (constants.%T.as_type.2ad)]
+// CHECK:STDOUT:     %Food.loc23_29.1: %Edible.type = bind_symbolic_name Food, 1, %Food.param [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 runtime_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.loc24_47.2 (%T.as_type.2ad) = bind_name a, %a.param
-// CHECK:STDOUT:     %food.param: @HandleAnimal.%Food.as_type.loc24_56.2 (%Food.as_type.fae) = value_param runtime_param1
-// CHECK:STDOUT:     %.loc24_56.1: type = splice_block %.loc24_56.2 [symbolic = %Food.as_type.loc24_56.2 (constants.%Food.as_type.fae)] {
-// CHECK:STDOUT:       %Food.ref: %Edible.type = name_ref Food, %Food.loc24_29.1 [symbolic = %Food.loc24_29.2 (constants.%Food.5fe)]
-// CHECK:STDOUT:       %Food.as_type.loc24_56.1: type = facet_access_type %Food.ref [symbolic = %Food.as_type.loc24_56.2 (constants.%Food.as_type.fae)]
-// CHECK:STDOUT:       %.loc24_56.2: type = converted %Food.ref, %Food.as_type.loc24_56.1 [symbolic = %Food.as_type.loc24_56.2 (constants.%Food.as_type.fae)]
+// 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 runtime_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.loc24_56.2 (%Food.as_type.fae) = bind_name food, %food.param
+// 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: }
@@ -398,28 +377,28 @@ fn F() {
 // CHECK:STDOUT:   witness = file.%impl_witness.loc9
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: generic impl @impl.2(%T.loc18_14.1: %Animal.type, %U.loc18_26.1: %Edible.type) {
-// CHECK:STDOUT:   %T.loc18_14.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc18_14.2 (constants.%T.fd4)]
-// CHECK:STDOUT:   %T.patt.loc18_14.2: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc18_14.2 (constants.%T.patt.a9c)]
-// CHECK:STDOUT:   %U.loc18_26.2: %Edible.type = bind_symbolic_name U, 1 [symbolic = %U.loc18_26.2 (constants.%U)]
-// CHECK:STDOUT:   %U.patt.loc18_26.2: %Edible.type = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc18_26.2 (constants.%U.patt)]
-// CHECK:STDOUT:   %T.as_type.loc18_38.2: type = facet_access_type %T.loc18_14.2 [symbolic = %T.as_type.loc18_38.2 (constants.%T.as_type.2ad)]
-// CHECK:STDOUT:   %U.as_type.loc18_49.2: type = facet_access_type %U.loc18_26.2 [symbolic = %U.as_type.loc18_49.2 (constants.%U.as_type)]
-// CHECK:STDOUT:   %Eats.type.loc18_49.2: type = facet_type <@Eats, @Eats(%U.as_type.loc18_49.2)> [symbolic = %Eats.type.loc18_49.2 (constants.%Eats.type.f54c3d.1)]
-// CHECK:STDOUT:   %require_complete: <witness> = require_complete_type @impl.2.%Eats.type.loc18_49.2 (%Eats.type.f54c3d.1) [symbolic = %require_complete (constants.%require_complete.42532a.1)]
-// CHECK:STDOUT:   %impl_witness: <witness> = impl_witness (), @impl.2(%T.loc18_14.2, %U.loc18_26.2) [symbolic = %impl_witness (constants.%impl_witness.c7c36b.1)]
+// CHECK:STDOUT: generic impl @impl.2(%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: <witness> = require_complete_type @impl.2.%Eats.type.loc17_49.2 (%Eats.type.f54c3d.1) [symbolic = %require_complete (constants.%require_complete.42532a.1)]
+// CHECK:STDOUT:   %impl_witness: <witness> = impl_witness (), @impl.2(%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: %.loc18_38 as %Eats.type.loc18_49.1 {
+// CHECK:STDOUT:   impl: %.loc17_38 as %Eats.type.loc17_49.1 {
 // CHECK:STDOUT:   !members:
-// CHECK:STDOUT:     witness = file.%impl_witness.loc18
+// CHECK:STDOUT:     witness = file.%impl_witness.loc17
 // CHECK:STDOUT:   }
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: impl @impl.3: %Goat.ref as %Animal.ref {
 // CHECK:STDOUT: !members:
-// CHECK:STDOUT:   witness = file.%impl_witness.loc21
+// CHECK:STDOUT:   witness = file.%impl_witness.loc20
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: class @Grass {
@@ -438,59 +417,59 @@ fn F() {
 // CHECK:STDOUT:   .Self = constants.%Goat
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: generic fn @Feed(%Food.loc23_9.1: %Edible.type, %T.loc23_24.1: @Feed.%Eats.type.loc23_37.2 (%Eats.type.b39)) {
-// CHECK:STDOUT:   %Food.loc23_9.2: %Edible.type = bind_symbolic_name Food, 0 [symbolic = %Food.loc23_9.2 (constants.%Food.9af)]
-// CHECK:STDOUT:   %Food.patt.loc23_9.2: %Edible.type = symbolic_binding_pattern Food, 0 [symbolic = %Food.patt.loc23_9.2 (constants.%Food.patt.0b7)]
-// CHECK:STDOUT:   %Food.as_type.loc23_37.2: type = facet_access_type %Food.loc23_9.2 [symbolic = %Food.as_type.loc23_37.2 (constants.%Food.as_type.952)]
-// CHECK:STDOUT:   %Eats.type.loc23_37.2: type = facet_type <@Eats, @Eats(%Food.as_type.loc23_37.2)> [symbolic = %Eats.type.loc23_37.2 (constants.%Eats.type.b39)]
-// CHECK:STDOUT:   %T.loc23_24.2: %Eats.type.b39 = bind_symbolic_name T, 1 [symbolic = %T.loc23_24.2 (constants.%T.223)]
-// CHECK:STDOUT:   %T.patt.loc23_24.2: %Eats.type.b39 = symbolic_binding_pattern T, 1 [symbolic = %T.patt.loc23_24.2 (constants.%T.patt.f09)]
-// CHECK:STDOUT:   %T.as_type.loc23_43.2: type = facet_access_type %T.loc23_24.2 [symbolic = %T.as_type.loc23_43.2 (constants.%T.as_type.212)]
+// 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.loc23_41: <witness> = require_complete_type @Feed.%T.as_type.loc23_43.2 (%T.as_type.212) [symbolic = %require_complete.loc23_41 (constants.%require_complete.fe6)]
-// CHECK:STDOUT:   %require_complete.loc23_50: <witness> = require_complete_type @Feed.%Food.as_type.loc23_37.2 (%Food.as_type.952) [symbolic = %require_complete.loc23_50 (constants.%require_complete.005)]
+// CHECK:STDOUT:   %require_complete.loc22_41: <witness> = 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: <witness> = 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.param_patt: %Edible.type, %T.param_patt: @Feed.%Eats.type.loc23_37.2 (%Eats.type.b39)](%e.param_patt: @Feed.%T.as_type.loc23_43.2 (%T.as_type.212), %food.param_patt: @Feed.%Food.as_type.loc23_37.2 (%Food.as_type.952)) {
+// CHECK:STDOUT:   fn[%Food.param_patt: %Edible.type, %T.param_patt: @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.loc24_17.1: %Animal.type, %Food.loc24_29.1: %Edible.type) {
-// CHECK:STDOUT:   %T.loc24_17.2: %Animal.type = bind_symbolic_name T, 0 [symbolic = %T.loc24_17.2 (constants.%T.fd4)]
-// CHECK:STDOUT:   %T.patt.loc24_17.2: %Animal.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc24_17.2 (constants.%T.patt.a9c)]
-// CHECK:STDOUT:   %Food.loc24_29.2: %Edible.type = bind_symbolic_name Food, 1 [symbolic = %Food.loc24_29.2 (constants.%Food.5fe)]
-// CHECK:STDOUT:   %Food.patt.loc24_29.2: %Edible.type = symbolic_binding_pattern Food, 1 [symbolic = %Food.patt.loc24_29.2 (constants.%Food.patt.551)]
-// CHECK:STDOUT:   %T.as_type.loc24_47.2: type = facet_access_type %T.loc24_17.2 [symbolic = %T.as_type.loc24_47.2 (constants.%T.as_type.2ad)]
-// CHECK:STDOUT:   %Food.as_type.loc24_56.2: type = facet_access_type %Food.loc24_29.2 [symbolic = %Food.as_type.loc24_56.2 (constants.%Food.as_type.fae)]
+// 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.loc24_45: <witness> = require_complete_type @HandleAnimal.%T.as_type.loc24_47.2 (%T.as_type.2ad) [symbolic = %require_complete.loc24_45 (constants.%require_complete.234)]
-// CHECK:STDOUT:   %require_complete.loc24_54: <witness> = require_complete_type @HandleAnimal.%Food.as_type.loc24_56.2 (%Food.as_type.fae) [symbolic = %require_complete.loc24_54 (constants.%require_complete.444)]
-// CHECK:STDOUT:   %Eats.type: type = facet_type <@Eats, @Eats(%Food.as_type.loc24_56.2)> [symbolic = %Eats.type (constants.%Eats.type.f54c3d.2)]
-// CHECK:STDOUT:   %require_complete.loc24_76: <witness> = require_complete_type @HandleAnimal.%Eats.type (%Eats.type.f54c3d.2) [symbolic = %require_complete.loc24_76 (constants.%require_complete.42532a.2)]
-// CHECK:STDOUT:   %impl_witness: <witness> = impl_witness (), @impl.2(%T.loc24_17.2, %Food.loc24_29.2) [symbolic = %impl_witness (constants.%impl_witness.c7c36b.2)]
-// CHECK:STDOUT:   %Eats.facet.loc24_76.2: @HandleAnimal.%Eats.type (%Eats.type.f54c3d.2) = facet_value %T.as_type.loc24_47.2, %impl_witness [symbolic = %Eats.facet.loc24_76.2 (constants.%Eats.facet.b56)]
-// CHECK:STDOUT:   %Feed.specific_fn.loc24_64.2: <specific function> = specific_function constants.%Feed, @Feed(%Food.loc24_29.2, %Eats.facet.loc24_76.2) [symbolic = %Feed.specific_fn.loc24_64.2 (constants.%Feed.specific_fn.f4b)]
-// CHECK:STDOUT:
-// CHECK:STDOUT:   fn[%T.param_patt: %Animal.type, %Food.param_patt: %Edible.type](%a.param_patt: @HandleAnimal.%T.as_type.loc24_47.2 (%T.as_type.2ad), %food.param_patt: @HandleAnimal.%Food.as_type.loc24_56.2 (%Food.as_type.fae)) {
+// CHECK:STDOUT:   %require_complete.loc23_45: <witness> = 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: <witness> = 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:   %require_complete.loc23_76: <witness> = require_complete_type @HandleAnimal.%Eats.type (%Eats.type.f54c3d.2) [symbolic = %require_complete.loc23_76 (constants.%require_complete.42532a.2)]
+// CHECK:STDOUT:   %impl_witness: <witness> = impl_witness (), @impl.2(%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.b56)]
+// CHECK:STDOUT:   %Feed.specific_fn.loc23_64.2: <specific function> = 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.f4b)]
+// CHECK:STDOUT:
+// CHECK:STDOUT:   fn[%T.param_patt: %Animal.type, %Food.param_patt: %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.loc24_47.2 (%T.as_type.2ad) = name_ref a, %a
-// CHECK:STDOUT:     %food.ref: @HandleAnimal.%Food.as_type.loc24_56.2 (%Food.as_type.fae) = name_ref food, %food
-// CHECK:STDOUT:     %.loc24_76.1: %Edible.type = converted constants.%Food.as_type.fae, constants.%Food.5fe [symbolic = %Food.loc24_29.2 (constants.%Food.5fe)]
-// CHECK:STDOUT:     %.loc24_76.2: %Edible.type = converted constants.%Food.as_type.fae, constants.%Food.5fe [symbolic = %Food.loc24_29.2 (constants.%Food.5fe)]
-// CHECK:STDOUT:     %.loc24_76.3: %Edible.type = converted constants.%Food.as_type.fae, constants.%Food.5fe [symbolic = %Food.loc24_29.2 (constants.%Food.5fe)]
-// CHECK:STDOUT:     %T.as_type.loc24_76: type = facet_access_type constants.%T.fd4 [symbolic = %T.as_type.loc24_47.2 (constants.%T.as_type.2ad)]
-// CHECK:STDOUT:     %.loc24_76.4: type = converted constants.%T.fd4, %T.as_type.loc24_76 [symbolic = %T.as_type.loc24_47.2 (constants.%T.as_type.2ad)]
-// CHECK:STDOUT:     %.loc24_76.5: %Animal.type = converted %.loc24_76.4, constants.%T.fd4 [symbolic = %T.loc24_17.2 (constants.%T.fd4)]
-// CHECK:STDOUT:     %.loc24_76.6: %Edible.type = converted constants.%Food.as_type.fae, constants.%Food.5fe [symbolic = %Food.loc24_29.2 (constants.%Food.5fe)]
-// CHECK:STDOUT:     %.loc24_76.7: %Animal.type = converted constants.%T.as_type.2ad, constants.%T.fd4 [symbolic = %T.loc24_17.2 (constants.%T.fd4)]
-// CHECK:STDOUT:     %Eats.facet.loc24_76.1: @HandleAnimal.%Eats.type (%Eats.type.f54c3d.2) = facet_value constants.%T.as_type.2ad, constants.%impl_witness.c7c36b.2 [symbolic = %Eats.facet.loc24_76.2 (constants.%Eats.facet.b56)]
-// CHECK:STDOUT:     %.loc24_76.8: @HandleAnimal.%Eats.type (%Eats.type.f54c3d.2) = converted constants.%T.as_type.2ad, %Eats.facet.loc24_76.1 [symbolic = %Eats.facet.loc24_76.2 (constants.%Eats.facet.b56)]
-// CHECK:STDOUT:     %Feed.specific_fn.loc24_64.1: <specific function> = specific_function %Feed.ref, @Feed(constants.%Food.5fe, %.loc24_76.8) [symbolic = %Feed.specific_fn.loc24_64.2 (constants.%Feed.specific_fn.f4b)]
-// CHECK:STDOUT:     %Feed.call: init %empty_tuple.type = call %Feed.specific_fn.loc24_64.1(%a.ref, %food.ref)
+// 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:     %T.as_type.loc23_76: type = facet_access_type constants.%T.fd4 [symbolic = %T.as_type.loc23_47.2 (constants.%T.as_type.2ad)]
+// CHECK:STDOUT:     %.loc23_76.4: type = converted constants.%T.fd4, %T.as_type.loc23_76 [symbolic = %T.as_type.loc23_47.2 (constants.%T.as_type.2ad)]
+// CHECK:STDOUT:     %.loc23_76.5: %Animal.type = converted %.loc23_76.4, constants.%T.fd4 [symbolic = %T.loc23_17.2 (constants.%T.fd4)]
+// CHECK:STDOUT:     %.loc23_76.6: %Edible.type = converted constants.%Food.as_type.fae, constants.%Food.5fe [symbolic = %Food.loc23_29.2 (constants.%Food.5fe)]
+// CHECK:STDOUT:     %.loc23_76.7: %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.b56)]
+// CHECK:STDOUT:     %.loc23_76.8: @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.b56)]
+// CHECK:STDOUT:     %Feed.specific_fn.loc23_64.1: <specific function> = specific_function %Feed.ref, @Feed(constants.%Food.5fe, %.loc23_76.8) [symbolic = %Feed.specific_fn.loc23_64.2 (constants.%Feed.specific_fn.f4b)]
+// 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: }
@@ -498,34 +477,30 @@ fn F() {
 // CHECK:STDOUT: fn @F() {
 // CHECK:STDOUT: !entry:
 // CHECK:STDOUT:   %HandleAnimal.ref: %HandleAnimal.type = name_ref HandleAnimal, file.%HandleAnimal.decl [concrete = constants.%HandleAnimal]
-// CHECK:STDOUT:   %.loc47_17.1: %empty_struct_type = struct_literal ()
+// 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:   %.loc47_17.2: ref %Goat = temporary_storage
-// CHECK:STDOUT:   %.loc47_17.3: init %Goat = class_init (), %.loc47_17.2 [concrete = constants.%Goat.val]
-// CHECK:STDOUT:   %.loc47_17.4: ref %Goat = temporary %.loc47_17.2, %.loc47_17.3
-// CHECK:STDOUT:   %.loc47_19.1: ref %Goat = converted %.loc47_17.1, %.loc47_17.4
-// CHECK:STDOUT:   %.loc47_29.1: %empty_struct_type = struct_literal ()
+// 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:   %.loc47_29.2: ref %Grass = temporary_storage
-// CHECK:STDOUT:   %.loc47_29.3: init %Grass = class_init (), %.loc47_29.2 [concrete = constants.%Grass.val]
-// CHECK:STDOUT:   %.loc47_29.4: ref %Grass = temporary %.loc47_29.2, %.loc47_29.3
-// CHECK:STDOUT:   %.loc47_31.1: ref %Grass = converted %.loc47_29.1, %.loc47_29.4
-// CHECK:STDOUT:   %Animal.facet.loc47_39.1: %Animal.type = facet_value constants.%Goat, <error> [concrete = <error>]
-// CHECK:STDOUT:   %.loc47_39.1: %Animal.type = converted constants.%Goat, %Animal.facet.loc47_39.1 [concrete = <error>]
-// CHECK:STDOUT:   %Animal.facet.loc47_39.2: %Animal.type = facet_value constants.%Goat, constants.%impl_witness.1bc [concrete = constants.%Animal.facet]
-// CHECK:STDOUT:   %.loc47_39.2: %Animal.type = converted constants.%Goat, %Animal.facet.loc47_39.2 [concrete = constants.%Animal.facet]
-// CHECK:STDOUT:   %Animal.facet.loc47_39.3: %Animal.type = facet_value constants.%Goat, <error> [concrete = <error>]
-// CHECK:STDOUT:   %.loc47_39.3: %Animal.type = converted constants.%Goat, %Animal.facet.loc47_39.3 [concrete = <error>]
-// CHECK:STDOUT:   %Animal.facet.loc47_39.4: %Animal.type = facet_value constants.%Goat, constants.%impl_witness.1bc [concrete = constants.%Animal.facet]
-// CHECK:STDOUT:   %.loc47_39.4: %Animal.type = converted constants.%Goat, %Animal.facet.loc47_39.4 [concrete = constants.%Animal.facet]
-// CHECK:STDOUT:   %Edible.facet.loc47_39.1: %Edible.type = facet_value constants.%Grass, constants.%impl_witness.1bc [concrete = constants.%Edible.facet]
-// CHECK:STDOUT:   %.loc47_39.5: %Edible.type = converted constants.%Grass, %Edible.facet.loc47_39.1 [concrete = constants.%Edible.facet]
-// CHECK:STDOUT:   %Edible.facet.loc47_39.2: %Edible.type = facet_value constants.%Grass, constants.%impl_witness.1bc [concrete = constants.%Edible.facet]
-// CHECK:STDOUT:   %.loc47_39.6: %Edible.type = converted constants.%Grass, %Edible.facet.loc47_39.2 [concrete = constants.%Edible.facet]
+// 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> = specific_function %HandleAnimal.ref, @HandleAnimal(constants.%Animal.facet, constants.%Edible.facet) [concrete = constants.%HandleAnimal.specific_fn]
-// CHECK:STDOUT:   %.loc47_19.2: %Goat = bind_value %.loc47_19.1
-// CHECK:STDOUT:   %.loc47_31.2: %Grass = bind_value %.loc47_31.1
-// CHECK:STDOUT:   %HandleAnimal.call: init %empty_tuple.type = call %HandleAnimal.specific_fn(%.loc47_19.2, %.loc47_31.2)
+// 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:
@@ -546,20 +521,20 @@ fn F() {
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: specific @impl.2(constants.%T.fd4, constants.%U) {
-// CHECK:STDOUT:   %T.loc18_14.2 => constants.%T.fd4
-// CHECK:STDOUT:   %T.patt.loc18_14.2 => constants.%T.fd4
-// CHECK:STDOUT:   %U.loc18_26.2 => constants.%U
-// CHECK:STDOUT:   %U.patt.loc18_26.2 => constants.%U
-// CHECK:STDOUT:   %T.as_type.loc18_38.2 => constants.%T.as_type.2ad
-// CHECK:STDOUT:   %U.as_type.loc18_49.2 => constants.%U.as_type
-// CHECK:STDOUT:   %Eats.type.loc18_49.2 => constants.%Eats.type.f54c3d.1
+// 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.2.%U.as_type.loc18_49.2) {}
+// CHECK:STDOUT: specific @Eats(@impl.2.%U.as_type.loc17_49.2) {}
 // CHECK:STDOUT:
-// CHECK:STDOUT: specific @impl.2(%T.loc18_14.2, %U.loc18_26.2) {}
+// CHECK:STDOUT: specific @impl.2(%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
@@ -567,24 +542,24 @@ fn F() {
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: specific @Feed(constants.%Food.9af, constants.%T.223) {
-// CHECK:STDOUT:   %Food.loc23_9.2 => constants.%Food.9af
-// CHECK:STDOUT:   %Food.patt.loc23_9.2 => constants.%Food.9af
-// CHECK:STDOUT:   %Food.as_type.loc23_37.2 => constants.%Food.as_type.952
-// CHECK:STDOUT:   %Eats.type.loc23_37.2 => constants.%Eats.type.b39
-// CHECK:STDOUT:   %T.loc23_24.2 => constants.%T.223
-// CHECK:STDOUT:   %T.patt.loc23_24.2 => constants.%T.223
-// CHECK:STDOUT:   %T.as_type.loc23_43.2 => constants.%T.as_type.212
+// 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.loc23_37.2) {}
+// 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.loc24_17.2 => constants.%T.fd4
-// CHECK:STDOUT:   %T.patt.loc24_17.2 => constants.%T.fd4
-// CHECK:STDOUT:   %Food.loc24_29.2 => constants.%Food.5fe
-// CHECK:STDOUT:   %Food.patt.loc24_29.2 => constants.%Food.5fe
-// CHECK:STDOUT:   %T.as_type.loc24_47.2 => constants.%T.as_type.2ad
-// CHECK:STDOUT:   %Food.as_type.loc24_56.2 => constants.%Food.as_type.fae
+// 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) {
@@ -597,65 +572,65 @@ fn F() {
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: specific @impl.2(constants.%T.fd4, constants.%Food.5fe) {
-// CHECK:STDOUT:   %T.loc18_14.2 => constants.%T.fd4
-// CHECK:STDOUT:   %T.patt.loc18_14.2 => constants.%T.fd4
-// CHECK:STDOUT:   %U.loc18_26.2 => constants.%Food.5fe
-// CHECK:STDOUT:   %U.patt.loc18_26.2 => constants.%Food.5fe
-// CHECK:STDOUT:   %T.as_type.loc18_38.2 => constants.%T.as_type.2ad
-// CHECK:STDOUT:   %U.as_type.loc18_49.2 => constants.%Food.as_type.fae
-// CHECK:STDOUT:   %Eats.type.loc18_49.2 => constants.%Eats.type.f54c3d.2
+// 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, @HandleAnimal.%.loc24_76.8) {
-// CHECK:STDOUT:   %Food.loc23_9.2 => constants.%Food.5fe
-// CHECK:STDOUT:   %Food.patt.loc23_9.2 => constants.%Food.5fe
-// CHECK:STDOUT:   %Food.as_type.loc23_37.2 => constants.%Food.as_type.fae
-// CHECK:STDOUT:   %Eats.type.loc23_37.2 => constants.%Eats.type.f54c3d.2
-// CHECK:STDOUT:   %T.loc23_24.2 => constants.%Eats.facet.b56
-// CHECK:STDOUT:   %T.patt.loc23_24.2 => constants.%Eats.facet.b56
-// CHECK:STDOUT:   %T.as_type.loc23_43.2 => constants.%T.as_type.2ad
+// CHECK:STDOUT: specific @Feed(constants.%Food.5fe, @HandleAnimal.%.loc23_76.8) {
+// 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.b56
+// CHECK:STDOUT:   %T.patt.loc22_24.2 => constants.%Eats.facet.b56
+// CHECK:STDOUT:   %T.as_type.loc22_43.2 => constants.%T.as_type.2ad
 // CHECK:STDOUT:
 // CHECK:STDOUT: !definition:
-// CHECK:STDOUT:   %require_complete.loc23_41 => constants.%require_complete.234
-// CHECK:STDOUT:   %require_complete.loc23_50 => constants.%require_complete.444
+// 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 @Feed(constants.%Food.5fe, constants.%Eats.facet.b56) {
-// CHECK:STDOUT:   %Food.loc23_9.2 => constants.%Food.5fe
-// CHECK:STDOUT:   %Food.patt.loc23_9.2 => constants.%Food.5fe
-// CHECK:STDOUT:   %Food.as_type.loc23_37.2 => constants.%Food.as_type.fae
-// CHECK:STDOUT:   %Eats.type.loc23_37.2 => constants.%Eats.type.f54c3d.2
-// CHECK:STDOUT:   %T.loc23_24.2 => constants.%Eats.facet.b56
-// CHECK:STDOUT:   %T.patt.loc23_24.2 => constants.%Eats.facet.b56
-// CHECK:STDOUT:   %T.as_type.loc23_43.2 => constants.%T.as_type.2ad
+// 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.b56
+// CHECK:STDOUT:   %T.patt.loc22_24.2 => constants.%Eats.facet.b56
+// CHECK:STDOUT:   %T.as_type.loc22_43.2 => constants.%T.as_type.2ad
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: specific @Eats(@HandleAnimal.%Food.as_type.loc24_56.2) {}
+// CHECK:STDOUT: specific @Eats(@HandleAnimal.%Food.as_type.loc23_56.2) {}
 // CHECK:STDOUT:
-// CHECK:STDOUT: specific @impl.2(@HandleAnimal.%T.loc24_17.2, @HandleAnimal.%Food.loc24_29.2) {}
+// CHECK:STDOUT: specific @impl.2(@HandleAnimal.%T.loc23_17.2, @HandleAnimal.%Food.loc23_29.2) {}
 // CHECK:STDOUT:
-// CHECK:STDOUT: specific @Feed(@HandleAnimal.%Food.loc24_29.2, @HandleAnimal.%Eats.facet.loc24_76.2) {}
+// 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.loc24_17.2 => constants.%Animal.facet
-// CHECK:STDOUT:   %T.patt.loc24_17.2 => constants.%Animal.facet
-// CHECK:STDOUT:   %Food.loc24_29.2 => constants.%Edible.facet
-// CHECK:STDOUT:   %Food.patt.loc24_29.2 => constants.%Edible.facet
-// CHECK:STDOUT:   %T.as_type.loc24_47.2 => constants.%Goat
-// CHECK:STDOUT:   %Food.as_type.loc24_56.2 => constants.%Grass
+// 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.loc24_45 => constants.%complete_type.357
-// CHECK:STDOUT:   %require_complete.loc24_54 => constants.%complete_type.357
+// 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:   %require_complete.loc24_76 => constants.%complete_type.004
+// CHECK:STDOUT:   %require_complete.loc23_76 => constants.%complete_type.004
 // CHECK:STDOUT:   %impl_witness => constants.%impl_witness.15d
-// CHECK:STDOUT:   %Eats.facet.loc24_76.2 => constants.%Eats.facet.c76
-// CHECK:STDOUT:   %Feed.specific_fn.loc24_64.2 => constants.%Feed.specific_fn.e8d
+// CHECK:STDOUT:   %Eats.facet.loc23_76.2 => constants.%Eats.facet.c76
+// CHECK:STDOUT:   %Feed.specific_fn.loc23_64.2 => constants.%Feed.specific_fn.e8d
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: specific @Eats(constants.%Grass) {
@@ -668,24 +643,24 @@ fn F() {
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: specific @impl.2(constants.%Animal.facet, constants.%Edible.facet) {
-// CHECK:STDOUT:   %T.loc18_14.2 => constants.%Animal.facet
-// CHECK:STDOUT:   %T.patt.loc18_14.2 => constants.%Animal.facet
-// CHECK:STDOUT:   %U.loc18_26.2 => constants.%Edible.facet
-// CHECK:STDOUT:   %U.patt.loc18_26.2 => constants.%Edible.facet
-// CHECK:STDOUT:   %T.as_type.loc18_38.2 => constants.%Goat
-// CHECK:STDOUT:   %U.as_type.loc18_49.2 => constants.%Grass
-// CHECK:STDOUT:   %Eats.type.loc18_49.2 => constants.%Eats.type.1ae
+// 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.15d
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: specific @Feed(constants.%Edible.facet, constants.%Eats.facet.c76) {
-// CHECK:STDOUT:   %Food.loc23_9.2 => constants.%Edible.facet
-// CHECK:STDOUT:   %Food.patt.loc23_9.2 => constants.%Edible.facet
-// CHECK:STDOUT:   %Food.as_type.loc23_37.2 => constants.%Grass
-// CHECK:STDOUT:   %Eats.type.loc23_37.2 => constants.%Eats.type.1ae
-// CHECK:STDOUT:   %T.loc23_24.2 => constants.%Eats.facet.c76
-// CHECK:STDOUT:   %T.patt.loc23_24.2 => constants.%Eats.facet.c76
-// CHECK:STDOUT:   %T.as_type.loc23_43.2 => constants.%Goat
+// 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.c76
+// CHECK:STDOUT:   %T.patt.loc22_24.2 => constants.%Eats.facet.c76
+// CHECK:STDOUT:   %T.as_type.loc22_43.2 => constants.%Goat
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 1 - 21
toolchain/check/testdata/impl/no_prelude/impl_cycle.carbon

@@ -197,7 +197,7 @@ fn F() {
   ({} as C) as (C as First);
 }
 
-// --- fail_todo_deduce_cycle_with_symbolic.carbon
+// --- deduce_cycle_with_symbolic.carbon
 library "[[@TEST_NAME]]";
 
 interface First(T:! type) {}
@@ -211,27 +211,7 @@ impl forall [T:! type] T as Second {}
 
 class C {}
 
-// TODO: See the TODO in impl_lookup.cpp to reject impls where the interface
-// does not match the query.
 fn F() {
-  // CHECK:STDERR: fail_todo_deduce_cycle_with_symbolic.carbon:[[@LINE+7]]:17: error: cycle found in lookup of interface <TODO: interface name> for type `C` [ImplLookupCycle]
-  // CHECK:STDERR:   ({} as C) as (C as Second);
-  // CHECK:STDERR:                 ^~~~~~~~~~~
-  // CHECK:STDERR: fail_todo_deduce_cycle_with_symbolic.carbon:[[@LINE-11]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
-  // CHECK:STDERR: impl forall [T:! Second, U:! type] T as First(U) {}
-  // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-  // CHECK:STDERR:
   ({} as C) as (C as Second);
-
-  // CHECK:STDERR: fail_todo_deduce_cycle_with_symbolic.carbon:[[@LINE+10]]:17: error: cycle found in lookup of interface <TODO: interface name> for type `C` [ImplLookupCycle]
-  // CHECK:STDERR:   ({} as C) as (C as First(C));
-  // CHECK:STDERR:                 ^~~~~~~~~~~~~
-  // CHECK:STDERR: fail_todo_deduce_cycle_with_symbolic.carbon:[[@LINE-20]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
-  // CHECK:STDERR: impl forall [T:! Second, U:! type] T as First(U) {}
-  // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-  // CHECK:STDERR: fail_todo_deduce_cycle_with_symbolic.carbon:[[@LINE-23]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
-  // CHECK:STDERR: impl forall [T:! Second, U:! type] T as First(U) {}
-  // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-  // CHECK:STDERR:
   ({} as C) as (C as First(C));
 }

+ 7 - 3
toolchain/check/testdata/where_expr/equal_rewrite.carbon

@@ -172,6 +172,10 @@ interface A {}
 class D {}
 impl D as A {}
 // TODO: This should be a compile-time binding, once that is supported.
+// CHECK:STDERR: fail_todo_let.carbon:[[@LINE+11]]:35: error: semantics TODO: `impl lookup for a FacetType with no interface (using `where .Self impls ...` instead?)` [SemanticsTodo]
+// CHECK:STDERR: let B: type where .Self impls A = D;
+// CHECK:STDERR:                                   ^
+// CHECK:STDERR:
 // CHECK:STDERR: fail_todo_let.carbon:[[@LINE+7]]:35: error: cannot implicitly convert from `type` to `type where...` [ImplicitAsConversionFailure]
 // CHECK:STDERR: let B: type where .Self impls A = D;
 // CHECK:STDERR:                                   ^
@@ -1422,15 +1426,15 @@ let K: (E where .F = .Self.G) = bool;
 // CHECK:STDOUT:   name_binding_decl {
 // CHECK:STDOUT:     %B.patt: %type_where = binding_pattern B
 // CHECK:STDOUT:   }
-// CHECK:STDOUT:   %.loc15_13.1: type = splice_block %.loc15_13.2 [concrete = constants.%type_where] {
+// CHECK:STDOUT:   %.loc19_13.1: type = splice_block %.loc19_13.2 [concrete = constants.%type_where] {
 // CHECK:STDOUT:     %.Self: type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
 // CHECK:STDOUT:     %.Self.ref: type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
 // CHECK:STDOUT:     %A.ref: type = name_ref A, %A.decl [concrete = constants.%A.type]
-// CHECK:STDOUT:     %.loc15_13.2: type = where_expr %.Self [concrete = constants.%type_where] {
+// CHECK:STDOUT:     %.loc19_13.2: type = where_expr %.Self [concrete = constants.%type_where] {
 // CHECK:STDOUT:       requirement_impls %.Self.ref, %A.ref
 // CHECK:STDOUT:     }
 // CHECK:STDOUT:   }
-// CHECK:STDOUT:   %.loc15_35: %type_where = converted @__global_init.%D.ref, <error> [concrete = <error>]
+// CHECK:STDOUT:   %.loc19_35: %type_where = converted @__global_init.%D.ref, <error> [concrete = <error>]
 // CHECK:STDOUT:   %B: %type_where = bind_name B, <error>
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 1 - 0
toolchain/sem_ir/file.h

@@ -153,6 +153,7 @@ class File : public Printable<File> {
   auto associated_constants() const -> const ValueStore<AssociatedConstantId>& {
     return associated_constants_;
   }
+  // TODO: Rename these to `facet_type_infos`.
   auto facet_types() -> CanonicalValueStore<FacetTypeId>& {
     return facet_types_;
   }

+ 1 - 0
toolchain/sem_ir/typed_insts.h

@@ -651,6 +651,7 @@ struct FacetType {
        .deduce_through = true});
 
   TypeId type_id;
+  // TODO: Rename this to facet_type_info_id.
   FacetTypeId facet_type_id;
 };