Bug 18915 – "Interface method not implemented" if interface reflects on implementing class

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-05-30T08:39:34Z
Last change time
2024-12-13T18:58:55Z
Assigned to
No Owner
Creator
Simen Kjaeraas
Moved to GitHub: dmd#17861 →

Comments

Comment #0 by simen.kjaras — 2018-05-30T08:39:34Z
interface A { import std.meta : AliasSeq; alias a = AliasSeq!(__traits(getMember, B, "foo")); void foo(); } class B : A { void foo() { } } Gives this error message: Error: class `B` interface function void foo() is not implemented
Comment #1 by b2.temp — 2018-05-30T12:27:24Z
Is this supposed to work or is this a wrong diagnostic (type B not yet finished when used in A)
Comment #2 by simen.kjaras — 2018-05-31T06:31:19Z
I'd prefer it to work. This is essentially the use case: interface A { import std.traits; static foreach (e; __traits(derivedMembers, B)) { static foreach (fn; MemberFunctionsTuple!(B, e)) { mixin("@(__traits(getAttributes, fn)) ReturnType!fn "~e~"(Parameters!fn);"); } } } class B : A { void foo() { } } That is, we generate an interface based on a type, and derive that type from said interface. Since derivedMembers doesn't look at base classes and interfaces, this could possibly be made to work. Related forum discussion: https://forum.dlang.org/post/[email protected]
Comment #3 by robert.schadek — 2024-12-13T18:58:55Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17861 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB