44protocol P1 where A == Never {
55 associatedtype A
66}
7- // CHECK-LABEL: Abstract type witness system for conformance of S1 to P1: {
8- // CHECK-NEXT: A => Never (preferred),
9- // CHECK-NEXT: }
7+
108struct S1 : P1 { }
119
1210protocol P2a {
1311 associatedtype A
1412}
1513protocol P2b : P2a where A == Never { }
1614protocol P2c : P2b { }
17- // CHECK-LABEL: Abstract type witness system for conformance of S2a to P2a: {
18- // CHECK-NEXT: A => Never,
19- // CHECK-NEXT: }
15+
2016struct S2a : P2b { }
21- // CHECK-LABEL: Abstract type witness system for conformance of S2b to P2a: {
22- // CHECK-NEXT: A => Never,
23- // CHECK-NEXT: }
2417struct S2b : P2c { }
2518
2619// Fixed type witnesses can reference dependent members.
@@ -74,9 +67,6 @@ protocol P7a where A == Never {
7467}
7568// expected-error@+1 {{no type for 'Self.A' can satisfy both 'Self.A == Never' and 'Self.A == Bool'}}
7669protocol 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: }
8070struct S7 : P7b { }
8171
8272protocol P8a where A == Never {
@@ -100,9 +90,7 @@ protocol P9a where A == Never {
10090protocol P9b : P9a {
10191 associatedtype A
10292}
103- // CHECK-LABEL: Abstract type witness system for conformance of S9a to P9b: {
104- // CHECK-NEXT: A => Never,
105- // CHECK-NEXT: }
93+
10694struct S9a : P9b { }
10795// expected-error@+2 {{type 'S9b' does not conform to protocol 'P9a'}}
10896// expected-error@+1 {{'P9a' requires the types 'S9b.A' (aka 'Bool') and 'Never' be equivalent}}
@@ -136,9 +124,6 @@ protocol Q11 {
136124 associatedtype A
137125}
138126do {
139- // CHECK-LABEL: Abstract type witness system for conformance of Conformer to Q11: {
140- // CHECK-NEXT: A => Never,
141- // CHECK-NEXT: }
142127 struct Conformer : Q11 , P11b { }
143128}
144129
@@ -225,7 +210,6 @@ protocol P17d {
225210}
226211do {
227212 // CHECK-LABEL: Abstract type witness system for conformance of Conformer1 to P17a: {
228- // CHECK-NEXT: A => Never (preferred),
229213 // CHECK-NEXT: B => (unresolved){{$}}
230214 // CHECK-NEXT: }
231215 struct Conformer1 : P17a { } // expected-error {{type 'Conformer1' does not conform to protocol 'P17a'}}
235219 // CHECK-NEXT: }
236220 struct Conformer2 < A> : P17b { } // expected-error {{type 'Conformer2<A>' does not conform to protocol 'P17b'}}
237221 // 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]+]]
240223 // CHECK-NEXT: }
241224 struct Conformer3 : P17c { }
242225 // CHECK-LABEL: Abstract type witness system for conformance of Conformer4<A> to P17d: {
@@ -371,14 +354,12 @@ protocol P25c_1: P25a_1, P25b {}
371354protocol P25c_2 : P25a_2 , P25b { }
372355do {
373356 // 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]+]]
376358 // CHECK-NEXT: C => C (preferred),
377359 // CHECK-NEXT: }
378360 struct Conformer1 < C: Sequence > : P25c_1 where C. Element == Int { }
379361 // 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]+]]
382363 // CHECK-NEXT: C => C (preferred),
383364 // CHECK-NEXT: }
384365 struct Conformer2 < C: Sequence > : P25c_2 where C. Element == Int { }
@@ -418,15 +399,11 @@ protocol P27b where A == B.Element {
418399protocol P27c_1 : P27a , P27b { }
419400protocol P27c_2 : P27b , P27a { }
420401do {
421- // CHECK-LABEL: Abstract type witness system for conformance of Conformer1<B> to P27a: {
422- // CHECK-NEXT: A => Int (preferred),
423- // CHECK-NEXT: }
424402 // CHECK-LABEL: Abstract type witness system for conformance of Conformer1<B> to P27b: {
425403 // CHECK-NEXT: B => B (preferred),
426404 // CHECK-NEXT: }
427405 struct Conformer1 < B: Sequence > : P27c_1 where B. Element == Int { }
428406 // CHECK-LABEL: Abstract type witness system for conformance of Conformer2<B> to P27b: {
429- // CHECK-NEXT: A => Int (preferred),
430407 // CHECK-NEXT: B => B (preferred),
431408 // CHECK-NEXT: }
432409 struct Conformer2 < B: Sequence > : P27c_2 where B. Element == Int { }
465442}
466443
467444protocol 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
470447}
471448protocol P29b where B == Never {
472449 associatedtype B
@@ -481,17 +458,15 @@ protocol Q29b: P29c, P29a, P29b {}
481458// expected-error@-1 {{no type for 'Self.A' can satisfy both 'Self.A == Never' and 'Self.A == Int'}}
482459do {
483460 // 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]+]]
486462 // CHECK-NEXT: }
487463 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 }}
490466 // expected-error@-3 {{type 'Conformer1' does not conform to protocol 'P29c'}}
491467
492468 // 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]+]]
495470 // CHECK-NEXT: }
496471 struct Conformer2 : Q29b { }
497472 // expected-error@-1 {{type 'Conformer2' does not conform to protocol 'P29a'}}
@@ -536,8 +511,7 @@ protocol Q31: P31c, P31a, P31b {}
536511// expected-error@-1 {{no type for 'Self.A' can satisfy both 'Self.A == Never' and 'Self.A == Int'}}
537512do {
538513 // 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]+]]
541515 // CHECK-NEXT: }
542516 struct Conformer : Q31 { }
543517 // expected-error@-1 {{type 'Conformer' does not conform to protocol 'P31a'}}
@@ -589,9 +563,6 @@ protocol P33b where A == Int {
589563}
590564protocol Q33 : P33a , P33b { }
591565do {
592- // CHECK-LABEL: Abstract type witness system for conformance of Conformer to P33a: {
593- // CHECK-NEXT: A => Int (preferred),
594- // CHECK-NEXT: }
595566 struct Conformer : Q33 { }
596567}
597568
0 commit comments