fixes #23522; fixes pre-existing wrong type for iter in liftIterSym (#23538)

fixes #23522

(cherry picked from commit 407c0cb64a)
This commit is contained in:
ringabout
2024-04-26 19:00:25 +08:00
committed by narimiran
parent e690ff35a2
commit df589bcce1
2 changed files with 5 additions and 2 deletions

View File

@@ -258,8 +258,7 @@ proc liftIterSym*(g: ModuleGraph; n: PNode; idgen: IdGenerator; owner: PSym): PN
let iter = n.sym
assert iter.isIterator
result = newNodeIT(nkStmtListExpr, n.info, n.typ)
result = newNodeIT(nkStmtListExpr, n.info, iter.typ)
let hp = getHiddenParam(g, iter)
var env: PNode
if owner.isIterator:

View File

@@ -6,3 +6,7 @@ iterator iter*(): int {.closure.} =
yield 3
var x = iter
doAssert x() == 3
let fIt = iterator(): int = yield 70
doAssert fIt() == 70