-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(sem): noreturn analysis for
void
exprs
Summary ======= `void` branches preceeding with no-return terminal branches are checked with no-return analysis to avoid false positives. Details ===== The analysis is updated to recursively check `if/elif/of/except` non-terminal branches as well as the terminal branch.
- Loading branch information
Showing
2 changed files
with
28 additions
and
11 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,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: | ||
if true: | ||
echo "fun" # void | ||
else: | ||
raise newException(Defect, "gone") # no return |