Overriding generic method of non-generic superclass with generic subclass does not work.
| Originator: | Norio.Nomura | ||
| Number: | rdar://20647611 | Date Originated: | 22-Apr-2015 04:04 PM |
| Status: | Closed | Resolved: | YES |
| Product: | Developer Tools | Product Version: | Xcode 6.3.1 (6D1002) |
| Classification: | Reproducible: | Always |
Norio Nomura 24-Feb-2017 11:23 AM
I confirmed that this issue has been resolved on Xcode 8.3 beta 3.
This issue has been verified as resolved and can be closed.
Apple Developer Relations17-Feb-2017 07:42 AM
Please verify this issue with the Xcode 8.3 beta and update your bug report at https://bugreport.apple.com/ with your results.
Xcode 8.3 beta 2 (8W120l)
https://developer.apple.com/download/
Posted Date: Feb 6th, 2017
Norio Nomura 22-Apr-2015 04:04 PM
Summary:
Overriding generic method of non-generic superclass with generic subclass does not work.
https://devforums.apple.com/thread/268824
Steps to Reproduce:
1. Paste following code into Playground
class C {
func f<T>(v: T) -> String {
return "C(\(v))"
}
func callf() -> String{
return f("test")
}
}
class D<U>: C {
func f<T>(v: T) -> String {// swift compiler never warn missing 'override' keyword, and not allow placing 'override' keyword.
return "D(\(v))"
}
}
let d = D<String>()
d.callf() // "C(test)"
Expected Results:
- "D(test)" is printed to timeline of playground
- missing 'override' keyword warning message appears
Actual Results:
- "C(test)" was printed to timeline of playground
- missing 'override' keyword warning message did not appear
Version:
Xcode 6.3.1 (6D1002), Xcode 6.4 beta (6E7)
Notes:
Configuration:
Attachments:
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!