4
4
protocol P1 where A == Never {
5
5
associatedtype A
6
6
}
7
- // CHECK-LABEL: Abstract type witness system for conformance of S1 to P1: {
8
- // CHECK-NEXT: A => Never (preferred),
9
- // CHECK-NEXT: }
7
+
10
8
struct S1 : P1 { }
11
9
12
10
protocol P2a {
13
11
associatedtype A
14
12
}
15
13
protocol P2b : P2a where A == Never { }
16
14
protocol P2c : P2b { }
17
- // CHECK-LABEL: Abstract type witness system for conformance of S2a to P2a: {
18
- // CHECK-NEXT: A => Never,
19
- // CHECK-NEXT: }
15
+
20
16
struct S2a : P2b { }
21
- // CHECK-LABEL: Abstract type witness system for conformance of S2b to P2a: {
22
- // CHECK-NEXT: A => Never,
23
- // CHECK-NEXT: }
24
17
struct S2b : P2c { }
25
18
26
19
// Fixed type witnesses can reference dependent members.
@@ -74,9 +67,6 @@ protocol P7a where A == Never {
74
67
}
75
68
// expected-error@+1 {{no type for 'Self.A' can satisfy both 'Self.A == Never' and 'Self.A == Bool'}}
76
69
protocol P7b : P7a where A == Bool { }
77
- // CHECK-LABEL: Abstract type witness system for conformance of S7 to P7a: {
78
- // CHECK-NEXT: A => Never (preferred),
79
- // CHECK-NEXT: }
80
70
struct S7 : P7b { }
81
71
82
72
protocol P8a where A == Never {
@@ -100,9 +90,7 @@ protocol P9a where A == Never {
100
90
protocol P9b : P9a {
101
91
associatedtype A
102
92
}
103
- // CHECK-LABEL: Abstract type witness system for conformance of S9a to P9b: {
104
- // CHECK-NEXT: A => Never,
105
- // CHECK-NEXT: }
93
+
106
94
struct S9a : P9b { }
107
95
// expected-error@+2 {{type 'S9b' does not conform to protocol 'P9a'}}
108
96
// expected-error@+1 {{'P9a' requires the types 'S9b.A' (aka 'Bool') and 'Never' be equivalent}}
@@ -136,9 +124,6 @@ protocol Q11 {
136
124
associatedtype A
137
125
}
138
126
do {
139
- // CHECK-LABEL: Abstract type witness system for conformance of Conformer to Q11: {
140
- // CHECK-NEXT: A => Never,
141
- // CHECK-NEXT: }
142
127
struct Conformer : Q11 , P11b { }
143
128
}
144
129
@@ -225,7 +210,6 @@ protocol P17d {
225
210
}
226
211
do {
227
212
// CHECK-LABEL: Abstract type witness system for conformance of Conformer1 to P17a: {
228
- // CHECK-NEXT: A => Never (preferred),
229
213
// CHECK-NEXT: B => (unresolved){{$}}
230
214
// CHECK-NEXT: }
231
215
struct Conformer1 : P17a { } // expected-error {{type 'Conformer1' does not conform to protocol 'P17a'}}
235
219
// CHECK-NEXT: }
236
220
struct Conformer2 < A> : P17b { } // expected-error {{type 'Conformer2<A>' does not conform to protocol 'P17b'}}
237
221
// CHECK-LABEL: Abstract type witness system for conformance of Conformer3 to P17c: {
238
- // CHECK-NEXT: A => Never (preferred), [[EQUIV_CLASS:0x[0-9a-f]+]]
239
- // CHECK-NEXT: B => Never (preferred), [[EQUIV_CLASS]]
222
+ // CHECK-NEXT: B => Self.A (preferred), [[EQUIV_CLASS:0x[0-9a-f]+]]
240
223
// CHECK-NEXT: }
241
224
struct Conformer3 : P17c { }
242
225
// CHECK-LABEL: Abstract type witness system for conformance of Conformer4<A> to P17d: {
@@ -371,14 +354,12 @@ protocol P25c_1: P25a_1, P25b {}
371
354
protocol P25c_2 : P25a_2 , P25b { }
372
355
do {
373
356
// CHECK-LABEL: Abstract type witness system for conformance of Conformer1<C> to P25a_1: {
374
- // CHECK-NEXT: A => Int (preferred), [[EQUIV_CLASS:0x[0-9a-f]+]]
375
- // CHECK-NEXT: B => Int (preferred), [[EQUIV_CLASS]]
357
+ // CHECK-NEXT: B => Self.C.Element (preferred), [[EQUIV_CLASS:0x[0-9a-f]+]]
376
358
// CHECK-NEXT: C => C (preferred),
377
359
// CHECK-NEXT: }
378
360
struct Conformer1 < C: Sequence > : P25c_1 where C. Element == Int { }
379
361
// CHECK-LABEL: Abstract type witness system for conformance of Conformer2<C> to P25a_2: {
380
- // CHECK-NEXT: A => Int (preferred), [[EQUIV_CLASS:0x[0-9a-f]+]]
381
- // CHECK-NEXT: B => Int (preferred), [[EQUIV_CLASS]]
362
+ // CHECK-NEXT: B => Int (preferred), [[EQUIV_CLASS:0x[0-9a-f]+]]
382
363
// CHECK-NEXT: C => C (preferred),
383
364
// CHECK-NEXT: }
384
365
struct Conformer2 < C: Sequence > : P25c_2 where C. Element == Int { }
@@ -418,15 +399,11 @@ protocol P27b where A == B.Element {
418
399
protocol P27c_1 : P27a , P27b { }
419
400
protocol P27c_2 : P27b , P27a { }
420
401
do {
421
- // CHECK-LABEL: Abstract type witness system for conformance of Conformer1<B> to P27a: {
422
- // CHECK-NEXT: A => Int (preferred),
423
- // CHECK-NEXT: }
424
402
// CHECK-LABEL: Abstract type witness system for conformance of Conformer1<B> to P27b: {
425
403
// CHECK-NEXT: B => B (preferred),
426
404
// CHECK-NEXT: }
427
405
struct Conformer1 < B: Sequence > : P27c_1 where B. Element == Int { }
428
406
// CHECK-LABEL: Abstract type witness system for conformance of Conformer2<B> to P27b: {
429
- // CHECK-NEXT: A => Int (preferred),
430
407
// CHECK-NEXT: B => B (preferred),
431
408
// CHECK-NEXT: }
432
409
struct Conformer2 < B: Sequence > : P27c_2 where B. Element == Int { }
465
442
}
466
443
467
444
protocol P29a where A == Int {
468
- associatedtype A // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
469
- associatedtype B // expected-note {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
445
+ associatedtype A
446
+ associatedtype B
470
447
}
471
448
protocol P29b where B == Never {
472
449
associatedtype B
@@ -481,17 +458,15 @@ protocol Q29b: P29c, P29a, P29b {}
481
458
// expected-error@-1 {{no type for 'Self.A' can satisfy both 'Self.A == Never' and 'Self.A == Int'}}
482
459
do {
483
460
// CHECK-LABEL: Abstract type witness system for conformance of Conformer1 to P29a: {
484
- // CHECK-NEXT: A => (ambiguous), [[EQUIV_CLASS:0x[0-9a-f]+]]
485
- // CHECK-NEXT: B => (ambiguous), [[EQUIV_CLASS]]
461
+ // CHECK-NEXT: B => Never, [[EQUIV_CLASS:0x[0-9a-f]+]]
486
462
// CHECK-NEXT: }
487
463
struct Conformer1 : Q29a { }
488
- // expected-error @-1 {{type 'Conformer1' does not conform to protocol 'P29a' }}
489
- // expected-error@-2 {{type 'Conformer1' does not conform to protocol 'P29b' }}
464
+ // expected-note @-1 {{requirement specified as 'Self.A' == 'Self.B' [with Self = Conformer1] }}
465
+ // expected-error@-2 {{'P29c' requires the types 'Conformer1.A' (aka 'Int') and 'Conformer1.B' (aka 'Never') be equivalent }}
490
466
// expected-error@-3 {{type 'Conformer1' does not conform to protocol 'P29c'}}
491
467
492
468
// CHECK-LABEL: Abstract type witness system for conformance of Conformer2 to P29c: {
493
- // CHECK-NEXT: A => (ambiguous), [[EQUIV_CLASS:0x[0-9a-f]+]]
494
- // CHECK-NEXT: B => (ambiguous), [[EQUIV_CLASS]]
469
+ // CHECK-NEXT: B => Never (preferred), [[EQUIV_CLASS:0x[0-9a-f]+]]
495
470
// CHECK-NEXT: }
496
471
struct Conformer2 : Q29b { }
497
472
// expected-error@-1 {{type 'Conformer2' does not conform to protocol 'P29a'}}
@@ -536,8 +511,7 @@ protocol Q31: P31c, P31a, P31b {}
536
511
// expected-error@-1 {{no type for 'Self.A' can satisfy both 'Self.A == Never' and 'Self.A == Int'}}
537
512
do {
538
513
// CHECK-LABEL: Abstract type witness system for conformance of Conformer to P31c: {
539
- // CHECK-NEXT: A => (ambiguous), [[EQUIV_CLASS:0x[0-9a-f]+]]
540
- // CHECK-NEXT: B => (ambiguous), [[EQUIV_CLASS]]
514
+ // CHECK-NEXT: B => (ambiguous), [[EQUIV_CLASS:0x[0-9a-f]+]]
541
515
// CHECK-NEXT: }
542
516
struct Conformer : Q31 { }
543
517
// expected-error@-1 {{type 'Conformer' does not conform to protocol 'P31a'}}
@@ -589,9 +563,6 @@ protocol P33b where A == Int {
589
563
}
590
564
protocol Q33 : P33a , P33b { }
591
565
do {
592
- // CHECK-LABEL: Abstract type witness system for conformance of Conformer to P33a: {
593
- // CHECK-NEXT: A => Int (preferred),
594
- // CHECK-NEXT: }
595
566
struct Conformer : Q33 { }
596
567
}
597
568
0 commit comments