summary refs log tree commit diff stats
path: root/tests/discard
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-04-21 09:57:53 +0200
committerGitHub <noreply@github.com>2019-04-21 09:57:53 +0200
commitfabc2a7086bb83afc2abfd6d5841f25c8387609f (patch)
tree5e66aff72c698ba5dd4a2cda474e9f09bf513532 /tests/discard
parent88079a0dee3b6e7820811783ce0df0db8f97a8ad (diff)
downloadNim-fabc2a7086bb83afc2abfd6d5841f25c8387609f.tar.gz
revert discardable transformation (#10905)
* Revert "Properly wrap discarded statements (#10322)"

This reverts commit 15584879b91e14565156ca140eef1dc100cf34c4.

* add test for implicit discard after defer
* enable t10241 again
* make C++ tests green again
Diffstat (limited to 'tests/discard')
-rw-r--r--tests/discard/tdiscardable.nim20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/discard/tdiscardable.nim b/tests/discard/tdiscardable.nim
index 81e17866a..032050139 100644
--- a/tests/discard/tdiscardable.nim
+++ b/tests/discard/tdiscardable.nim
@@ -3,6 +3,8 @@ output: '''
 tdiscardable
 1
 1
+something defered
+something defered
 '''
 """
 
@@ -45,3 +47,21 @@ proc foo: (proc: int) =
   return bar
 
 discard foo()
+
+# bug #10842
+
+proc myDiscardable(): int {.discardable.} =
+  discard
+
+proc main1() =
+  defer:
+    echo "something defered"
+  discard myDiscardable()
+
+proc main2() =
+  defer:
+    echo "something defered"
+  myDiscardable()
+
+main1()
+main2()