[Issue 16306] New: Interface extending another interface with same method
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Jul 21 05:24:59 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=16306
Issue ID: 16306
Summary: Interface extending another interface with same method
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: lodovico at giaretart.net
interface A
{
void foo();
}
interface B: A
{
void bar();
final void foo()
{
bar();
}
}
class C: B
{
void bar() {}
} // error: C does not implement A.foo
class D: B
{
void foo() {}
void bar() {}
} // error: cannot override final B.foo
So A.foo is still looked up to guarantee create the vtable, but there's no way
to provide it because B.foo is final. B.foo "hides" A.foo, without overriding
it. Why doesn't B.foo override A.foo?
This should either work as expected (B.foo overrides A.foo) or an error shall
be emitted at the definition of B.foo, because it "hides" A.foo.
See also: http://forum.dlang.org/thread/ajctidcvpndrbsotorvt@forum.dlang.org
--
More information about the Digitalmars-d-bugs
mailing list