Skip to content

Commit

Permalink
Fix issue 17686: [REG2.075.0] Covariant return types doesn't work wit…
Browse files Browse the repository at this point in the history
…h override in some cases
  • Loading branch information
Kozzi11 committed Jul 26, 2017
1 parent b55864b commit 1fb7bd7
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ddmd/mtype.d
Expand Up @@ -775,7 +775,7 @@ extern (C++) abstract class Type : RootObject

// If t1n is forward referenced:
ClassDeclaration cd = (cast(TypeClass)t1n).sym;
if (cd.semanticRun < PASSsemanticdone)
if (cd.semanticRun < PASSsemanticdone && cd.baseok < BASEOKdone)
cd.semantic(null);
if (!cd.isBaseInfoComplete())
{
Expand Down
45 changes: 45 additions & 0 deletions test/compilable/fix17686.d
@@ -0,0 +1,45 @@
/* REQUIRED_ARGS:
* PERMUTE_ARGS:
*/

// https://issues.dlang.org/show_bug.cgi?id=17686

interface INode
{
@property INode parentNode();
@property IDocument ownerDocument();
}
interface IDocument: INode {}
interface IEntityReference: INode {}

class DOMImplementation(T)
{
abstract class Node: INode
{
override
{
@property Node parentNode() { return null; }
@property Document ownerDocument() { return null; }
}

@property bool readonly() { return true; }
}
abstract class NodeWithChildren: Node {}

class Document: NodeWithChildren, IDocument {}

class EntityReference: NodeWithChildren, IEntityReference
{
override
{
@property bool readonly() { return true; }
}
}

}

void main()
{
alias aaa = DOMImplementation!string;
}

0 comments on commit 1fb7bd7

Please sign in to comment.