File: tescaping_temps.nim

package info (click to toggle)
nim 0.19.4-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 462,356 kB
  • sloc: sh: 11,089; ansic: 4,699; makefile: 706; python: 309; sql: 297; asm: 141; xml: 13
file content (31 lines) | stat: -rw-r--r-- 641 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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