You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SR-4206 Override checking does not properly enforce requirements
relates to:
SR-10231 Overloading Overriden Method By Inout-ness Causes Compile Error
Issue Description:
It seems that subclass cannot override a superclass's method in the situation like below although there's an exact match and thus shouldn't be a problem.
classFoo{func a<T>(_ val:T)->String{return"not equatable"}func a<T:Equatable>(_ val:T)->String{return"equatable"}}classBar:Foo{// these work like a charmfunc 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"overridefunc a<T>(_ val:T)->String{return super.a(val)}overridefunc a<T:Equatable>(_ val:T)->String{return super.a(val)}}letbar=Bar()
bar.b(1)// "equatable"
bar.b(Int.self)// "not equatable"
The text was updated successfully, but these errors were encountered:
This is the same problem as SR-4206. We completely ignore the generic signature requirements when checking overrides. In SR-4206, we inappropriately make one method an override of another even though the base class method has fewer requirements; in this bug, we flag the method as overriding two methods when it really only overrides one, for the same reason.
Additional Detail from JIRA
md5: b648d70ee267e118a99dbd1f3d5ba85b
duplicates:
relates to:
Issue Description:
It seems that subclass cannot override a superclass's method in the situation like below although there's an exact match and thus shouldn't be a problem.
The text was updated successfully, but these errors were encountered: