Xcode-beta (7A176x): NSDate.timeIntervalSinceDate returns function instead of NSTimeInterval in Swift
| Originator: | david.w.hart | ||
| Number: | rdar://22208236 | Date Originated: | 10-Aug-2015 09:11 AM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode-beta (7A176x) |
| Classification: | Serious Bug | Reproducible: | Always |
Summary:
Swift’s compiler thinks that NSDate’s timeIntervalSinceDate class function returns a closure of the type NSDate -> NSTimeInterval.
Steps to Reproduce:
Attempt the compile the following piece of code:
let date: NSDate = NSDate()
let interval: NSTimeInterval = NSDate.timeIntervalSinceDate(date)
Expected Results:
I expect it to compile.
Actual Results:
It fails with the following error:
error: '(NSDate) -> NSTimeInterval' is not convertible to 'NSTimeInterval'
let interval: NSTimeInterval = NSDate.timeIntervalSinceDate(startDate)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Regression:
The following piece of code DOES compile and produces the correct results (it should not):
let date: NSDate = NSDate()
let interval: NSTimeInterval = NSDate.timeIntervalSinceDate(date)(date)
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!