Skip to content

Commit 55d2ce7

Browse files
committed
[Test] Skip redundancy warnings in attr_specialize
1 parent 3865b5d commit 55d2ce7

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

test/attr/attr_specialize.swift

Lines changed: 8 additions & 14 deletions
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-ide-test -print-ast-typechecked -source-filename=%s -disable-objc-attr-requires-foundation-module -define-availability 'SwiftStdlib 5.1:macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0' | %FileCheck %s
33

44
struct S<T> {}
@@ -48,9 +48,8 @@ func nonGenericParam(x: Int) {}
4848
class G<T> {
4949
// CHECK: @_specialize(exported: false, kind: full, where T == Int)
5050
@_specialize(where T == Int)
51-
@_specialize(where T == T) // expected-warning{{redundant same-type constraint 'T' == 'T'}}
52-
// expected-error@-1 {{too few generic parameters are specified in '_specialize' attribute (got 0, but expected 1)}}
53-
// expected-note@-2 {{missing constraint for 'T' in '_specialize' attribute}}
51+
@_specialize(where T == T) // expected-error{{too few generic parameters are specified in '_specialize' attribute (got 0, but expected 1)}}
52+
// expected-note@-1 {{missing constraint for 'T' in '_specialize' attribute}}
5453
@_specialize(where T == S<T>)
5554
// expected-error@-1 {{cannot build rewrite system for generic signature; concrete nesting limit exceeded}}
5655
// expected-note@-2 {{failed rewrite rule is τ_0_0.[concrete: S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<S<τ_0_0>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] => τ_0_0}}
@@ -125,7 +124,6 @@ public func funcWithEmptySpecializeAttr<X: P, Y>(x: X, y: Y) {
125124
@_specialize(where X:_Trivial(8), Y == Int)
126125
@_specialize(where X == Int, Y == Int)
127126
@_specialize(where X == Int, X == Int) // expected-error{{too few generic parameters are specified in '_specialize' attribute (got 1, but expected 2)}} expected-note{{missing constraint for 'Y' in '_specialize' attribute}}
128-
// expected-warning@-1{{redundant same-type constraint 'X' == 'Int'}}
129127
@_specialize(where Y:_Trivial(32), X == Float)
130128
@_specialize(where X1 == Int, Y1 == Int) // expected-error{{cannot find type 'X1' in scope}} expected-error{{cannot find type 'Y1' in scope}} expected-error{{too few generic parameters are specified in '_specialize' attribute (got 0, but expected 2)}} expected-note{{missing constraint for 'X' in '_specialize' attribute}} expected-note{{missing constraint for 'Y' in '_specialize' attribute}}
131129
public func funcWithTwoGenericParameters<X, Y>(x: X, y: Y) {
@@ -165,20 +163,17 @@ public func anotherFuncWithTwoGenericParameters<X: P, Y>(x: X, y: Y) {
165163
// expected-error@-1 {{too few generic parameters are specified in '_specialize' attribute (got 0, but expected 1)}}
166164
// expected-note@-2 {{missing constraint for 'T' in '_specialize' attribute}}
167165
@_specialize(where T: C1) // expected-error{{only same-type and layout requirements are supported by '_specialize' attribute}}
168-
@_specialize(where Int: P) // expected-warning{{redundant conformance constraint 'Int' : 'P'}} expected-error{{too few generic parameters are specified in '_specialize' attribute (got 0, but expected 1)}} expected-note{{missing constraint for 'T' in '_specialize' attribute}}
166+
@_specialize(where Int: P) // expected-error{{too few generic parameters are specified in '_specialize' attribute (got 0, but expected 1)}} expected-note{{missing constraint for 'T' in '_specialize' attribute}}
169167
func funcWithForbiddenSpecializeRequirement<T>(_ t: T) {
170168
}
171169

172170
@_specialize(where T: _Trivial(32), T: _Trivial(64), T: _Trivial, T: _RefCountedObject)
173171
// expected-error@-1{{no type for 'T' can satisfy both 'T : _RefCountedObject' and 'T : _Trivial(32)'}}
174172
// expected-error@-2{{no type for 'T' can satisfy both 'T : _Trivial(64)' and 'T : _Trivial(32)'}}
175-
// expected-warning@-3{{redundant constraint 'T' : '_Trivial'}}
176-
// expected-error@-4 {{too few generic parameters are specified in '_specialize' attribute (got 0, but expected 1)}}
177-
// expected-note@-5 {{missing constraint for 'T' in '_specialize' attribute}}
173+
// expected-error@-3 {{too few generic parameters are specified in '_specialize' attribute (got 0, but expected 1)}}
174+
// expected-note@-4 {{missing constraint for 'T' in '_specialize' attribute}}
178175
@_specialize(where T: _Trivial, T: _Trivial(64))
179-
// expected-warning@-1{{redundant constraint 'T' : '_Trivial'}}
180176
@_specialize(where T: _RefCountedObject, T: _NativeRefCountedObject)
181-
// expected-warning@-1{{redundant constraint 'T' : '_RefCountedObject'}}
182177
@_specialize(where Array<T> == Int) // expected-error{{generic signature requires types 'Array<T>' and 'Int' to be the same}}
183178
// expected-error@-1 {{too few generic parameters are specified in '_specialize' attribute (got 0, but expected 1)}}
184179
// expected-note@-2 {{missing constraint for 'T' in '_specialize' attribute}}
@@ -191,9 +186,8 @@ public protocol Proto: class {
191186
}
192187

193188
@_specialize(where T: _RefCountedObject)
194-
// expected-warning@-1 {{redundant constraint 'T' : '_RefCountedObject'}}
195-
// expected-error@-2 {{too few generic parameters are specified in '_specialize' attribute (got 0, but expected 1)}}
196-
// expected-note@-3 {{missing constraint for 'T' in '_specialize' attribute}}
189+
// expected-error@-1 {{too few generic parameters are specified in '_specialize' attribute (got 0, but expected 1)}}
190+
// expected-note@-2 {{missing constraint for 'T' in '_specialize' attribute}}
197191
@_specialize(where T: _Trivial)
198192
// expected-error@-1{{no type for 'T' can satisfy both 'T : _NativeClass' and 'T : _Trivial'}}
199193
// expected-error@-2 {{too few generic parameters are specified in '_specialize' attribute (got 0, but expected 1)}}

0 commit comments

Comments
 (0)