summary refs log tree commit diff stats
path: root/tests/overload/tsymtabchange_during_or.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-03-05 20:39:25 +0100
committerAraq <rumpf_a@web.de>2015-03-05 20:39:25 +0100
commitcac259cdfb277f7cbc81332936a0331dd78990c8 (patch)
tree3f374c7e290151211d302e0d715568e5f7e1d113 /tests/overload/tsymtabchange_during_or.nim
parent3adcad1b5dd7d2a2f1dbd7a9ebb7eb4313ffc7fb (diff)
downloadNim-cac259cdfb277f7cbc81332936a0331dd78990c8.tar.gz
fixes #2229
Diffstat (limited to 'tests/overload/tsymtabchange_during_or.nim')
-rw-r--r--tests/overload/tsymtabchange_during_or.nim24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/overload/tsymtabchange_during_or.nim b/tests/overload/tsymtabchange_during_or.nim
new file mode 100644
index 000000000..b5551bcc7
--- /dev/null
+++ b/tests/overload/tsymtabchange_during_or.nim
@@ -0,0 +1,24 @@
+
+# bug #2229
+
+type Type1 = object
+        id: int
+
+type Type2 = object
+    id: int
+
+proc init(self: var Type1, a: int, b: ref Type2) =
+    echo "1"
+
+proc init(self: var Type2, a: int) =
+    echo """
+        Works when this proc commented out
+        Otherwise error:
+        test.nim(14, 4) Error: ambiguous call; both test.init(self: var Type1, a: int, b: ref Type2) and test.init(self: var Type1, a: int, b: ref Type2) match for: (Type1, int literal(1), ref Type2)
+    """
+
+var a: Type1
+init(a, 1, (
+    var b = new(Type2);
+    b
+))