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
I found a strange bug/behavior when working with an anoymous proc that contains an iterator (the proc was generated by macros).
The iterator does not yield a result.
Example code:
procchkConversion(x: seq[int]): seq[string] =result= (proc (): seq[string] =iteratorautoIter(): auto=for it0 in x:
let it1 =$it0
yield it1
result=@[]
for it inautoIter():
result.add(it))()
procchkConversion2(x: seq[int]): seq[string] =result=@[]
iteratorautoIter(): auto=for it0 in x:
let it1 =$it0
yield it1
for it inautoIter():
result.add(it)
whenisMainModule:
echo("calling not working iterator:")
echo(chkConversion(@[1,2,3,4,5]))
echo("calling working iterator:")
echo(chkConversion2(@[1,2,3,4,5]))
The resulting output is
calling not working iterator:
@[]
calling working iterator:
@["1", "2", "3", "4", "5"]
The text was updated successfully, but these errors were encountered:
I found a strange bug/behavior when working with an anoymous proc that contains an iterator (the proc was generated by macros).
The iterator does not yield a result.
Example code:
The resulting output is
The text was updated successfully, but these errors were encountered: