Hi there,
I came across an issue I've never had before, and am curious if there's a workaround, or this is an expected behavior / a known limitation of current version's.
class Foo {
func a<T>(_ val: T) -> String { return "not equatable" }
func a<T: Equatable>(_ val: T) -> String { return "equatable" }
}
class Bar: Foo {
// these work like a charm
func b<T>(_ val: T) -> String { return super.a(val) }
func b<T: Equatable>(_ val: T) -> String { return super.a(val) }
// "declaration 'a' cannot override more than one superclass declaration"
override func a<T>(_ val: T) -> String { return super.a(val) }
override func a<T: Equatable>(_ val: T) -> String { return super.a(val) }
}
let bar = Bar()
bar.b(1) // "equatable"
bar.b(Int.self) // "not equatable"
While I can call two superclass methods individually, why can't I override them separately?