Swift 2b2: Compile error when protocol extension implements default static var
| Originator: | amber | ||
| Number: | rdar://21550415 | Date Originated: | 25-Jun-2015 02:59 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Swift 2, b2 |
| Classification: | Crash/Hang/Data Loss | Reproducible: | Always |
Summary:
When creating a protocol extension that implements a required static var, command failed due to signal: Illegal instruction: 4
Steps to Reproduce:
protocol MyProtocol {
static var name: String { get }
static func getName() -> String
}
extension MyProtocol {
static var name: String {
return "Jonny Crash"
}
static func getName() -> String {
return "Jonathan B. Good"
}
}
struct MyTestStruct: MyProtocol {
var age: Int {
return 21
}
}
// This is okay
print(MyTestStruct.getName())
// This fails
print(MyTestStruct.name)
Expected Results:
Expect to build, or give error stating this is not supported.
Actual Results:
TYPE MISMATCH IN ARGUMENT 0 OF APPLY AT expression at [/Users/Corey/Desktop/Test/Test/main.swift:15:7 - line:15:20] RangeText="MyTestStruct.n"
argument value: %14 = metatype $@thin MyTestStruct.Type
parameter type: @thick MyTestStruct.Type
Stack dump:
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!