You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some diagnostics got worse, but I think the reduction in compiler complexity
is worth it, and copy-and-pasting Swift 2 code is not likely to produce great
results anyway.
Also, this corrects an oversight where we did not reject @pseudogeneric on
function types in AST parsing.
// expected-error@-1{{@autoclosure(escaping) has been removed; use @autoclosure @escaping instead}} {{37-47= @escaping }}
89
-
overridefunc f2(_ x:@autoclosure()->()){} // expected-error{{does not override any method}} // expected-note{{type does not match superclass instance method with type '(@autoclosure @escaping () -> ()) -> ()'}}
90
-
overridefunc f3(_ x:@autoclosure(escaping)()->()){} // expected-error{{does not override any method}}
91
-
// expected-error@-1{{@autoclosure(escaping) has been removed; use @autoclosure @escaping instead}} {{37-47= @escaping}}
92
-
}
75
+
funcfunc11(_: @autoclosure(escaping) @noescape()->()){} // expected-error{{use of undeclared type 'escaping'}}
76
+
// expected-error @-1 {{attribute can only be applied to types, not declarations}}
77
+
// expected-error @-2 {{expected ',' separator}}
78
+
// expected-error @-3 {{expected parameter name followed by ':'}}
93
79
94
80
func func12_sink(_ x:@escaping()->Int){}
95
81
96
82
func func12a(_ x:@autoclosure()->Int){
97
-
// expected-note@-1{{parameter 'x' is implicitly non-escaping}}
83
+
// expected-note@-1{{parameter 'x' is implicitly non-escaping}}
98
84
99
85
func12_sink(x) // expected-error {{passing non-escaping parameter 'x' to function expecting an @escaping closure}}
100
86
}
101
-
func func12b(_ x:@autoclosure(escaping)()->Int){
102
-
// expected-error@-1{{@autoclosure(escaping) has been removed; use @autoclosure @escaping instead}} {{31-41= @escaping}}
103
-
func12_sink(x) // ok
104
-
}
105
87
func func12c(_ x:@autoclosure@escaping()->Int){
106
88
func12_sink(x) // ok
107
89
}
@@ -116,7 +98,7 @@ class TestFunc12 {
116
98
117
99
func test(){
118
100
func12a(x + foo()) // okay
119
-
func12b(x + foo())
101
+
func12c(x + foo())
120
102
// expected-error@-1{{reference to property 'x' in closure requires explicit 'self.' to make capture semantics explicit}} {{13-13=self.}}
121
103
// expected-error@-2{{call to method 'foo' in closure requires explicit 'self.' to make capture semantics explicit}} {{17-17=self.}}
0 commit comments