Skip to content

Commit f8a523b

Browse files
committed
[Test] Confirm warnings are still warnings in Swift 3.2, errors are errors in Swift 4.0.
Fixes rdar://problem/28961650 .
1 parent 55e1aa2 commit f8a523b

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// RUN: %target-swift-frontend -typecheck -verify -swift-version 3 %s
2+
3+
protocol Operator {
4+
func +(lhs: Self, rhs: Self) -> Self // expected-warning {{operator '+' declared in protocol must be 'static'}}
5+
}
6+
7+
func foo(x: Int..., _: String) {} // expected-warning {{a parameter following a variadic parameter requires a label}}
8+
9+
protocol P1 {}
10+
protocol P2 {}
11+
12+
let x: protocol<> // expected-warning {{'protocol<>' syntax is deprecated; use 'Any' instead}}
13+
let y: protocol<P1> // expected-warning {{'protocol<...>' composition syntax is deprecated and not needed here}}}
14+
let z: protocol<P1, P2> // expected-warning {{'protocol<...>' composition syntax is deprecated; join the protocols using '&'}}
15+
16+
func bar(f: @noescape () -> ()) {} // expected-warning {{@noescape is the default and is deprecated}}
17+
18+
func baz(f: @autoclosure(escaping) () -> ()) {} // expected-warning {{@autoclosure(escaping) is deprecated; use @autoclosure @escaping instead}}
19+
20+
prefix operator +++ {} // expected-warning {{operator should no longer be declared with body}}
21+
postfix operator +++ {} // expected-warning {{operator should no longer be declared with body}}
22+
infix operator +++ {} // expected-warning {{operator should no longer be declared with body}}
23+
infix operator +++* { // expected-warning {{operator should no longer be declared with body; use a precedence group instead}}
24+
associativity right
25+
}
26+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// RUN: %target-swift-frontend -typecheck -verify -swift-version 4 %s
2+
3+
protocol Operator {
4+
func +(lhs: Self, rhs: Self) -> Self // expected-error {{operator '+' declared in protocol must be 'static'}}
5+
}
6+
7+
func foo(x: Int..., _: String) {} // expected-error {{a parameter following a variadic parameter requires a label}}
8+
9+
protocol P1 {}
10+
protocol P2 {}
11+
12+
let x: protocol<> // expected-error {{'protocol<>' syntax has been removed; use 'Any' instead}}
13+
let y: protocol<P1> // expected-error {{'protocol<...>' composition syntax has been removed and is not needed here}}}
14+
let z: protocol<P1, P2> // expected-error {{'protocol<...>' composition syntax has been removed; join the protocols using '&'}}
15+
16+
func bar(f: @noescape () -> ()) {} // expected-error {{@noescape is the default and has been removed}}
17+
18+
func baz(f: @autoclosure(escaping) () -> ()) {} // expected-error {{@autoclosure(escaping) has been removed; use @autoclosure @escaping instead}}
19+
20+
prefix operator +++ {} // expected-error {{operator should no longer be declared with body}}
21+
postfix operator +++ {} // expected-error {{operator should no longer be declared with body}}
22+
infix operator +++ {} // expected-error {{operator should no longer be declared with body}}
23+
infix operator +++* { // expected-error {{operator should no longer be declared with body; use a precedence group instead}}
24+
associativity right
25+
}

0 commit comments

Comments
 (0)