diff options
-rw-r--r-- | compiler/importer.nim | 5 | ||||
-rw-r--r-- | tests/import_in_config/nim.cfg | 2 | ||||
-rw-r--r-- | tests/import_in_config/other.nim | 0 | ||||
-rw-r--r-- | tests/import_in_config/tmain.nim | 0 |
4 files changed, 6 insertions, 1 deletions
diff --git a/compiler/importer.nim b/compiler/importer.nim index 7e7130b85..87415733b 100644 --- a/compiler/importer.nim +++ b/compiler/importer.nim @@ -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) diff --git a/tests/import_in_config/nim.cfg b/tests/import_in_config/nim.cfg new file mode 100644 index 000000000..af112d112 --- /dev/null +++ b/tests/import_in_config/nim.cfg @@ -0,0 +1,2 @@ +import = "other" +path = "$projectDir" diff --git a/tests/import_in_config/other.nim b/tests/import_in_config/other.nim new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/import_in_config/other.nim diff --git a/tests/import_in_config/tmain.nim b/tests/import_in_config/tmain.nim new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/import_in_config/tmain.nim |