Erroneous "cannot override more than one superclass declaration" in Swift
| Originator: | stemail23 | ||
| Number: | rdar://17174535 | Date Originated: | 5 Jun 2014 |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | 6.0 (6A215l) |
| Classification: | Reproducible: | Always |
Summary:
Cannot override properties of a Swift class in the second child class of an inheritance chain when class declarations are split across multiple files.
Steps to Reproduce:
1. Create a new Swift project in XCode 6.0 Beta (I used iOS iPhone Single View app).
2. Create a new Swift file in the project (with any name)
3. Paste the following code into the file:
class Foo1 {
var foo: String {
return "bar1"
}
}
class Foo2: Foo1 {
override var foo: String {
return "bar2"
}
}
class Foo3: Foo2 {
override var foo: String {
return "bar3"
}
}
4. Observe that the resulting code successfully builds
5. Create another new Swift file in the project (with any different name)
6. Cut the Foo2 class declaration from the first Swift file and paste it into the second.
7. Observer that the code no longer compiles (with error: "cannot override more than one superclass declaration" on the override var foo: line for class Foo3.
Expected Results:
I expected it to compile!
Actual Results:
It fails to compile with error "cannot override more than one superclass declaration"
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!