Thread overview | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
December 13, 2008 [Issue 2511] New: dmd finds a proper overload as a non-covariant | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2511 Summary: dmd finds a proper overload as a non-covariant Product: D Version: 2.021 Platform: PC OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: 2korden@gmail.com Here is a sample code that triggers an error: // File I.d module I; import Base; interface I { } interface SubI : I { } // File Base.d module Base; import I; class Base { I create() { return null; } } class Derived : Base { SubI create() { return null; } } Compilation options: "dmd I.d" Note that "dmd Base.d" compiles okay. -- |
December 13, 2008 [Issue 2511] dmd finds a proper overload as a non-covariant | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2511 ------- Comment #1 from 2korden@gmail.com 2008-12-13 10:22 ------- And here is an error message: Base.d(15): function Base.Derived.create of type SubI() overrides but is not covariant with Base.Base.create of type I() -- |
December 13, 2008 [Issue 2511] dmd finds a proper overload as a non-covariant | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2511 2korden@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |blocker ------- Comment #2 from 2korden@gmail.com 2008-12-13 10:32 ------- The error can fixed by removing "import Base;" from the I.d, but unfortunately I can't do this in my application because interfaces have methods that accept and return references to Base and Derived: interface I { void doStuff(Base b); } interface SubI : I { void doStuff(Derived b); } A possible solution is to merge them into a single file (which is not acceptable). You should also have a proper file order to compile them at once: dmd Base I // okay dmd I Base // fails to compile Rising its severity until I find a workaround. -- |
April 13, 2009 [Issue 2511] Covariant return type doesn't work with circular import | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2511 smjg@iname.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smjg@iname.com Summary|dmd finds a proper overload |Covariant return type |as a non-covariant |doesn't work with circular | |import Version|2.021 |1.043 ------- Comment #3 from smjg@iname.com 2009-04-13 16:40 ------- This sounds related to old bug 125. And it occurs in the D1 line too. Also rewriting the summary line as the one that was there was confusing. -- |
September 18, 2009 [Issue 2511] Covariant return type doesn't work with circular import | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2511 --- Comment #4 from Rainer Schuetze <r.sagitario@gmx.de> 2009-09-18 01:07:31 PDT --- Created an attachment (id=456) better detection if a base class is forward referenced The current implementation (as of DMD 2.032) defers covariance analysis only if the base class is not yet semantically analysed and it is not an interface. The patch refines this condition by testing whether the class has any forward referenced base classes or interfaces. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 28, 2010 [Issue 2511] Covariant return type doesn't work with circular import | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2511 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@digitalmars.com --- Comment #5 from Walter Bright <bugzilla@digitalmars.com> 2010-08-27 22:33:25 PDT --- The patch breaks this code: class UA { A29 f() { return null; } } class UB : UA { B29 f() { return null; } } class A29 { } class B29 : A29 { } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 28, 2010 [Issue 2511] Covariant return type doesn't work with circular import | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2511 --- Comment #6 from Walter Bright <bugzilla@digitalmars.com> 2010-08-27 22:49:56 PDT --- Partial apply of patch: http://www.dsource.org/projects/dmd/changeset/638 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 28, 2010 [Issue 2511] Covariant return type doesn't work with circular import | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2511 --- Comment #7 from Rainer Schuetze <r.sagitario@gmx.de> 2010-08-28 00:23:08 PDT --- Oh, it's only been tested on interfaces. ClassDeclaration::isBaseInfoComplete() is broken, class Object doesn't need a base class: int ClassDeclaration::isBaseInfoComplete() { if (!baseClass) return ident == Id::Object; ... -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 29, 2010 [Issue 2511] Covariant return type doesn't work with circular import | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2511 --- Comment #8 from Walter Bright <bugzilla@digitalmars.com> 2010-08-29 12:55:08 PDT --- This now fails: class UA { A29 f() { return null; } } class UB : UA { B29 f() { return null; } } class A29 { } class B29 : A29 { } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 29, 2010 [Issue 2511] Covariant return type doesn't work with circular import | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2511 Brad Roberts <braddr@puremagic.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |braddr@puremagic.com --- Comment #9 from Brad Roberts <braddr@puremagic.com> 2010-08-29 13:08:40 PDT --- NOTE: these tests are part of the dmd svn depot these days.. so if you check it out from dsource you can run them yourself cd $(dir}/dmd/src make cd ../test make It's only known to work on linux, though ought to work on any posix system and will need work to work on windows. Any fixes that are required I'd be happy to fold in. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation