Hm, I guess it's much simpler than that. I must not be
understanding something about covariance. The following code
produces the same error message (it has nothing to do with
nestedness or shared classes):
interface Interface
{
Interface getNext();
const(Interface) getNext() const;
}
class Implementation : Interface
{
Implementation getNext()
{
return null;
}
const(Implementation) getNext() const
{
return null;
}
}
On Sunday, 1 April 2012 at 16:40:55 UTC, Read Bixby wrote:
I was working on a small personal project, and ran across
something I think might (or might not) be a bug. I'm posting
in this particular group just in case it's a restriction
somewhere that I just don't know about, or maybe just the way
that covariance gets resolved. The obvious workaround is to
return NestedInterface from the two methods of the derived
class rather than NestedImplementation, but I was kind of
surprised it didn't compile (in the actual code, both the
nested interface and the nested implementation were called
"Node" which was stupid on my part). I got the error message:
"Error: class Implementation.NestedImplementation ambiguous
virtual function getNext"
Is this something anyone is likely to care about?
shared interface Interface
{
public static shared interface NestedInterface
{
public shared(NestedInterface) getNext();
public shared(const(NestedInterface)) getNext() const;
}
}
shared class Implementation : Interface
{
public static shared class NestedImplementation :
Interface.NestedInterface
{
public override shared(NestedImplementation) getNext()
{
return null;
}
public override shared(const(NestedImplementation)) getNext()
const
{
return null;
}
}
}