summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-09-03 15:45:22 +0200
committerGitHub <noreply@github.com>2016-09-03 15:45:22 +0200
commitea8a11dd7339a74e7d5dd60bceac4b2fc864c721 (patch)
treefd4421b0aaa85972a62f35e33e629d0834ceb909 /tests
parentc2df609cd6b7da970044eab0e223c5c8ec06a58f (diff)
parent9a2b98cd8bb7b4220b1ee959ce2af730f4770cc6 (diff)
downloadNim-ea8a11dd7339a74e7d5dd60bceac4b2fc864c721.tar.gz
Merge pull request #4701 from mbaulch/fix4675
pickBestCandidate: pre-calculate candidates when symbol table modified
Diffstat (limited to 'tests')
-rw-r--r--tests/overload/importA.nim5
-rw-r--r--tests/overload/importB.nim15
-rw-r--r--tests/overload/timport.nim7
3 files changed, 27 insertions, 0 deletions
diff --git a/tests/overload/importA.nim b/tests/overload/importA.nim
new file mode 100644
index 000000000..f045d11b4
--- /dev/null
+++ b/tests/overload/importA.nim
@@ -0,0 +1,5 @@
+type
+  Field* = object
+    elemSize*: int
+
+template `+`*(x: untyped, y: Field): untyped = x
diff --git a/tests/overload/importB.nim b/tests/overload/importB.nim
new file mode 100644
index 000000000..2dc3adf7a
--- /dev/null
+++ b/tests/overload/importB.nim
@@ -0,0 +1,15 @@
+type
+  Foo*[T] = object
+    v*: T
+
+template `+`*(x: Foo, y: Foo): untyped = x
+
+template newvar*(r: untyped): untyped {.dirty.} =
+  var r: float
+
+template t1*(x: Foo): untyped =
+  newvar(y1)
+  x
+template t2*(x: Foo): untyped =
+  newvar(y2)
+  x
diff --git a/tests/overload/timport.nim b/tests/overload/timport.nim
new file mode 100644
index 000000000..8ea65e54d
--- /dev/null
+++ b/tests/overload/timport.nim
@@ -0,0 +1,7 @@
+# issue 4675
+import importA  # comment this out to make it work
+import importB
+
+var x: Foo[float]
+var y: Foo[float]
+let r = t1(x) + t2(y)