From 5156ac3ea23e44186a023f3cd476ee18456a55d6 Mon Sep 17 00:00:00 2001 From: k-hara Date: Tue, 3 Nov 2015 14:44:10 +0900 Subject: [PATCH] Refactor: remove unnecessary check code in AliasThis.semantic 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; } ``` --- src/aliasthis.d | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/aliasthis.d b/src/aliasthis.d index 9c2da8203f2a..4d690f3eebf6 100644 --- a/src/aliasthis.d +++ b/src/aliasthis.d @@ -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. */