diff --git a/source/tlang/compiler/typecheck/core.d b/source/tlang/compiler/typecheck/core.d index 23081c9..f79b28a 100644 --- a/source/tlang/compiler/typecheck/core.d +++ b/source/tlang/compiler/typecheck/core.d @@ -23,6 +23,11 @@ public final class TypeChecker /* The name resolver */ private Resolver resolver; + public Module getModule() + { + return modulle; + } + this(Module modulle) { this.modulle = modulle; diff --git a/source/tlang/compiler/typecheck/resolution.d b/source/tlang/compiler/typecheck/resolution.d index afe3b74..afa1983 100644 --- a/source/tlang/compiler/typecheck/resolution.d +++ b/source/tlang/compiler/typecheck/resolution.d @@ -93,6 +93,8 @@ public final class Resolver * If no dot * * Try and find `name` within c + * + * TODO: WOn't resolve a module */ if(path.length == 1) { @@ -154,6 +156,19 @@ public final class Resolver else { /* TODO: Bug is we will never find top container */ + /* Check if the name of root is that of Module */ + if(cmp(typeChecker.getModule().getName(), path[0]) == 0) + { + /* Root ourselves relative to the Module */ + /* TODO: Don't serch for myModule class and ooga within */ + /** + * TODO: Although the above should be impossible when we set usable names + * and make sure module name cannot be sed anywhere + */ + /* TODO: Even if it could be because of this check it would be ignored */ + /* TODO: This is what we want, but to avoid confusion we shouldn't allow the use of that name */ + return resolveBest(typeChecker.getModule(), name); + } Entity entityFound = resolveUp(c, path[0]); diff --git a/source/tlang/testing/basic1.t b/source/tlang/testing/basic1.t index addef16..723d482 100644 --- a/source/tlang/testing/basic1.t +++ b/source/tlang/testing/basic1.t @@ -39,13 +39,7 @@ class X : myModule.ooga } - class myModule - { - class ooga - { - - } - } + class K : myModule.ooga { @@ -54,7 +48,10 @@ class X : myModule.ooga class D : X.Y { - + class Fok : myModule.ooga + { + + } } class F : Shekshi.G.F {} @@ -148,6 +145,16 @@ class Them } + class naai : testClass.test3.llllll.fokfok + { + + } + + class baai : myModule.testClass.test3.llllll.fokfok + { + + } + } }