-
-
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
Fixes handling of nkBracketExpr nodes in opcGetImpl. #11879
Conversation
If I understand you correctly, the code you posted as an example does not show the error? If so, that makes it sounds like it might be either related to:
|
I can't reproduce a problem in your code. What is your output? What output do you expect? |
I got "node is not a symbol" errors in my code (raised just below the line I modified), I checked the node it was failing on and it's And yes, I tried to reproduce it with a smaller example but couldn't (the code I share above is as far as I've gotten to). I've got some code which I cannot share which runs into this. Is there any reason why we cannot allow this change? |
huh, indeed, this looks like it would fix my problem. But I cannot see it in The reason I did it in the compiler is because of how #8484 was fixed (and I wanted to quickly create a PR that fixes it). But actually after looking at it more closely I do think this belongs in the macros module. I will change it to recreate your commit. |
5eabc98
to
867f4c0
Compare
Ah, sorry for the confusion. Both of the commits I referenced above are part of the PR #11416. I didn't realize the commits show up seemingly by themselves. |
As I said, I can't reproduce the problem, this is my output:
Apart from that, bug fixes should have a test case attached to them. |
@krux02: You misunderstand. The code Dom provided in the OP was his attempt at a simple example to reproduce the problem, which however fails to do so (while being similar in idea to his original code, I imagine). And as I mentioned in my commit 5da931f, I wasn't able to write a test case for it either. In that case the problem was an already existing test, namely this one: https://github.com/nim-lang/Nim/blob/devel/tests/stdlib/tjsonmacro.nim#L7-L55 On devel that code obviously passes the tests, but it started throwing the same error Dom mentions "node is not a symbol", after this commit: 28bb565. |
Yes, what @Vindaar said. Also, test failures look flaky (the failure is frankly ridiculous: https://travis-ci.org/nim-lang/Nim/jobs/568557269#L6). |
This fixes a problem that is similar to #8484. I attempted to reproduce it via: ```nim import macros template custom {.pragma.} type Vec[T] = object x, y: T Entry = object c: Vec[float] a {.custom.}: int b: float proc foo(o: object) = for name, value in o.fieldPairs: when value.hasCustomPragma(custom): echo(name, " has {.custom.}") var x: Entry foo(x) ``` But was not able to do so, possibly just a case of my code having nesting of templates/generics. But this simple patch fixes the compilation of my code.
867f4c0
to
3991059
Compare
This pull request has been automatically marked as stale because it has not had recent activity. If you think it is still a valid PR, please rebase it on the latest devel; otherwise it will be closed. Thank you for your contributions. |
This fixes a problem that is similar to #8484. I attempted to
reproduce it via:
But was not able to do so, possibly just a case of my code having
nesting of templates/generics. But this simple patch fixes the
compilation of my code.