mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-03 18:34:43 +00:00
fixes semi-regression; discard check now skips nkHiddenSubConv (#23840)
follow up https://github.com/nim-lang/Nim/pull/23681
ref https://forum.nim-lang.org/t/11987
(cherry picked from commit 648f82c2ed)
This commit is contained in:
@@ -132,7 +132,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
|
||||
|
||||
@@ -140,3 +140,12 @@ block: # issue #14665
|
||||
continue
|
||||
inc i
|
||||
test()
|
||||
|
||||
block:
|
||||
proc test(): (int, int) {.discardable.} =
|
||||
discard
|
||||
|
||||
if true:
|
||||
test()
|
||||
else:
|
||||
quit()
|
||||
|
||||
Reference in New Issue
Block a user