Skip to content

Commit

Permalink
fixes semi-regression; discard check now skips nkHiddenSubConv (#23840
Browse files Browse the repository at this point in the history
  • Loading branch information
ringabout authored Jul 16, 2024
1 parent b7a275d commit 648f82c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/semstmts.nim
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ const
skipForDiscardable = {nkStmtList, nkStmtListExpr,
nkOfBranch, nkElse, nkFinally, nkExceptBranch,
nkElifBranch, nkElifExpr, nkElseExpr, nkBlockStmt, nkBlockExpr,
nkHiddenStdConv, nkHiddenDeref}
nkHiddenStdConv, nkHiddenSubConv, nkHiddenDeref}

proc implicitlyDiscardable(n: PNode): bool =
# same traversal as endsInNoReturn
Expand Down
9 changes: 9 additions & 0 deletions tests/discard/tdiscardable.nim
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,12 @@ block: # bug #23775
let _ = retString()

doStuff(C)

block:
proc test(): (int, int) {.discardable.} =
discard

if true:
test()
else:
quit()

0 comments on commit 648f82c

Please sign in to comment.