[Issue 10785] Interface diamond covariance causes silent breakage
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Aug 11 22:22:24 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10785
Infiltrator <lt.infiltrator at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |lt.infiltrator at gmail.com
--- Comment #1 from Infiltrator <lt.infiltrator at gmail.com> 2013-08-11 22:22:22 PDT ---
This also affects non-diamond configurations:
http://dpaste.dzfl.pl/e9df03f9
----------------------
import std.stdio;
interface A1 { A1 foo(); }
interface A2 { A2 foo(); }
class C1 : A1, A2 {
override C1 foo() { return new C1; }
}
interface B1 { B1 foo(); }
interface B2 { B2 foo(); }
class C2 : B2, B1 {
override C2 foo() { return new C2; }
}
void main() {
A2 x = new C1;
A2 y = x.foo();
writefln("X: %s", x.classinfo);
writefln("Y: %s", y.classinfo);
B2 a = new C2;
B2 b = a.foo();
writefln("A: %s", a.classinfo);
writefln("B: %s", b.classinfo);
}
-----------------------
Application output:
X: f230.A2
Y: f230.A1
A: f230.B2
B: f230.B2
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list