1
- // RUN: %target-typecheck-verify-swift -warn-redundant-requirements
1
+ // RUN: %target-typecheck-verify-swift
2
2
// RUN: not %target-swift-frontend -typecheck %s -debug-generic-signatures 2>&1 | %FileCheck %s
3
3
4
4
protocol Fooable {
@@ -57,7 +57,6 @@ func test2a<T: Fooable, U: Fooable>(_ t: T, u: U) -> (X, X)
57
57
// CHECK-NEXT: Generic signature: <T, U where T : Fooable, U : Fooable, T.[Fooable]Foo == X, U.[Fooable]Foo == X>
58
58
func test3< T: Fooable , U: Fooable > ( _ t: T , u: U ) -> ( X , X )
59
59
where T. Foo == X , U. Foo == X , T. Foo == U . Foo {
60
- // expected-warning@-1{{redundant same-type constraint 'T.Foo' == 'X'}}
61
60
return ( t. foo, u. foo)
62
61
}
63
62
@@ -101,7 +100,6 @@ func test6<T: Barrable>(_ t: T) -> (Y, X) where T.Bar == Y {
101
100
// CHECK-LABEL: same_types.(file).test7@
102
101
// CHECK-NEXT: Generic signature: <T where T : Barrable, T.[Barrable]Bar == Y>
103
102
func test7< T: Barrable > ( _ t: T ) -> ( Y , X ) where T. Bar == Y , T. Bar. Foo == X {
104
- // expected-warning@-1{{redundant same-type constraint 'Y.Foo' (aka 'X') == 'X'}}
105
103
return ( t. bar, t. bar. foo)
106
104
}
107
105
@@ -143,7 +141,7 @@ func fail6<T>(_ t: T) -> Int where T == Int { // expected-warning{{same-type req
143
141
// CHECK-NEXT: Generic signature: <T, U where T : Barrable, U : Barrable, T.[Barrable]Bar == Y, U.[Barrable]Bar == Y>
144
142
func test8< T: Barrable , U: Barrable > ( _ t: T , u: U ) -> ( Y , Y , X , X )
145
143
where T. Bar == Y ,
146
- U. Bar. Foo == X , T. Bar == U . Bar { // expected-warning{{redundant same-type constraint 'U.Bar.Foo' == 'X'}}
144
+ U. Bar. Foo == X , T. Bar == U . Bar {
147
145
return ( t. bar, u. bar, t. bar. foo, u. bar. foo)
148
146
}
149
147
@@ -152,14 +150,14 @@ func test8<T: Barrable, U: Barrable>(_ t: T, u: U) -> (Y, Y, X, X)
152
150
func test8a< T: Barrable , U: Barrable > ( _ t: T , u: U ) -> ( Y , Y , X , X )
153
151
where
154
152
T. Bar == Y ,
155
- U. Bar. Foo == X , U. Bar == T . Bar { // expected-warning{{redundant same-type constraint 'U.Bar.Foo' == 'X'}}
153
+ U. Bar. Foo == X , U. Bar == T . Bar {
156
154
return ( t. bar, u. bar, t. bar. foo, u. bar. foo)
157
155
}
158
156
159
157
// CHECK-LABEL: same_types.(file).test8b(_:u:)@
160
158
// CHECK-NEXT: Generic signature: <T, U where T : Barrable, U : Barrable, T.[Barrable]Bar == Y, U.[Barrable]Bar == Y>
161
159
func test8b< T: Barrable , U: Barrable > ( _ t: T , u: U )
162
- where U. Bar. Foo == X , // expected-warning{{redundant same-type constraint 'U.Bar.Foo' == 'X'}}
160
+ where U. Bar. Foo == X ,
163
161
T. Bar == Y ,
164
162
T. Bar == U . Bar {
165
163
}
@@ -205,7 +203,6 @@ struct S2<T : P> where T.A == T.B {
205
203
// CHECK-LABEL: same_types.(file).S2.foo(x:y:)@
206
204
// CHECK-NEXT: <T, X, Y where T : P, X == Y, Y == T.[P]A, T.[P]A == T.[P]B>
207
205
func foo< X, Y> ( x: X , y: Y ) where X == T . A , Y == T . B { // expected-warning{{same-type requirement makes generic parameters 'Y' and 'X' equivalent}}
208
- // expected-warning@-1 {{redundant same-type constraint 'X' == 'T.A'}}
209
206
print ( X . self)
210
207
print ( Y . self)
211
208
print ( x)
@@ -278,7 +275,6 @@ func structuralSameType3<T, U, V, W>(_: T, _: U, _: V, _: W)
278
275
where X1 < T , U > == X1 < V , W > { }
279
276
// expected-warning@-2{{same-type requirement makes generic parameters 'V' and 'T' equivalent}}
280
277
// expected-warning@-3{{same-type requirement makes generic parameters 'W' and 'U' equivalent}}
281
- // expected-warning@-3{{redundant same-type constraint 'X1<T, U>' == 'X1<V, W>'}}
282
278
283
279
protocol P2 {
284
280
associatedtype Assoc1
@@ -337,7 +333,6 @@ func test9<T: P6, U: P6>(_ t: T, u: U) // expected-error{{no type for 'T.Bar.Foo
337
333
func testMetatypeSameType< T, U> ( _ t: T , _ u: U )
338
334
where T. Type == U . Type { }
339
335
// expected-warning@-2{{same-type requirement makes generic parameters 'U' and 'T' equivalent}}
340
- // expected-warning@-2{{redundant same-type constraint 'T.Type' == 'U.Type'}}
341
336
342
337
// CHECK-LABEL: same_types.(file).testSameTypeCommutativity1@
343
338
// CHECK-NEXT: Generic signature: <U, T where U == T.Type>
0 commit comments