You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
iteratorcount2(): int {.closure.} =var x =1yield x
inc x
yield x
iteratoriterinvoke[T](iter: iterator(): T {.closure.}): T {.closure.} =for x initer(): yield x
for e initerinvoke(count2): echo e
Current Output
1 is echo'd infinitely, seems like the inner iterator is not advanced.
Expected Output
1
2
<program ends>
Possible Solution
Removing {.closure.} from the iterinvoke definition does not trigger the infinite loop behavior.
Additional Information
@Araq let me know on IRC that this was an old bug that was fixed in the past, though I did not find the issue from a quick search.
$ nim -v
Nim Compiler Version 1.1.1 [Linux: amd64]
Installed from choosenim devel on 2019-12-07, but I also got the same issue with 1.0.4 release.
The text was updated successfully, but these errors were encountered:
iteratorcount2(): int {.closure.} =var x =1yield x
inc x
yield x
iteratoriterinvoke[T](iter: iterator(): T {.closure.}): T {.closure.} =let t = iter
for x int(): yield x
for e initerinvoke(count2): echo e
The following program runs infinitely:
Example
Current Output
1
is echo'd infinitely, seems like the inner iterator is not advanced.Expected Output
Possible Solution
Removing
{.closure.}
from theiterinvoke
definition does not trigger the infinite loop behavior.Additional Information
@Araq let me know on IRC that this was an old bug that was fixed in the past, though I did not find the issue from a quick search.
Installed from
choosenim devel
on 2019-12-07, but I also got the same issue with 1.0.4 release.The text was updated successfully, but these errors were encountered: