summary refs log tree commit diff stats
path: root/compiler/semstmts.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2018-09-26 11:32:02 +0200
committerAraq <rumpf_a@web.de>2018-09-26 11:32:02 +0200
commit787687727afd3da891e60f1b145e2cbb56a21203 (patch)
treec2baa32ec9f0050b3c3f2b5e15aa33a5fd150918 /compiler/semstmts.nim
parent3d768738f8a5b444c61a1e01b1cfa0d2c51255c4 (diff)
downloadNim-787687727afd3da891e60f1b145e2cbb56a21203.tar.gz
fixes #9076
Diffstat (limited to 'compiler/semstmts.nim')
-rw-r--r--compiler/semstmts.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index 75a4198a5..d5c5b7f86 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -114,7 +114,7 @@ const
   skipForDiscardable = {nkIfStmt, nkIfExpr, nkCaseStmt, nkOfBranch,
     nkElse, nkStmtListExpr, nkTryStmt, nkFinally, nkExceptBranch,
     nkElifBranch, nkElifExpr, nkElseExpr, nkBlockStmt, nkBlockExpr,
-    nkHiddenStdConv}
+    nkHiddenStdConv, nkHiddenDeref}
 
 proc implicitlyDiscardable(n: PNode): bool =
   var n = n
@@ -601,6 +601,8 @@ proc semForVars(c: PContext, n: PNode; flags: TExprFlags): PNode =
   inc(c.p.nestedLoopCounter)
   openScope(c)
   n.sons[length-1] = semExprBranch(c, n.sons[length-1], flags)
+  if efInTypeof notin flags:
+    discardCheck(c, n.sons[length-1], flags)
   closeScope(c)
   dec(c.p.nestedLoopCounter)