diff options
Diffstat (limited to 'tests/controlflow/tunreachable.nim')
-rw-r--r-- | tests/controlflow/tunreachable.nim | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/controlflow/tunreachable.nim b/tests/controlflow/tunreachable.nim new file mode 100644 index 000000000..11c8595eb --- /dev/null +++ b/tests/controlflow/tunreachable.nim @@ -0,0 +1,32 @@ +discard """ + cmd: "nim check --warningAsError:UnreachableCode $file" + action: "reject" + nimout: ''' +tunreachable.nim(23, 3) Error: unreachable code after 'return' statement or '{.noReturn.}' proc [UnreachableCode] +tunreachable.nim(30, 3) Error: unreachable code after 'return' statement or '{.noReturn.}' proc [UnreachableCode] +''' +""" + +# bug #9839 +template myquit1():untyped= + ## foo + quit(1) +template myquit2():untyped= + echo 123 + myquit1() + +proc main1()= + + # BUG: uncommenting this doesn't give `Error: unreachable statement` + myquit2() + + echo "after" + +main1() + +proc main2() = + myquit1() + + echo "after" + +main2() |