Skip to content

Commit

Permalink
Refactor: remove unnecessary check code in AliasThis.semantic
Browse files Browse the repository at this point in the history
It was a workaround code for the AST internal inconsistency which has caused by template instantiations.

Now, it's not necessary anymore, because the problem is properly handled at the top of StructDeclaration.semantic.

    ```d
    if (type.ty == Tstruct && (cast(TypeStruct)type).sym != this)
    {
        TemplateInstance ti = (cast(TypeStruct)type).sym.isInstantiated();
        if (ti && isError(ti))
            (cast(TypeStruct)type).sym = this;
    }
    ```
  • Loading branch information
9rnsr committed Nov 16, 2015
1 parent 76ae623 commit 5156ac3
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/aliasthis.d
Expand Up @@ -70,20 +70,12 @@ public:
.error(loc, "undefined identifier %s", ident.toChars());
return;
}
else if (ad.aliasthis && s != ad.aliasthis)
if (ad.aliasthis && s != ad.aliasthis)
{
.error(loc, "there can be only one alias this");
return;
}

if (ad.type.ty == Tstruct && (cast(TypeStruct)ad.type).sym != ad)
{
AggregateDeclaration ad2 = (cast(TypeStruct)ad.type).sym;
assert(ad2.type == Type.terror);
ad.aliasthis = ad2.aliasthis;
return;
}

/* disable the alias this conversion so the implicit conversion check
* doesn't use it.
*/
Expand Down

0 comments on commit 5156ac3

Please sign in to comment.