Swift similar generic functions runtime crash
| Originator: | keithbsmiley | ||
| Number: | rdar://23718676 | Date Originated: | 01-Dec-2015 09:02 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Swift 2.1 |
| Classification: | Other Bug | Reproducible: | Always |
Summary: When you have multiple swift functions with very similar generic signatures, the compiler crashes, especially when using the nil coalescing operator. Steps to reproduce: 1. Attempt to run the attached script with `swift GenericFunctionCrash.swift` Expected results: Everything runs correctly. Actual results: It crashes at runtime with this error: ``` Could not cast value of type 'Swift.String' to 'Swift.Optional<Swift.String>' ``` Notes: - Doing `"foo" as! String?` should work fine (as seen in the repl) - If you comment out the fallback using the `??` operator, it runs fine - If you comment out the similar generic function, it runs fine
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!
https://github.com/keith/radars/tree/master/GenericFunctionCrash