Skip to content

Commit ea15d9f

Browse files
committed
Stop passing -warn-redundant-requirements in tests
1 parent ada2e40 commit ea15d9f

File tree

70 files changed

+332
-354
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+332
-354
lines changed

test/AutoDiff/SILGen/differentiability_witness_generic_signature.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %target-swift-emit-silgen -verify -module-name main %s -warn-redundant-requirements | %FileCheck %s
2-
// RUN: %target-swift-emit-sil -verify -module-name main %s -warn-redundant-requirements
1+
// RUN: %target-swift-emit-silgen -verify -module-name main %s | %FileCheck %s
2+
// RUN: %target-swift-emit-sil -verify -module-name main %s
33

44
// NOTE: SILParser crashes for SILGen round-trip
55
// (https://github.com/apple/swift/issues/54370).
@@ -85,7 +85,7 @@ extension AllConcrete where T == Float {
8585
// Derivative generic signature: `<T where T == Float>` (explicit `where` clause)
8686
// Witness generic signature: none
8787
@_silgen_name("allconcrete_where_gensig")
88-
@differentiable(reverse where T == Float) // expected-warning {{redundant same-type constraint 'T' == 'Float'}}
88+
@differentiable(reverse where T == Float)
8989
func whereClauseGenericSignature() -> AllConcrete {
9090
return self
9191
}
@@ -159,7 +159,7 @@ extension NotAllConcrete where T == Float {
159159
// Derivative generic signature: `<T, U where T == Float>` (explicit `where` clause)
160160
// Witness generic signature: `<T, U where T == Float>` (not all concrete)
161161
@_silgen_name("notallconcrete_where_gensig")
162-
@differentiable(reverse where T == Float) // expected-warning {{redundant same-type constraint 'T' == 'Float'}}
162+
@differentiable(reverse where T == Float)
163163
func whereClauseGenericSignature() -> NotAllConcrete {
164164
return self
165165
}

test/AutoDiff/SILOptimizer/generics.swift

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-emit-sil -verify %s -warn-redundant-requirements | %FileCheck %s -check-prefix=CHECK-SIL
1+
// RUN: %target-swift-emit-sil -verify %s | %FileCheck %s -check-prefix=CHECK-SIL
22

33
import _Differentiation
44

@@ -51,14 +51,12 @@ func foo<T>(_ x: Wrapper<T>) {
5151

5252
// Test case where associated derivative function's requirements are met.
5353
extension Wrapper where Scalar : Numeric {
54-
@differentiable(reverse, wrt: self where Scalar : Differentiable & FloatingPoint) // expected-warning {{redundant conformance constraint 'Scalar' : 'Differentiable'}}
55-
// expected-warning@-1 {{redundant conformance constraint 'Scalar' : 'Numeric'}}
54+
@differentiable(reverse, wrt: self where Scalar : Differentiable & FloatingPoint)
5655
func mean() -> Wrapper {
5756
return self
5857
}
5958

60-
@differentiable(reverse, wrt: self where Scalar : Differentiable & FloatingPoint) // expected-warning {{redundant conformance constraint 'Scalar' : 'Differentiable'}}
61-
// expected-warning@-1 {{redundant conformance constraint 'Scalar' : 'Numeric'}}
59+
@differentiable(reverse, wrt: self where Scalar : Differentiable & FloatingPoint)
6260
func variance() -> Wrapper {
6361
return mean() // ok
6462
}
@@ -219,7 +217,7 @@ let _: @differentiable(reverse) (Float, Float) -> TF_546<Float> = { r, i in
219217
struct TF_652<Scalar> {}
220218
extension TF_652 : Differentiable where Scalar : FloatingPoint {}
221219

222-
@differentiable(reverse, wrt: x where Scalar: FloatingPoint) // expected-warning {{redundant conformance constraint 'Scalar' : 'Numeric'}}
220+
@differentiable(reverse, wrt: x where Scalar: FloatingPoint)
223221
func test<Scalar: Numeric>(x: TF_652<Scalar>) -> TF_652<Scalar> {
224222
for _ in 0..<10 {
225223
let _ = x
@@ -295,7 +293,7 @@ struct TF_697_Sequential<Layer1: TF_697_Module, Layer2: TF_697_Layer>: TF_697_Mo
295293
layer2.callLayer(layer1.callModule(input))
296294
}
297295
}
298-
extension TF_697_Sequential: TF_697_Layer where Layer1: TF_697_Layer { // expected-warning {{redundant conformance constraint 'Layer1' : 'TF_697_Module'}}
296+
extension TF_697_Sequential: TF_697_Layer where Layer1: TF_697_Layer {
299297
@differentiable(reverse)
300298
func callLayer(_ input: Layer1.Input) -> Layer2.Output {
301299
layer2.callLayer(layer1.callLayer(input))
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %target-typecheck-verify-swift -swift-version 4 -warn-redundant-requirements
1+
// RUN: %target-typecheck-verify-swift -swift-version 4
22
// RUN: not %target-swift-frontend -typecheck -swift-version 5
33

44
protocol P : class, AnyObject { } // expected-warning{{redundant inheritance from 'AnyObject' and Swift 3 'class' keyword}}{{14-21=}}
5-
// expected-warning@-1{{redundant constraint 'Self' : 'AnyObject'}}
5+

test/Constraints/generic_super_constraint.swift

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
// RUN: %target-typecheck-verify-swift %s -warn-redundant-requirements
1+
// RUN: %target-typecheck-verify-swift %s
22

33
class Base<T> { }
44
class Derived: Base<Int> { }
55

6-
// expected-warning@+1 {{redundant superclass constraint 'T' : 'Base<Int>'}}
76
func foo<T>(_ x: T) -> Derived where T: Base<Int>, T: Derived {
87
return x
98
}
109

11-
// FIXME: There is no explicit same-type requirement written.
12-
// expected-warning@+1{{same-type requirement makes generic parameter 'T' non-generic}}
1310
func bar<T, U>(_ x: U, y: T) -> (Derived, Int) where U: Base<T>, U: Derived {
11+
// expected-warning@-1 {{same-type requirement makes generic parameter 'T' non-generic}}
1412
return (x, y)
1513
}
1614

test/Constraints/same_types.swift

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -warn-redundant-requirements
1+
// RUN: %target-typecheck-verify-swift
22
// RUN: not %target-swift-frontend -typecheck %s -debug-generic-signatures 2>&1 | %FileCheck %s
33

44
protocol Fooable {
@@ -57,7 +57,6 @@ func test2a<T: Fooable, U: Fooable>(_ t: T, u: U) -> (X, X)
5757
// CHECK-NEXT: Generic signature: <T, U where T : Fooable, U : Fooable, T.[Fooable]Foo == X, U.[Fooable]Foo == X>
5858
func test3<T: Fooable, U: Fooable>(_ t: T, u: U) -> (X, X)
5959
where T.Foo == X, U.Foo == X, T.Foo == U.Foo {
60-
// expected-warning@-1{{redundant same-type constraint 'T.Foo' == 'X'}}
6160
return (t.foo, u.foo)
6261
}
6362

@@ -101,7 +100,6 @@ func test6<T: Barrable>(_ t: T) -> (Y, X) where T.Bar == Y {
101100
// CHECK-LABEL: same_types.(file).test7@
102101
// CHECK-NEXT: Generic signature: <T where T : Barrable, T.[Barrable]Bar == Y>
103102
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'}}
105103
return (t.bar, t.bar.foo)
106104
}
107105

@@ -143,7 +141,7 @@ func fail6<T>(_ t: T) -> Int where T == Int { // expected-warning{{same-type req
143141
// CHECK-NEXT: Generic signature: <T, U where T : Barrable, U : Barrable, T.[Barrable]Bar == Y, U.[Barrable]Bar == Y>
144142
func test8<T: Barrable, U: Barrable>(_ t: T, u: U) -> (Y, Y, X, X)
145143
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 {
147145
return (t.bar, u.bar, t.bar.foo, u.bar.foo)
148146
}
149147

@@ -152,14 +150,14 @@ func test8<T: Barrable, U: Barrable>(_ t: T, u: U) -> (Y, Y, X, X)
152150
func test8a<T: Barrable, U: Barrable>(_ t: T, u: U) -> (Y, Y, X, X)
153151
where
154152
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 {
156154
return (t.bar, u.bar, t.bar.foo, u.bar.foo)
157155
}
158156

159157
// CHECK-LABEL: same_types.(file).test8b(_:u:)@
160158
// CHECK-NEXT: Generic signature: <T, U where T : Barrable, U : Barrable, T.[Barrable]Bar == Y, U.[Barrable]Bar == Y>
161159
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,
163161
T.Bar == Y,
164162
T.Bar == U.Bar {
165163
}
@@ -205,7 +203,6 @@ struct S2<T : P> where T.A == T.B {
205203
// CHECK-LABEL: same_types.(file).S2.foo(x:y:)@
206204
// CHECK-NEXT: <T, X, Y where T : P, X == Y, Y == T.[P]A, T.[P]A == T.[P]B>
207205
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'}}
209206
print(X.self)
210207
print(Y.self)
211208
print(x)
@@ -278,7 +275,6 @@ func structuralSameType3<T, U, V, W>(_: T, _: U, _: V, _: W)
278275
where X1<T, U> == X1<V, W> { }
279276
// expected-warning@-2{{same-type requirement makes generic parameters 'V' and 'T' equivalent}}
280277
// 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>'}}
282278

283279
protocol P2 {
284280
associatedtype Assoc1
@@ -337,7 +333,6 @@ func test9<T: P6, U: P6>(_ t: T, u: U) // expected-error{{no type for 'T.Bar.Foo
337333
func testMetatypeSameType<T, U>(_ t: T, _ u: U)
338334
where T.Type == U.Type { }
339335
// 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'}}
341336

342337
// CHECK-LABEL: same_types.(file).testSameTypeCommutativity1@
343338
// CHECK-NEXT: Generic signature: <U, T where U == T.Type>

test/Generics/associated_type_typo.swift

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -warn-redundant-requirements
1+
// RUN: %target-typecheck-verify-swift
22

33
// RUN: not %target-swift-frontend -typecheck -debug-generic-signatures %s > %t.dump 2>&1
44
// RUN: %FileCheck -check-prefix CHECK-GENERIC %s < %t.dump
@@ -62,9 +62,10 @@ protocol Pattern {
6262

6363
// FIXME: This works for all of the wrong reasons, but it is correct that
6464
// it works.
65-
// FIXME(rqm-diagnostics): Bogus warning here.
65+
// CHECK-GENERIC-LABEL: .matched(atStartOf:)@
66+
// CHECK-GENERIC-NEXT: Generic signature: <Self, C where Self : Pattern, C : Sequence, C : Indexable, Self.[Pattern]Element == C.[Sequence]Element, C.[Sequence]Element == C.[_Indexable1]Slice.[Sequence]Element, C.[_Indexable1]Slice : Sequence>
6667
func matched<C: Indexable>(atStartOf c: C)
67-
where Element_<C> == Element // expected-warning {{redundant same-type constraint 'Element_<C>' (aka 'C.Iterator.Element') == 'Self.Element'}}
68+
where Element_<C> == Element
6869
, Element_<C.Slice> == Element
6970
}
7071

test/Generics/associated_type_where_clause.swift

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -swift-version 4 -warn-redundant-requirements
1+
// RUN: %target-typecheck-verify-swift -swift-version 4
22

33
func needsSameType<T>(_: T.Type, _: T.Type) {}
44

@@ -134,7 +134,6 @@ struct X { }
134134
protocol P {
135135
associatedtype P1 where P1 == X
136136
associatedtype P2 where P2 == P1, P2 == X
137-
// expected-warning@-1{{redundant same-type constraint 'Self.P2' == 'X'}}
138137
}
139138

140139
// Lookup of same-named associated types aren't ambiguous in this context.

test/Generics/canonicalization.swift

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// RUN: %target-typecheck-verify-swift -warn-redundant-requirements
1+
// RUN: %target-typecheck-verify-swift
2+
// RUN: not %target-swift-frontend -typecheck %s -debug-generic-signatures 2>&1 | %FileCheck %s
23

34
// rdar://problem/23149063
45
protocol P0 { }
@@ -11,8 +12,11 @@ protocol Q : P {
1112
associatedtype A
1213
}
1314

15+
// CHECK-LABEL: .f(t:)@
16+
// CHECK-NEXT: Generic signature: <T where T : Q, T.[P]A : P0>
1417
func f<T>(t: T) where T : P, T : Q, T.A : P0 { } // expected-note{{'f(t:)' previously declared here}}
15-
// expected-warning@-1{{redundant conformance constraint 'T' : 'P'}}
1618

19+
// CHECK-LABEL: .f(t:)@
20+
// CHECK-NEXT: Generic signature: <T where T : Q, T.[P]A : P0>
1721
func f<T>(t: T) where T : Q, T : P, T.A : P0 { } // expected-error{{invalid redeclaration of 'f(t:)'}}
18-
// expected-warning@-1{{redundant conformance constraint 'T' : 'P'}}
22+

test/Generics/concrete_conformances_in_protocol.swift

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -warn-redundant-requirements
1+
// RUN: %target-typecheck-verify-swift
22
// RUN: %target-swift-frontend -typecheck %s -debug-generic-signatures 2>&1 | %FileCheck %s
33

44
protocol P {
@@ -13,7 +13,6 @@ struct S : P {
1313

1414
protocol R0 {
1515
associatedtype A where A : P, A == S
16-
// expected-warning@-1 {{redundant conformance constraint 'S' : 'P'}}
1716
}
1817

1918
////
@@ -26,15 +25,13 @@ struct G<T> : P {}
2625
protocol R1 {
2726
associatedtype A
2827
associatedtype B where B : P, B == G<A>
29-
// expected-warning@-1 {{redundant conformance constraint 'G<Self.A>' : 'P'}}
3028
}
3129

3230
// CHECK-LABEL: concrete_conformances_in_protocol.(file).R2@
3331
// CHECK-LABEL: Requirement signature: <Self where Self.[R2]A == G<Self.[R2]B>>
3432

3533
protocol R2 {
3634
associatedtype A where A : P, A == G<B>
37-
// expected-warning@-1 {{redundant conformance constraint 'G<Self.B>' : 'P'}}
3835
associatedtype B
3936
}
4037

@@ -52,15 +49,13 @@ struct GG<T : P> : PP {}
5249
protocol RR3 {
5350
associatedtype A : P
5451
associatedtype B where B : PP, B == GG<A>
55-
// expected-warning@-1 {{redundant conformance constraint 'GG<Self.A>' : 'PP'}}
5652
}
5753

5854
// CHECK-LABEL: concrete_conformances_in_protocol.(file).RR4@
5955
// CHECK-LABEL: Requirement signature: <Self where Self.[RR4]A == GG<Self.[RR4]B>, Self.[RR4]B : P>
6056

6157
protocol RR4 {
6258
associatedtype A where A : PP, A == GG<B>
63-
// expected-warning@-1 {{redundant conformance constraint 'GG<Self.B>' : 'PP'}}
6459
associatedtype B : P
6560
}
6661

@@ -70,15 +65,13 @@ protocol RR4 {
7065
protocol RR5 {
7166
associatedtype A : PP
7267
associatedtype B where B : PP, B == GG<A.T>
73-
// expected-warning@-1 {{redundant conformance constraint 'GG<Self.A.T>' : 'PP'}}
7468
}
7569

7670
// CHECK-LABEL: concrete_conformances_in_protocol.(file).RR6@
7771
// CHECK-LABEL: Requirement signature: <Self where Self.[RR6]A == GG<Self.[RR6]B.[PP]T>, Self.[RR6]B : PP>
7872

7973
protocol RR6 {
8074
associatedtype A where A : PP, A == GG<B.T>
81-
// expected-warning@-1 {{redundant conformance constraint 'GG<Self.B.T>' : 'PP'}}
8275
associatedtype B : PP
8376
}
8477

@@ -95,7 +88,6 @@ struct GGG<U : P1> : P1 {
9588

9689
protocol P2 {
9790
associatedtype T : P1 where T == GGG<U>
98-
// expected-warning@-1 {{redundant conformance constraint 'GGG<Self.U>' : 'P1'}}
9991
associatedtype U : P1
10092
}
10193

test/Generics/concrete_contraction_unrelated_typealias.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -typecheck -verify %s -debug-generic-signatures -warn-redundant-requirements 2>&1 | %FileCheck %s
1+
// RUN: %target-swift-frontend -typecheck -verify %s -debug-generic-signatures 2>&1 | %FileCheck %s
22

33
// Another GenericSignatureBuilder oddity, reduced from RxSwift.
44
//
@@ -25,10 +25,10 @@ class GenericDelegateProxy<P : AnyObject, D> {
2525

2626
// CHECK-LABEL: .GenericDelegateProxy.init(_:)@
2727
// CHECK-NEXT: <P, D, Proxy where P == Proxy.[DelegateProxyType]Parent, D == Proxy.[DelegateProxyType]Delegate, Proxy : GenericDelegateProxy<P, D>, Proxy : DelegateProxyType>
28-
init<Proxy: DelegateProxyType>(_: Proxy.Type) // expected-warning {{redundant constraint 'P' : 'AnyObject'}}
28+
init<Proxy: DelegateProxyType>(_: Proxy.Type)
2929
where Proxy: GenericDelegateProxy<P, D>,
30-
Proxy.Parent == P, // expected-warning {{redundant same-type constraint 'GenericDelegateProxy<P, D>.Parent' (aka 'P') == 'P'}}
31-
Proxy.Delegate == D {} // expected-warning {{redundant same-type constraint 'GenericDelegateProxy<P, D>.Delegate' (aka 'D') == 'D'}}
30+
Proxy.Parent == P,
31+
Proxy.Delegate == D {}
3232
}
3333

3434
class SomeClass {}

test/Generics/concrete_same_type_versus_anyobject.swift

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -warn-redundant-requirements
1+
// RUN: %target-typecheck-verify-swift
22
// RUN: not %target-swift-frontend -typecheck -debug-generic-signatures %s 2>&1 | %FileCheck %s
33

44
struct S {}
@@ -13,7 +13,7 @@ extension G1 where T == S {}
1313

1414
// CHECK: ExtensionDecl line={{.*}} base=G1
1515
// CHECK-NEXT: Generic signature: <T where T == C>
16-
extension G1 where T == C {} // expected-warning {{redundant constraint 'T' : 'AnyObject'}}
16+
extension G1 where T == C {}
1717

1818
struct G2<U> {}
1919

@@ -25,12 +25,10 @@ extension G2 where U == S, U : AnyObject {}
2525
// CHECK: ExtensionDecl line={{.*}} base=G2
2626
// CHECK-NEXT: Generic signature: <U where U == C>
2727
extension G2 where U == C, U : AnyObject {}
28-
// expected-warning@-1 {{redundant constraint 'U' : 'AnyObject'}}
2928

3029
// CHECK: ExtensionDecl line={{.*}} base=G2
3130
// CHECK-NEXT: Generic signature: <U where U : C>
3231
extension G2 where U : C, U : AnyObject {}
33-
// expected-warning@-1 {{redundant constraint 'U' : 'AnyObject'}}
3432

3533
// Explicit AnyObject conformance vs derived same-type
3634
protocol P {
@@ -40,4 +38,3 @@ protocol P {
4038
// CHECK: .explicitAnyObjectIsRedundant@
4139
// CHECK-NEXT: Generic signature: <T where T : P>
4240
func explicitAnyObjectIsRedundant<T : P>(_: T) where T.A : AnyObject {}
43-
// expected-warning@-1 {{redundant constraint 'T.A' : 'AnyObject'}}

0 commit comments

Comments
 (0)