Swift: Default value in protocol init() crashes the compiler
| Originator: | rix.rob | ||
| Number: | rdar://18637242 | Date Originated: | 13-Oct-2014 03:29 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode-6.1 (6A1046a) |
| Classification: | Serious Bug | Reproducible: | Always |
Summary:
Default values are forbidden in protocol function requirements. In init requirements, they crash the compiler instead.
Steps to Reproduce:
1. Compile this:
protocol P {
init(x: Int? = nil)
}
Expected Results:
I expected it to work, and then when I learned that functions in protocols are disallowed from having default values, I expected it to fail with a clear error message.
Actual Results:
Instead of either of those it crashed.
Regression:
N/A
Notes:
N/A
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!