summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-10-18 22:13:24 +0200
committerGitHub <noreply@github.com>2019-10-18 22:13:24 +0200
commit832b0a0232e610c1935aaf6ce0b45f69199f8a19 (patch)
tree93d19bacdd9ee1f407d7589858caaf0721603548
parent6b157e5f73ad7df0e397f7890df5c263cf518dba (diff)
downloadNim-832b0a0232e610c1935aaf6ce0b45f69199f8a19.tar.gz
fixes #12420 [backport] (#12456)
-rw-r--r--compiler/packagehandling.nim13
-rw-r--r--tests/modules/a/utils.nim2
-rw-r--r--tests/modules/b/utils.nim2
-rw-r--r--tests/modules/tutils_ab.nim5
4 files changed, 14 insertions, 8 deletions
diff --git a/compiler/packagehandling.nim b/compiler/packagehandling.nim
index 7fb560433..ee6af0615 100644
--- a/compiler/packagehandling.nim
+++ b/compiler/packagehandling.nim
@@ -47,12 +47,9 @@ proc demanglePackageName*(path: string): string =
 
 proc withPackageName*(conf: ConfigRef; path: AbsoluteFile): AbsoluteFile =
   let x = getPackageName(conf, path.string)
-  if x.len == 0:
-    result = path
+  let (p, file, ext) = path.splitFile
+  if x == "stdlib":
+    # Hot code reloading now relies on 'stdlib_system' names etc.
+    result = p / RelativeFile((x & '_' & file) & ext)
   else:
-    let (p, file, ext) = path.splitFile
-    if x == "stdlib":
-      # Hot code reloading now relies on 'stdlib_system' names etc.
-      result = p / RelativeFile((x & '_' & file) & ext)
-    else:
-      result = p / RelativeFile(fakePackageName(conf, path))
+    result = p / RelativeFile(fakePackageName(conf, path))
diff --git a/tests/modules/a/utils.nim b/tests/modules/a/utils.nim
new file mode 100644
index 000000000..f37abfb93
--- /dev/null
+++ b/tests/modules/a/utils.nim
@@ -0,0 +1,2 @@
+proc burnMem*(a: int) =
+  discard
diff --git a/tests/modules/b/utils.nim b/tests/modules/b/utils.nim
new file mode 100644
index 000000000..e343385f5
--- /dev/null
+++ b/tests/modules/b/utils.nim
@@ -0,0 +1,2 @@
+# module b/utils.nim
+let x* = 10
diff --git a/tests/modules/tutils_ab.nim b/tests/modules/tutils_ab.nim
new file mode 100644
index 000000000..25bd08f3c
--- /dev/null
+++ b/tests/modules/tutils_ab.nim
@@ -0,0 +1,5 @@
+import a/utils as autils, b/utils
+
+# bug #12420
+
+burnMem(x)