forked from nim-works/nimskull
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure non-exhaustive
case
and if
are not considered no-return
- Loading branch information
Showing
5 changed files
with
52 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
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
16 changes: 16 additions & 0 deletions
16
tests/lang_exprs/tnoreturn_nested_reject_nonexhaustive_case.nim
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,16 @@ | ||
discard """ | ||
description: ''' | ||
Ensure nested non-noreturn statements aren't treated as such | ||
''' | ||
errormsg: "expression '1' is of type 'int literal(1)' and has to be used (or discarded)" | ||
line: 11 | ||
""" | ||
|
||
let x = | ||
if true: | ||
1 | ||
else: | ||
let y = "hi" | ||
case y: | ||
of "hi": | ||
raise newException(Defect, "gone") # no return |
14 changes: 14 additions & 0 deletions
14
tests/lang_exprs/tnoreturn_nested_reject_nonexhaustive_if.nim
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,14 @@ | ||
discard """ | ||
description: ''' | ||
Ensure nested non-noreturn statements aren't treated as such | ||
''' | ||
errormsg: "expression '1' is of type 'int literal(1)' and has to be used (or discarded)" | ||
line: 11 | ||
""" | ||
|
||
let x = | ||
if true: | ||
1 | ||
else: | ||
if true: | ||
raise newException(Defect, "gone") # no return |