-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes #9839; fixes noReturn pragma doesn't work for non-simple templa…
…tes (#21048)
- Loading branch information
Showing
2 changed files
with
38 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |