File tree Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -192,7 +192,9 @@ class FindCapturedVars : public ASTWalker {
192
192
193
193
// If VD is a noescape decl, then the closure we're computing this for
194
194
// must also be noescape.
195
- if (VD->hasInterfaceType () &&
195
+ if (AFR.hasType () &&
196
+ !AFR.getType ()->hasError () &&
197
+ VD->hasInterfaceType () &&
196
198
VD->getInterfaceType ()->is <AnyFunctionType>() &&
197
199
VD->getInterfaceType ()->castTo <AnyFunctionType>()->isNoEscape () &&
198
200
!capture.isNoEscape () &&
Original file line number Diff line number Diff line change @@ -266,10 +266,8 @@ struct S<T> {
266
266
// Make sure we cannot infer an () argument from an empty parameter list.
267
267
func acceptNothingToInt ( _: ( ) -> Int ) { }
268
268
func testAcceptNothingToInt( ac1: @autoclosure ( ) -> Int ) {
269
- // expected-note@-1{{parameter 'ac1' is implicitly non-escaping because it was declared @autoclosure}}
270
269
acceptNothingToInt ( { ac1 ( $0) } )
271
270
// expected-error@-1{{contextual closure type '() -> Int' expects 0 arguments, but 1 was used in closure body}}
272
- // FIXME: expected-error@-2{{closure use of non-escaping parameter 'ac1' may allow it to escape}}
273
271
}
274
272
275
273
// <rdar://problem/23570873> QoI: Poor error calling map without being able to infer "U" (closure result inference)
Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-frontend -typecheck -verify %s
2
+
3
+ class C { }
4
+ class D { }
5
+
6
+ func f1( f : ( inout Int ) -> ( ) ) { }
7
+
8
+ func f2( f : ( inout Any ) -> ( ) ) {
9
+ // TODO: Error here is still pretty bad...
10
+ f1 { f ( & $0) } // expected-error{{conversion from 'Int' to 'Any'}}
11
+ }
You can’t perform that action at this time.
0 commit comments