From fa775473106c393d84f172888da9c23207c89624 Mon Sep 17 00:00:00 2001 From: Araq Date: Wed, 22 Oct 2014 01:54:27 +0200 Subject: [PATCH] fixes 'import x as y' regression --- compiler/importer.nim | 2 +- tests/modules/tselfimport.nim | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/importer.nim b/compiler/importer.nim index 9e327c8f7..58b5ef8d4 100644 --- a/compiler/importer.nim +++ b/compiler/importer.nim @@ -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) diff --git a/tests/modules/tselfimport.nim b/tests/modules/tselfimport.nim index f20a40407..ddb3a5b09 100644 --- a/tests/modules/tselfimport.nim +++ b/tests/modules/tselfimport.nim @@ -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")