-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
internal error for auto iterator #12487
Comments
Some discussion at https://forum.nim-lang.org/t/5384 This might be a subtle compiler bug. |
Short example to reproduce: iterator FaiReader(): string {.closure.} =
yield "something"
template toClosure(i): auto =
iterator j: string {.closure.} =
for x in FaiReader():
yield x
j
proc main =
var reader = toClosure(FaiReader())
main() |
Works in devel but not in 2.0? |
Araq
pushed a commit
that referenced
this issue
Aug 30, 2024
closes #1969, closes #7547, closes #7737, closes #11838, closes #12283, closes #12714, closes #12720, closes #14053, closes #16118, closes #19670, closes #22645 I was going to wait on these but regression tests even for recent PRs are turning out to be important in wide reaching PRs like #24010. The other issues with the working label felt either finnicky (#7385, #9156, #12732, #15247), excessive to test (#12405, #12424, #17527), or I just don't know what fixed them/what the issue was (#16128: the PR link gives a server error by Github, #12457, #12487).
metagn
added a commit
to metagn/Nim
that referenced
this issue
Dec 8, 2024
closes nim-lang#6013, closes nim-lang#7009, closes nim-lang#9190, closes nim-lang#12487, closes nim-lang#12831, closes nim-lang#13184, closes nim-lang#13252, closes nim-lang#14860, closes nim-lang#14877, closes nim-lang#14894, closes nim-lang#14917, closes nim-lang#16153, closes nim-lang#16439, closes nim-lang#17779, closes nim-lang#18074, closes nim-lang#18202, closes nim-lang#18314, closes nim-lang#18648, closes nim-lang#19063, closes nim-lang#19446, closes nim-lang#20065, closes nim-lang#20367, closes nim-lang#22126, closes nim-lang#22820, closes nim-lang#22888, closes nim-lang#23020, closes nim-lang#23287, closes nim-lang#23510
narimiran
pushed a commit
that referenced
this issue
Jan 14, 2025
closes #6013, closes #7009, closes #9190, closes #12487, closes #12831, closes #13184, closes #13252, closes #14860, closes #14877, closes #14894, closes #14917, closes #16153, closes #16439, closes #17779, closes #18074, closes #18202, closes #18314, closes #18648, closes #19063, closes #19446, closes #20065, closes #20367, closes #22126, closes #22820, closes #22888, closes #23020, closes #23287, closes #23510 (cherry picked from commit aeb3fe9)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
EDIT by @narimiran - simplified example at the top, so our tools can pick it up:
Somewhat related: #5859
I am trying to pass an iterator to another proc. To do that, I've tried using the
toClosure()
template from @def- : https://forum.nim-lang.org/t/2027Example
https://github.com/bio-nim/pb/blob/internal-error/src/falconcpkg/rotate.nim
(Hopefully that file will compile for you if you copy/paste, as I've commented out the dependencies.)
Current Output
Expected Output
I am willing to do this a different way. I just can't figure out how to pass an "iterator" to another proc, the way I would pass a "generator" in Python.
I thought
toClosure()
would at least allow me to see the type it returns, using typetraits, but I cannot get this to compile at all.Possible Solution
No idea. For now, I will simply avoid passing an iterator. But it's a useful pattern if it can work. Again, here is info on passing iterators: https://forum.nim-lang.org/t/2027
Additional Information
I'm on Linux.
The text was updated successfully, but these errors were encountered: