From b6ba4ecdbb82e6dfe69b8a47e0f6db7dd88ce095 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Wed, 2 Sep 2026 21:56:12 +0000 Subject: [PATCH] Use `match_first` to make the impl_recurse_with_simpler_type_in_generic_param_bidirectional_no_cycle.carbon test pass again (#7712) --- .../testdata/impl/lookup/impl_cycle.carbon | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/toolchain/check/testdata/impl/lookup/impl_cycle.carbon b/toolchain/check/testdata/impl/lookup/impl_cycle.carbon index 1df01a1a2942..4d8c0c686ff8 100644 --- a/toolchain/check/testdata/impl/lookup/impl_cycle.carbon +++ b/toolchain/check/testdata/impl/lookup/impl_cycle.carbon @@ -246,7 +246,7 @@ fn F() { ({} as Wraps(C)) as (Wraps(C) as ComparableTo(Wraps(D))); } -// --- fail_todo_impl_recurse_with_simpler_type_in_generic_param_bidirectional_no_cycle.carbon +// --- impl_recurse_with_simpler_type_in_generic_param_bidirectional_no_cycle.carbon library "[[@TEST_NAME]]"; // Implement this for a type in one direction. @@ -262,30 +262,17 @@ class D {} // - D is ComparableWith(C). impl C as ComparableTo(D) {} -// TODO: These three `impl`s need to be placed in a match_first as they -// overlap. +match_first { // T is always ComparableWith(T). impl forall [T: type] T as ComparableWith(T) {} // If U is ComparableTo(T), U is ComparableWith(T). -// CHECK:STDERR: fail_todo_impl_recurse_with_simpler_type_in_generic_param_bidirectional_no_cycle.carbon:[[@LINE+7]]:1: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] -// CHECK:STDERR: impl forall [T: type, U: ComparableTo(T)] U as ComparableWith(T) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_impl_recurse_with_simpler_type_in_generic_param_bidirectional_no_cycle.carbon:[[@LINE-5]]:1: note: other `impl` here [ImplNonFinalSameTypeStructureNote] -// CHECK:STDERR: impl forall [T: type] T as ComparableWith(T) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: impl forall [T: type, U: ComparableTo(T)] U as ComparableWith(T) {} // If U is ComparableTo(T), T is ComparableWith(U). -// CHECK:STDERR: fail_todo_impl_recurse_with_simpler_type_in_generic_param_bidirectional_no_cycle.carbon:[[@LINE+7]]:1: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] -// CHECK:STDERR: impl forall [T: type, U: ComparableTo(T)] T as ComparableWith(U) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_todo_impl_recurse_with_simpler_type_in_generic_param_bidirectional_no_cycle.carbon:[[@LINE-14]]:1: note: other `impl` here [ImplNonFinalSameTypeStructureNote] -// CHECK:STDERR: impl forall [T: type] T as ComparableWith(T) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: impl forall [T: type, U: ComparableTo(T)] T as ComparableWith(U) {} +} + fn Compare[T: type, U: ComparableWith(T)](unused t: T, unused u: U) {} fn F() {