mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
__attribute__((noescape)) isn't getting imported properly for methods.
Fixes rdar://problem/19818617. Swift SVN r25256
This commit is contained in:
@@ -15,7 +15,13 @@ someNSString.enumerateLinesUsingBlock({ useString($0) })
|
||||
|
||||
dispatch_async(dispatch_get_current_queue(), /*not a block=*/()) // expected-error{{cannot invoke 'dispatch_async' with an argument list of type '(dispatch_queue_t, ())'}} expected-note {{expected an argument list of type '(dispatch_queue_t, dispatch_block_t!)'}}
|
||||
|
||||
func testNoEscape(@noescape f: @objc_block () -> Void ) {
|
||||
func testNoEscape(@noescape f: @objc_block () -> Void, nsStr: NSString,
|
||||
@noescape fStr: (String!) -> Void) {
|
||||
dispatch_async(dispatch_get_current_queue(), f) // expected-error{{invalid use of non-escaping function in escaping context '@objc_block () -> Void'}}
|
||||
dispatch_sync(dispatch_get_current_queue(), f) // okay: dispatch_sync is noescape
|
||||
|
||||
// rdar://problem/19818617
|
||||
nsStr.enumerateLinesUsingBlock(fStr) // okay due to @noescape
|
||||
|
||||
var x: Int = nsStr.enumerateLinesUsingBlock // expected-error{{'(@noescape (String!) -> Void) -> Void' is not convertible}}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user