1- // RUN: %target-typecheck-verify-swift -enable-experimental-associated-type-inference
2- // RUN: not %target-swift-frontend -typecheck -enable-experimental-associated-type-inference -dump-type-witness-systems %s 2>&1 | %FileCheck %s
1+ // RUN: %target-typecheck-verify-swift -enable-experimental-associated-type-inference -requirement-machine-protocol-signatures=on -requirement-machine-inferred-signatures=on
2+ // RUN: not %target-swift-frontend -typecheck -enable-experimental-associated-type-inference -dump-type-witness-systems -requirement-machine-protocol-signatures=on -requirement-machine-inferred-signatures=on %s 2>&1 | %FileCheck %s
33
44protocol P1 where A == Never {
55 associatedtype A
@@ -60,8 +60,7 @@ protocol P5b: P5a where A == Self {}
6060struct S5 < X> : P5b { } // OK, A := S5<X>
6161
6262
63- protocol P6 where A == Never { // expected-error {{same-type constraint type 'Never' does not conform to required protocol 'P6'}}
64- // expected-error@+2 {{same-type constraint type 'Never' does not conform to required protocol 'P6'}}
63+ protocol P6 where A == Never { // expected-error {{no type for 'Self.A' can satisfy both 'Self.A == Never' and 'Self.A : P6'}}
6564 // expected-note@+1 {{protocol requires nested type 'A}}
6665 associatedtype A : P6
6766}
@@ -73,8 +72,7 @@ struct S6: P6 {} // expected-error {{type 'S6' does not conform to protocol 'P6'
7372protocol P7a where A == Never {
7473 associatedtype A
7574}
76- // expected-error@+2 {{'Self.A' cannot be equal to both 'Bool' and 'Never'}}
77- // expected-note@+1 {{same-type constraint 'Self.A' == 'Never' implied here}}
75+ // expected-error@+1 {{no type for 'Self.A' can satisfy both 'Self.A == Never' and 'Self.A == Bool'}}
7876protocol P7b : P7a where A == Bool { }
7977// CHECK-LABEL: Abstract type witness system for conformance of S7 to P7a: {
8078// CHECK-NEXT: A => Never,
@@ -106,10 +104,9 @@ protocol P9b: P9a {
106104// CHECK-NEXT: A => Never,
107105// CHECK-NEXT: }
108106struct S9a : P9b { }
109- // expected-error@+3 {{type 'S9b' does not conform to protocol 'P9a'}}
110- // expected-error@+2 {{'P9a' requires the types 'S9b.A' (aka 'Bool') and 'Never' be equivalent}}
111- // expected-note@+1 {{requirement specified as 'Self.A' == 'Never' [with Self = S9b]}}
112- struct S9b : P9b {
107+ // expected-error@+2 {{type 'S9b' does not conform to protocol 'P9a'}}
108+ // expected-error@+1 {{'P9a' requires the types 'S9b.A' (aka 'Bool') and 'Never' be equivalent}}
109+ struct S9b : P9b { // expected-note {{requirement specified as 'Self.A' == 'Never' [with Self = S9b]}}
113110 typealias A = Bool
114111}
115112struct S9c : P9b { // OK, S9c.A does not contradict Self.A == Never.
@@ -445,13 +442,11 @@ protocol P28c where A == Never {
445442 associatedtype A
446443}
447444protocol Q28a : P28a , P28b { }
448- // expected-error@-1 {{'Self.A' cannot be equal to both 'Bool' and 'Int'}}
449- // expected-note@-2 {{same-type constraint 'Self.A' == 'Int' implied here}}
445+ // expected-error@-1 {{no type for 'Self.A' can satisfy both 'Self.A == Bool' and 'Self.A == Int'}}
450446protocol Q28b : P28a , P28b , P28c { }
451- // expected-error@-1 {{'Self.A' cannot be equal to both 'Bool' and 'Int'}}
452- // expected-error@-2 {{'Self.A' cannot be equal to both 'Never' and 'Int'}}
453- // expected-note@-3 {{same-type constraint 'Self.A' == 'Int' implied here}}
454- // expected-note@-4 {{same-type constraint 'Self.A' == 'Int' implied here}}
447+ // expected-error@-1 {{no type for 'Self.A' can satisfy both 'Self.A == Never' and 'Self.A == Bool'}}
448+ // expected-error@-2 {{no type for 'Self.A' can satisfy both 'Self.A == Never' and 'Self.A == Int'}}
449+ // expected-error@-3 {{no type for 'Self.A' can satisfy both 'Self.A == Bool' and 'Self.A == Int'}}
455450do {
456451 // CHECK-LABEL: Abstract type witness system for conformance of Conformer1 to P28a: {
457452 // CHECK-NEXT: A => (ambiguous),
@@ -481,11 +476,9 @@ protocol P29c where A == B {
481476 associatedtype B // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
482477}
483478protocol Q29a : P29a , P29b , P29c { }
484- // expected-error@-1 {{'Self.B' cannot be equal to both 'Never' and 'Int'}}
485- // expected-note@-2 {{same-type constraint 'Self.A' == 'Int' implied here}}
479+ // expected-error@-1 {{no type for 'Self.A' can satisfy both 'Self.A == Never' and 'Self.A == Int'}}
486480protocol Q29b : P29c , P29a , P29b { }
487- // expected-error@-1 {{'Self.B' cannot be equal to both 'Never' and 'Int'}}
488- // expected-note@-2 {{same-type constraint 'Self.A' == 'Int' implied here}}
481+ // expected-error@-1 {{no type for 'Self.A' can satisfy both 'Self.A == Never' and 'Self.A == Int'}}
489482do {
490483 // CHECK-LABEL: Abstract type witness system for conformance of Conformer1 to P29a: {
491484 // CHECK-NEXT: A => (ambiguous), [[EQUIV_CLASS:0x[0-9a-f]+]]
@@ -517,8 +510,7 @@ protocol P30c where A == B {
517510 associatedtype B // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
518511}
519512protocol Q30 : P30c , P30a , P30b { }
520- // expected-error@-1 {{'Self.A' cannot be equal to both 'Never' and 'Int'}}
521- // expected-note@-2 {{same-type constraint 'Self.A' == 'Int' implied here}}
513+ // expected-error@-1 {{no type for 'Self.A' can satisfy both 'Self.A == Never' and 'Self.A == Int'}}
522514do {
523515 // CHECK-LABEL: Abstract type witness system for conformance of Conformer to P30c: {
524516 // CHECK-NEXT: A => (ambiguous), [[EQUIV_CLASS:0x[0-9a-f]+]]
@@ -541,8 +533,7 @@ protocol P31c where B == A {
541533 associatedtype B // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
542534}
543535protocol Q31 : P31c , P31a , P31b { }
544- // expected-error@-1 {{'Self.B' cannot be equal to both 'Never' and 'Int'}}
545- // expected-note@-2 {{same-type constraint 'Self.B' == 'Int' implied here}}
536+ // expected-error@-1 {{no type for 'Self.A' can satisfy both 'Self.A == Never' and 'Self.A == Int'}}
546537do {
547538 // CHECK-LABEL: Abstract type witness system for conformance of Conformer to P31c: {
548539 // CHECK-NEXT: A => (ambiguous), [[EQUIV_CLASS:0x[0-9a-f]+]]
@@ -571,10 +562,12 @@ protocol P32e where A == B {
571562 associatedtype B // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
572563}
573564protocol Q32 : P32e , P32a , P32b , P32c , P32d { }
574- // expected-error@-1 {{'Self.B' cannot be equal to both 'Never' and 'Int'}}
575- // expected-error@-2 {{'Self.B' cannot be equal to both '()' and 'Int'}}
576- // expected-error@-3 {{'Self.A' cannot be equal to both 'Bool' and 'Int'}}
577- // expected-note@-4 3 {{same-type constraint 'Self.A' == 'Int' implied here}}
565+ // expected-error@-1 {{no type for 'Self.A' can satisfy both 'Self.A == Never' and 'Self.A == ()'}}
566+ // expected-error@-2 {{no type for 'Self.A' can satisfy both 'Self.A == Never' and 'Self.A == Int'}}
567+ // expected-error@-3 {{no type for 'Self.A' can satisfy both 'Self.A == Never' and 'Self.A == Bool'}}
568+ // expected-error@-4 {{no type for 'Self.A' can satisfy both 'Self.A == ()' and 'Self.A == Bool'}}
569+ // expected-error@-5 {{no type for 'Self.A' can satisfy both 'Self.A == ()' and 'Self.A == Int'}}
570+ // expected-error@-6 {{no type for 'Self.A' can satisfy both 'Self.A == Bool' and 'Self.A == Int'}}
578571do {
579572 // CHECK-LABEL: Abstract type witness system for conformance of Conformer to P32e: {
580573 // CHECK-NEXT: A => (ambiguous), [[EQUIV_CLASS:0x[0-9a-f]+]]
0 commit comments