diff options
Diffstat (limited to 'tests/ccgbugs/tescaping_temps.nim')
-rw-r--r-- | tests/ccgbugs/tescaping_temps.nim | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/ccgbugs/tescaping_temps.nim b/tests/ccgbugs/tescaping_temps.nim new file mode 100644 index 000000000..ea09261ea --- /dev/null +++ b/tests/ccgbugs/tescaping_temps.nim @@ -0,0 +1,31 @@ + +# 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 + +# ensure 'case' does not trigger the same bug: +test proc() = + let f = 15 + case f + of 10: + test proc() = discard + of 3: + test proc() = discard + else: + test proc() = discard |