diff --git a/source/tlang/compiler/typecheck/core.d b/source/tlang/compiler/typecheck/core.d index f37acb8..ef08b9b 100644 --- a/source/tlang/compiler/typecheck/core.d +++ b/source/tlang/compiler/typecheck/core.d @@ -495,9 +495,9 @@ unittest Entity container = typeChecker.getResolver().resolveBest(typeChecker.getModule, "y"); gprintln(container); /* TODO: fix this, resolve container at top */ - Entity colliderMember = typeChecker.getResolver().resolveBest(typeChecker.getModule, "y.p"); + Entity colliderMember = typeChecker.getResolver().resolveBest(typeChecker.getModule, "y.y"); gprintln(colliderMember); /* TODO: fix this, resolve container at top */ - parser.expect("d"); + try { @@ -506,6 +506,8 @@ unittest } catch(CollidingNameException e) { + /* Make sure the member y.y collided with root container (module) y */ + assert(e.defined == container); /* TODO: Check */ assert(true); //gprintln("Stack trace:\n"~to!(string)(e.info)); diff --git a/source/tlang/compiler/typecheck/exceptions.d b/source/tlang/compiler/typecheck/exceptions.d index 2ead7b9..4de590e 100644 --- a/source/tlang/compiler/typecheck/exceptions.d +++ b/source/tlang/compiler/typecheck/exceptions.d @@ -21,7 +21,7 @@ public final class CollidingNameException : TypeCheckerException /** * The previously declared Entity */ - private Entity defined; + public Entity defined; /** * The colliding Entity diff --git a/source/tlang/testing/collide_container.t b/source/tlang/testing/collide_container.t index b75d7f0..081de0e 100644 --- a/source/tlang/testing/collide_container.t +++ b/source/tlang/testing/collide_container.t @@ -1,3 +1,3 @@ module y; -int p; \ No newline at end of file +int y; \ No newline at end of file