1
- // RUN: %target-typecheck-verify-swift -requirement-machine-protocol-signatures=verify -requirement-machine-inferred-signatures=verify
2
- // RUN: not %target-swift-frontend -typecheck %s -debug-generic-signatures -requirement-machine-protocol-signatures=verify -requirement-machine-inferred-signatures=verify > %t.dump 2>&1
1
+ // RUN: %target-typecheck-verify-swift -requirement-machine-protocol-signatures=on -requirement-machine-inferred-signatures=on
2
+ // RUN: not %target-swift-frontend -typecheck %s -debug-generic-signatures -requirement-machine-protocol-signatures=on -requirement-machine-inferred-signatures=on > %t.dump 2>&1
3
3
// RUN: %FileCheck %s < %t.dump
4
4
5
5
class A {
@@ -12,13 +12,10 @@ class B : A {
12
12
13
13
class Other { }
14
14
15
- func f1< T : A > ( _: T ) where T : Other { } // expected-error{{type 'T' cannot be a subclass of both 'Other' and 'A'}}
16
- // expected-note@-1{{constraint conflicts with 'T' : 'A'}}
15
+ func f1< T : A > ( _: T ) where T : Other { } // expected-error{{no type for 'T' can satisfy both 'T : Other' and 'T : A'}}
17
16
18
17
func f2< T : A > ( _: T ) where T : B { }
19
18
// expected-warning@-1{{redundant superclass constraint 'T' : 'A'}}
20
- // expected-note@-2{{superclass constraint 'T' : 'A' implied here}}
21
-
22
19
23
20
class GA < T> { }
24
21
class GB < T> : GA < T > { }
@@ -31,19 +28,16 @@ func f5<T, U : GA<T>>(_: T, _: U) {}
31
28
func f6< U : GA < T > , T : P > ( _: T , _: U ) { }
32
29
func f7< U, T> ( _: T , _: U ) where U : GA < T > , T : P { }
33
30
34
- func f8< T : GA < A > > ( _: T ) where T : GA < B > { } // expected-error{{type 'T' cannot be a subclass of both 'GA<B>' and 'GA<A>'}}
35
- // expected-note@-1{{constraint conflicts with 'T' : 'GA<A>'}}
31
+ func f8< T : GA < A > > ( _: T ) where T : GA < B > { } // expected-error{{no type for 'T' can satisfy both 'T : GA<B>' and 'T : GA<A>'}}
36
32
37
33
func f9< T : GA < A > > ( _: T ) where T : GB < A > { }
38
34
// expected-warning@-1{{redundant superclass constraint 'T' : 'GA<A>'}}
39
- // expected-note@-2{{superclass constraint 'T' : 'GA<A>' implied here}}
40
35
41
36
func f10< T : GB < A > > ( _: T ) where T : GA < A > { }
42
37
// expected-warning@-1{{redundant superclass constraint 'T' : 'GA<A>'}}
43
- // expected-note@-2{{superclass constraint 'T' : 'GA<A>' implied here}}
44
38
45
- func f11< T : GA < T > > ( _: T ) { } // expected-error{{superclass constraint 'T' : 'GA<T>' is recursive}}
46
- func f12< T : GA < U > , U : GB < T > > ( _: T , _: U ) { } // expected-error{{superclass constraint 'U' : 'GB<T>' is recursive}} // expected-error{{superclass constraint 'T' : 'GA<U>' is recursive}}
39
+ func f11< T : GA < T > > ( _: T ) { }
40
+ func f12< T : GA < U > , U : GB < T > > ( _: T , _: U ) { }
47
41
func f13< T : U , U : GA < T > > ( _: T , _: U ) { } // expected-error{{type 'T' constrained to non-protocol, non-class type 'U'}}
48
42
49
43
// rdar://problem/24730536
@@ -68,16 +62,16 @@ class S : P2 {
68
62
// CHECK-LABEL: .superclassConformance1(t:)@
69
63
// CHECK-NEXT: Generic signature: <T where T : C>
70
64
func superclassConformance1< T> ( t: T )
71
- where T : C , // expected-note{{conformance constraint 'T' : 'P3' implied here}}
72
- T : P3 { } // expected-warning{{redundant conformance constraint 'T ' : 'P3'}}
65
+ where T : C ,
66
+ T : P3 { } // expected-warning{{redundant conformance constraint 'C ' : 'P3'}}
73
67
74
68
75
69
76
70
// CHECK-LABEL: .superclassConformance2(t:)@
77
71
// CHECK-NEXT: Generic signature: <T where T : C>
78
72
func superclassConformance2< T> ( t: T )
79
- where T : C , // expected-note{{conformance constraint 'T' : 'P3' implied here}}
80
- T : P3 { } // expected-warning{{redundant conformance constraint 'T ' : 'P3'}}
73
+ where T : C ,
74
+ T : P3 { } // expected-warning{{redundant conformance constraint 'C ' : 'P3'}}
81
75
82
76
protocol P4 { }
83
77
@@ -87,32 +81,28 @@ class C2 : C, P4 { }
87
81
// CHECK-NEXT: Generic signature: <T where T : C2>
88
82
func superclassConformance3< T> ( t: T ) where T : C , T : P4 , T : C2 { }
89
83
// expected-warning@-1{{redundant superclass constraint 'T' : 'C'}}
90
- // expected-note@-2{{superclass constraint 'T' : 'C' implied here}}
91
- // expected-warning@-3{{redundant conformance constraint 'T' : 'P4'}}
92
- // expected-note@-4{{conformance constraint 'T' : 'P4' implied here}}
84
+ // expected-warning@-2{{redundant conformance constraint 'T' : 'P4'}}
93
85
94
86
protocol P5 : A { }
95
87
96
- protocol P6 : A , Other { } // expected-error {{type 'Self' cannot be a subclass of both 'Other' and 'A'}}
88
+ protocol P6 : A , Other { } // expected-error {{no type for 'Self' can satisfy both 'Self : Other' and 'Self : A'}}
97
89
// expected-error@-1{{multiple inheritance from classes 'A' and 'Other'}}
98
- // expected-note@-2 {{constraint conflicts with 'Self' : 'A'}}
99
90
100
91
func takeA( _: A ) { }
101
92
func takeP5< T: P5 > ( _ t: T ) {
102
93
takeA ( t) // okay
103
94
}
104
95
105
96
protocol P7 {
106
- associatedtype Assoc : A , Other
107
- // expected-note@-1{{constraint conflicts with 'Self.Assoc' : 'A'}}
108
- // expected-error@-2{{'Self.Assoc' cannot be a subclass of both 'Other' and 'A'}}
97
+ // expected-error@-1{{no type for 'Self.Assoc' can satisfy both 'Self.Assoc : Other' and 'Self.Assoc : A'}}
98
+ associatedtype Assoc : A , Other
109
99
}
110
100
111
101
// CHECK-LABEL: .superclassConformance4@
112
102
// CHECK-NEXT: Generic signature: <T, U where T : P3, U : P3, T.[P3]T : C, T.[P3]T == U.[P3]T>
113
103
func superclassConformance4< T: P3 , U: P3 > ( _: T , _: U )
114
- where T. T: C , // expected-note{{ superclass constraint 'U .T' : 'C' implied here }}
115
- U. T: C , // expected-warning{{redundant superclass constraint 'U.T' : 'C'}}
104
+ where T. T: C , // expected-warning{{redundant superclass constraint 'T .T' : 'C'}}
105
+ U. T: C ,
116
106
T. T == U . T { }
117
107
118
108
// Lookup of superclass associated types from inheritance clause
@@ -181,8 +171,7 @@ protocol Rump : Tail {
181
171
class Horse < T> : Rump { }
182
172
183
173
func hasRedundantConformanceConstraint< X : Horse < T > , T> ( _: X ) where X : Rump { }
184
- // expected-warning@-1 {{redundant conformance constraint 'X' : 'Rump'}}
185
- // expected-note@-2 {{conformance constraint 'X' : 'Rump' implied here}}
174
+ // expected-warning@-1 {{redundant conformance constraint 'Horse<T>' : 'Rump'}}
186
175
187
176
// SR-5862
188
177
protocol X {
0 commit comments