Closed dfdx closed 7 years ago
Further investigation shows that the issue is caused by the call to remove_quote_nodes!(ex)
: if I comment out this line, code work fine. However, in REPL I don't see that remove_quote_nodes!
changes the expression in any way.
I definitely don't understand something about macro expansion in Julia.
I've got some more time to work on this issue. Now I see that remove_quote_nodes!
really corrupts composed expressions like Main.inc
. Without remove_quote_nodes!
we have expressions like this:
julia> Expr(:., :Main, QuoteNode(:inc))
:(Main.inc)
with it we get:
julia> Expr(:., :Main, :inc)
:(Main.(inc))
which is invalid syntax.
So I should ask: why was this function introduced? Can we replace it with something with the same intended behavior, but without these unfortunate side effects?
cc: @ahwillia
I'm happy for you to change this function as long as it doesn't break any of the tests that are already in place! The problem is that certain parts of the expression are QuoteNodes, not Expressions, which are slightly different representations in Julia.
Unfortunately, I don't have time to address this very soon. But please do play around and I'll review a PR if you get it working.
Just wanted to let you know that I fixed it and am just waiting for better internet connection to make a PR.
On Julia 0.5:
It turns out the function call is transformed into
Main.(inc)(x[i])
which is exactly the source of the error. Oddly enough, pure_einsum()
doesn't have this issue and generates absolutely correct code.It's also worth to mention that on Julia 0.4 the error is different: