Skip to content

Commit dbed931

Browse files
metagnnarimiran
authored andcommitted
ignore typeof in closure iterators (nim-lang#24861)
fixes nim-lang#24859 (cherry picked from commit f58cd51)
1 parent 9524ede commit dbed931

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

compiler/closureiters.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ type
163163

164164
const
165165
nkSkip = {nkEmpty..nkNilLit, nkTemplateDef, nkTypeSection, nkStaticStmt,
166-
nkCommentStmt, nkMixinStmt, nkBindStmt} + procDefs
166+
nkCommentStmt, nkMixinStmt, nkBindStmt, nkTypeOfExpr} + procDefs
167167

168168
proc newStateAccess(ctx: var Ctx): PNode =
169169
if ctx.stateVarSym.isNil:

tests/iter/ttypeofclosureiter.nim

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# issue #24859
2+
3+
template u(): int =
4+
yield 0
5+
0
6+
iterator s(): int {.closure.} = discard default(typeof(u()))
7+
let _ = s

0 commit comments

Comments
 (0)