-
-
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
mutable iteration over mutable type produces a codegen error #13510
Comments
This is not a reproducible example. |
@disruptek Can't reproduce on latest devel: import tables
type
Group[K, V] = object
table: Table[K, V]
iterator mpairs*[K, V](group: var Group[K, V]): tuple[key: K, val: var V] =
for key, value in group.table.mpairs:
yield (key, value)
var grp = Group[string, string](table: initTable[string, string]())
grp.table["hello"] = "world"
grp.table["yes"] = "no"
for (k, v) in grp.mpairs():
v = "hi" |
Here's my repro, which still demonstrates the problem: https://github.com/disruptek/nimph/blob/master/src/nimph/group.nim#L131 |
@disruptek the comment I made about not being reproducable means that the issue should contain a code listing according to the issue template that can be compiled without any further change to reproduce the problem. |
It's a nice idea but I'm loathe to release a broken version of nimph just to satisfy the issue template. The fact that I'm currently unable to reduce the bug doesn't make the bug any less real. |
Well then you should at least mention in the issue that you were unable to reduce the bug to a small example. The problem here is, back when I worked on bugs I skipped issues that don't bother to put in a reproducable example. And how should I distinguish from "you tried really hard to reduce the problem but couldn't" from "You didn't bother to put in a reproducable example", if you don't explain why you couln't reduce the problem. |
If I knew why I couldn’t reduce the bug then we wouldn’t be having this conversation. If you want to help without working on this vague bug, I’m working on a tool to reduce bugs. It’s very crude and has grown less ambitious as I’ve run up against problems in the compiler, but it’s arguably a better place to type than GitHub comments: https://github.com/disruptek/dust It doesn’t yet attempt to reduce backend bugs such as this one. Maybe that would make a good first PR? |
This is a portion of #12945 that wasn't solved.
This syntax produces a codegen error:
Tested in 1.0.6 and devel.
The text was updated successfully, but these errors were encountered: