Skip to content

Commit

Permalink
Exclude block from endsInNoReturn, fix regression (#22632)
Browse files Browse the repository at this point in the history
Co-authored-by: SirOlaf <>
  • Loading branch information
SirOlaf committed Sep 2, 2023
1 parent bd6adbc commit d2f36c0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
2 changes: 1 addition & 1 deletion compiler/sem.nim
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ proc endsInNoReturn(n: PNode): bool =

var it = n
# skip these beforehand, no special handling needed
while it.kind in {nkStmtList, nkStmtListExpr, nkBlockStmt} and it.len > 0:
while it.kind in {nkStmtList, nkStmtListExpr} and it.len > 0:
it = it.lastSon

case it.kind
Expand Down
13 changes: 0 additions & 13 deletions tests/exprs/t22604.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,6 @@ for i in 0..<1:
else:
raiseAssert "Won't get here"

# block
for i in 0..<1:
let x =
case false
of true:
42
of false:
block:
if true:
continue
else:
raiseAssert "Won't get here"

# nested case
for i in 0..<1:
let x =
Expand Down

0 comments on commit d2f36c0

Please sign in to comment.