Swift: a base class of a generic class is required to be generic
| Originator: | thephatmann | ||
| Number: | rdar://19003910 | Date Originated: | 2014-11-17 |
| Status: | Duplicate of 15520519 | Resolved: | 2014-12-09 |
| Product: | Developer Tools | Product Version: | Xcode 6.1.1 |
| Classification: | Reproducible: |
class A<T> {
func doSomething(param: T) {}
}
class B : A<Int> {
override func doSomething(param: Int) {
}
}
This is a standard and useful way to use generics, yet this is illegal in Swift. For some reason the compiler is requiring that class B also be generic, which makes no sense.
Expected Results:
Code should compile.
Actual Results:
Compiler complains that class B must be generic.
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!