// RUN: %target-typecheck-verify-swift // RUN: %target-swift-frontend -typecheck -debug-generic-signatures %s 2>&1 | %FileCheck %s protocol P { associatedtype X : P } // Anything that mentions 'T : P' and 'U : P' minimizes to 'U : P'. func oneProtocol1(_: T, _: U) where T : P, U : P, T.X == U, U.X == T {} // CHECK-LABEL: oneProtocol1 // CHECK: Generic signature: func oneProtocol2(_: T, _: U) where U : P, T : P, T.X == U, U.X == T {} // CHECK-LABEL: oneProtocol2 // CHECK: Generic signature: func oneProtocol3(_: T, _: U) where T : P, T.X == U, U : P, U.X == T {} // CHECK-LABEL: oneProtocol3 // CHECK: Generic signature: func oneProtocol4(_: T, _: U) where U : P, T.X == U, T : P, U.X == T {} // CHECK-LABEL: oneProtocol4 // CHECK: Generic signature: // Anything that only mentions 'T : P' minimizes to 'T : P'. func oneProtocol5(_: T, _: U) where T : P, T.X == U, U.X == T {} // CHECK-LABEL: oneProtocol5 // CHECK: Generic signature: func oneProtocol6(_: T, _: U) where T.X == U, U.X == T, T : P {} // CHECK-LABEL: oneProtocol6 // CHECK: Generic signature: // Anything that only mentions 'U : P' minimizes to 'U : P'. func oneProtocol7(_: T, _: U) where U : P, T.X == U, U.X == T {} // CHECK-LABEL: oneProtocol7 // CHECK: Generic signature: func oneProtocol8(_: T, _: U) where T.X == U, U.X == T, U : P {} // CHECK-LABEL: oneProtocol8 // CHECK: Generic signature: protocol P1 { associatedtype X : P2 } protocol P2 { associatedtype Y : P1 } func twoProtocols1(_: T, _: U) where T : P1, U : P2, T.X == U, U.Y == T {} // CHECK-LABEL: twoProtocols1 // CHECK: Generic signature: func twoProtocols2(_: T, _: U) where U : P2, T : P1, T.X == U, U.Y == T {} // CHECK-LABEL: twoProtocols2 // CHECK: Generic signature: func twoProtocols3(_: T, _: U) where T : P1, T.X == U, U : P2, U.Y == T {} // CHECK-LABEL: twoProtocols3 // CHECK: Generic signature: func twoProtocols4(_: T, _: U) where U : P2, T.X == U, T : P1, U.Y == T {} // CHECK-LABEL: twoProtocols4 // CHECK: Generic signature: func twoProtocols5(_: T, _: U) where T : P1, T.X == U, U.Y == T, U : P2 {} // CHECK-LABEL: twoProtocols5 // CHECK: Generic signature: // The GenericSignatureBuilder minimized this signature down to // . // // The Requirement Machine instead emits // . // // This is a hypothetical ABI break, but it is such a silly edge case that // it shouldn't matter in practice. Given that either of the two conformance // requirements here are redundant, the user can omit one or the other to // specify the result that they desire. func twoProtocols6(_: T, _: U) where U : P2, T.X == U, U.Y == T, T : P1 {} // CHECK-LABEL: twoProtocols6 // CHECK: Generic signature: