fixes 'import x as y' regression

This commit is contained in:
Araq 2014-10-22 01:54:27 +02:00
commit fa77547310
2 changed files with 3 additions and 2 deletions

View file

@ -153,7 +153,7 @@ proc importModuleAs(n: PNode, realModule: PSym): PSym =
localError(n.info, errGenerated, "module alias must be an identifier")
elif n.sons[1].ident.id != realModule.name.id:
# some misguided guy will write 'import abc.foo as foo' ...
result = createModuleAlias(realModule, n.sons[1].ident, n.sons[1].info)
result = createModuleAlias(realModule, n.sons[1].ident, realModule.info)
proc myImportModule(c: PContext, n: PNode): PSym =
var f = checkModuleName(n)

View file

@ -1,8 +1,9 @@
discard """
file: "tselfimport.nim"
line: 6
line: 7
errormsg: "A module cannot import itself"
"""
import strutils as su # guard against regression
import tselfimport #ERROR
echo("Hello World")