fixes a regression that caused --import in a config file to break things

This commit is contained in:
Andreas Rumpf
2016-08-29 11:33:41 +02:00
parent 7e3ebc1bcc
commit 154db46db8
4 changed files with 6 additions and 1 deletions

View File

@@ -163,7 +163,10 @@ proc myImportModule(c: PContext, n: PNode): PSym =
var f = checkModuleName(n)
if f != InvalidFileIDX:
result = importModuleAs(n, gImportModule(c.module, f))
if result.info.fileIndex == c.module.info.fileIndex:
# we cannot perform this check reliably because of
# test: modules/import_in_config)
if result.info.fileIndex == c.module.info.fileIndex and
result.info.fileIndex == n.info.fileIndex:
localError(n.info, errGenerated, "A module cannot import itself")
if sfDeprecated in result.flags:
message(n.info, warnDeprecated, result.name.s)

View File

@@ -0,0 +1,2 @@
import = "other"
path = "$projectDir"

View File

View File