[SR-6681] A subclass of a base class which conforms to a protocol with a requirement fulfilled by a default implementation cannot override the base class' method #49230
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Additional Detail from JIRA
md5: 5dc9fbcf9063633b4a5652697967d80e
duplicates:
Issue Description:
The following code compiles:
Note in particular that
foo()
isn't decorated withoverride
, but appears to be overriding the function. (Aside: in fact D'sfoo()
is not an override of B'sfoo()
which can be observed by casting D to be and callingfoo()
:(D() as B).foo()
printsP.foo()
.)Ideally, the behavior of
and
would behave "the same" in the context of subclassing: In either case, the first code snippet would not compile (since the override keyword is missing), and instead the following would (which currently does not):
and writing
(D() as P).foo()
would printThe text was updated successfully, but these errors were encountered: