Cleaned up CollidingNameException

entity_declaration_type_checking
Tristan B. V. Kildaire 2021-04-02 10:42:07 +02:00
parent 0e79bc77ed
commit ca7fa39f34
1 changed files with 2 additions and 2 deletions

View File

@ -42,8 +42,7 @@ public final class CollidingNameException : TypeCheckerException
this.attempted = attempted; this.attempted = attempted;
this.c = c; this.c = c;
/* TODO: Set `msg` */ /* If colliding with the container */
/* TODO: (Gogga it) Generate the error message */
if(isCollidingWithContainer()) if(isCollidingWithContainer())
{ {
string containerPath = typeChecker.getResolver().generateName(typeChecker.getModule(), defined); string containerPath = typeChecker.getResolver().generateName(typeChecker.getModule(), defined);
@ -56,6 +55,7 @@ public final class CollidingNameException : TypeCheckerException
string entityPath = typeChecker.getResolver().generateName(typeChecker.getModule(), attempted); string entityPath = typeChecker.getResolver().generateName(typeChecker.getModule(), attempted);
msg = "Cannot have entity \""~entityPath~"\" with same name as module \""~typeChecker.getModule().getName()~"\""; msg = "Cannot have entity \""~entityPath~"\" with same name as module \""~typeChecker.getModule().getName()~"\"";
} }
/* If colliding with a member within the container */
else else
{ {
string preExistingEntity = typeChecker.getResolver().generateName(typeChecker.getModule(), typeChecker.findPrecedence(c, attempted.getName())); string preExistingEntity = typeChecker.getResolver().generateName(typeChecker.getModule(), typeChecker.findPrecedence(c, attempted.getName()));