Swift 3: NSArray indexOfObject(passingTest:) is ambigious
| Originator: | acapulco1988 | ||
| Number: | rdar://28420477 | Date Originated: | 9/21/16 |
| Status: | Duplicate of 25607552 | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode 8.0 (8A218a) |
| Classification: | Reproducible: | Always |
Summary:
calling indexOfObject(passingTest:) on an NSArray results in a compilation error
Steps to Reproduce:
Put the following code into a playground:
import Cocoa
let objects = NSArray()
let index = objects.indexOfObject { (object, index, stop) -> Bool in
return false
}
Expected Results:
Code compiles.
Actual Results:
Playground execution failed: error: IndexOfObject.playground:3:13: error: ambiguous use of 'indexOfObject(passingTest:)'
let index = objects.indexOfObject { (object, index, stop) -> Bool in
^
Foundation.NSArray:46:15: note: found this candidate
open func indexOfObject(passingTest predicate: (Any, Int, UnsafeMutablePointer<ObjCBool>) -> Bool) -> Int
^
Foundation.NSArray:48:15: note: found this candidate
open func indexOfObject(options opts: NSEnumerationOptions = [], passingTest predicate: (Any, Int, UnsafeMutablePointer<ObjCBool>) -> Bool) -> Int
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!