summary refs log tree commit diff stats
path: root/tests/ccgbugs
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-08-04 21:44:06 +0200
committerAndreas Rumpf <rumpf_a@web.de>2016-08-04 21:44:06 +0200
commit7ea318a05369a3b0847f7137a173df57b0ad0596 (patch)
tree08a661663936a00bcdf8528dd43dffa242f8cba0 /tests/ccgbugs
parent5d5636138377b63c4b7357ff40048b65a8dcd054 (diff)
downloadNim-7ea318a05369a3b0847f7137a173df57b0ad0596.tar.gz
fixes #4505, fixes #4230
Diffstat (limited to 'tests/ccgbugs')
-rw-r--r--tests/ccgbugs/tescaping_temps.nim20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/ccgbugs/tescaping_temps.nim b/tests/ccgbugs/tescaping_temps.nim
new file mode 100644
index 000000000..ef078913b
--- /dev/null
+++ b/tests/ccgbugs/tescaping_temps.nim
@@ -0,0 +1,20 @@
+
+# bug #4505
+
+proc f(t: tuple[]) = discard
+f((block: ()))
+
+# bug #4230
+# If we make `test` function return nothing - the bug disappears
+proc test(dothejob: proc()): int {.discardable.} =
+    dothejob()
+
+test proc() =
+    let f = 15
+    if f > 10:
+        test proc() = discard
+    # If we remove elif branch of the condition - the bug disappears
+    elif f < 3:
+        test proc() = discard
+    else:
+        test proc() = discard