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
3
3
4
4
protocol P1 where A == Never {
5
5
associatedtype A
@@ -60,8 +60,7 @@ protocol P5b: P5a where A == Self {}
60
60
struct S5 < X> : P5b { } // OK, A := S5<X>
61
61
62
62
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'}}
65
64
// expected-note@+1 {{protocol requires nested type 'A}}
66
65
associatedtype A : P6
67
66
}
@@ -73,8 +72,7 @@ struct S6: P6 {} // expected-error {{type 'S6' does not conform to protocol 'P6'
73
72
protocol P7a where A == Never {
74
73
associatedtype A
75
74
}
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'}}
78
76
protocol P7b : P7a where A == Bool { }
79
77
// CHECK-LABEL: Abstract type witness system for conformance of S7 to P7a: {
80
78
// CHECK-NEXT: A => Never,
@@ -106,10 +104,9 @@ protocol P9b: P9a {
106
104
// CHECK-NEXT: A => Never,
107
105
// CHECK-NEXT: }
108
106
struct 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]}}
113
110
typealias A = Bool
114
111
}
115
112
struct S9c : P9b { // OK, S9c.A does not contradict Self.A == Never.
@@ -445,13 +442,11 @@ protocol P28c where A == Never {
445
442
associatedtype A
446
443
}
447
444
protocol 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'}}
450
446
protocol 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'}}
455
450
do {
456
451
// CHECK-LABEL: Abstract type witness system for conformance of Conformer1 to P28a: {
457
452
// CHECK-NEXT: A => (ambiguous),
@@ -481,11 +476,9 @@ protocol P29c where A == B {
481
476
associatedtype B // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
482
477
}
483
478
protocol 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'}}
486
480
protocol 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'}}
489
482
do {
490
483
// CHECK-LABEL: Abstract type witness system for conformance of Conformer1 to P29a: {
491
484
// CHECK-NEXT: A => (ambiguous), [[EQUIV_CLASS:0x[0-9a-f]+]]
@@ -517,8 +510,7 @@ protocol P30c where A == B {
517
510
associatedtype B // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
518
511
}
519
512
protocol 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'}}
522
514
do {
523
515
// CHECK-LABEL: Abstract type witness system for conformance of Conformer to P30c: {
524
516
// CHECK-NEXT: A => (ambiguous), [[EQUIV_CLASS:0x[0-9a-f]+]]
@@ -541,8 +533,7 @@ protocol P31c where B == A {
541
533
associatedtype B // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
542
534
}
543
535
protocol 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'}}
546
537
do {
547
538
// CHECK-LABEL: Abstract type witness system for conformance of Conformer to P31c: {
548
539
// CHECK-NEXT: A => (ambiguous), [[EQUIV_CLASS:0x[0-9a-f]+]]
@@ -571,10 +562,12 @@ protocol P32e where A == B {
571
562
associatedtype B // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
572
563
}
573
564
protocol 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'}}
578
571
do {
579
572
// CHECK-LABEL: Abstract type witness system for conformance of Conformer to P32e: {
580
573
// CHECK-NEXT: A => (ambiguous), [[EQUIV_CLASS:0x[0-9a-f]+]]
0 commit comments