Generic function signatures are not differentiated on their ability to throw
Originator: | keithbsmiley | ||
Number: | rdar://23147654 | Date Originated: | 16-Oct-2015 11:52 AM |
Status: | Open | Resolved: | |
Product: | Developer Tools | Product Version: | Swift 2.0 |
Classification: | UI/Usability | Reproducible: | Always |
Summary: Generic functions that return type `T` or `T?` are not differentiated by the compiler based on their ability to `throws`. Meaning that if you have a function that does not throw and returns `T?`, and a function with the same signature that throws and returns type `T`, you get a ambiguous function error. Steps to reproduce: 1. Create a function that returns `T` and throws 2. Create a function that returns `T?` and doesn't throw 3. Attempt to call the function that returns `T?` and assign it to an optional `T` OR 1. See the attached playground Expected results: The ability to throw should be take into account to choose which function to call. Actual results: The compiler produces an "Ambiguous use of X()" error.
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/AmbiguousFunctionThrows