following code compiles ok, but it shouldn't: interface doesn't match.
this bug doesn't work if there are no abstract member in class.
```D
import std.stdio;
interface ClassInterface
{
ClassInterface setValue(string val);
}
class ClassPrototype : ClassInterface
{
string value;
void setValue(string val)
{
value = val;
}
abstract void doSomething();
}
class Class : ClassPrototype
{
override void doSomething()
{
writeln("321");
}
}
void main()
{
auto inst = new Class();
inst.setValue("123");
}
```
Comment #1 by animuspexus — 2022-07-11T22:12:51Z
also, the following modification to the code compiles ok and resulting program segfaults on run
```
import std.stdio;
interface ClassInterface
{
ClassInterface setValue(string val);
}
class ClassPrototype : ClassInterface
{
string value;
void setValue(string val)
{
value = val;
}
abstract void doSomething();
}
class Class : ClassPrototype
{
override void doSomething()
{
writeln("321");
}
}
void main()
{
auto inst = new Class();
inst.setValue("123");
ClassInterface zzz = cast(ClassInterface) inst;
assert(zzz);
auto xxx = zzz.setValue("333");
}
```
Comment #2 by kinke — 2022-07-11T22:39:03Z
This is a regression. According to run.dlang.io:
2.060-2.063:
onlineapp.d(12): Error: function onlineapp.ClassPrototype.setValue of type void(string val) overrides but is not covariant with onlineapp.ClassInterface.setValue of type ClassInterface(string val)
2.064-2.092:
onlineapp.d(20): Error: class `onlineapp.Class` interface function `ClassInterface setValue(string val)` is not implemented
Wrongly compiles since v2.093.