digitalmars.D.bugs - [Issue 12283] New: Array literals of interface implementations do not resolve to interface
- d-bugmail puremagic.com (35/35) Mar 01 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12283
- d-bugmail puremagic.com (10/10) Mar 02 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12283
- d-bugmail puremagic.com (11/11) Mar 04 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12283
https://d.puremagic.com/issues/show_bug.cgi?id=12283 Summary: Array literals of interface implementations do not resolve to interface Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: mkline.on.d gmail.com --- One would assume that, given an array literal of various implementations of an interface, the compiler would reduce the literal to an array of that interface. However, the following fails: interface Inter { } class FooImpl : Inter { } class BarImpl : Inter { } void main() { Inter[] test = [new FooImpl(), new BarImpl()]; } with poly.d(12): Error: cannot implicitly convert expression (new FooImpl) of type object.Object to poly.BarImpl poly.d(12): Error: cannot implicitly convert expression ([(__error), new BarImpl]) of type BarImpl[] to Inter[] -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 01 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12283 yebblies <yebblies gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |yebblies gmail.com This has the same cause (and fix) as issue 5498. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 02 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12283 Matt Kline <mkline.on.d gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE --- *** This issue has been marked as a duplicate of issue 5498 *** -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 04 2014