-
-
Notifications
You must be signed in to change notification settings - Fork 5.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
incorrect determination of macro # of arguments #16594
Comments
Does this work in other versions (eg. do you know/think that it previously worked)? |
Even if it worked previously, making it work by adding a space at the end of a line seems pretty fragile. |
With regard to the versions: I noticed the problem in 0.4.2, and then I downloaded 0.4.5 yesterday to see if it has been fixed. (It hasn't been.) |
simpler testcase: julia> macro einsum(args...)
println(args)
return length(args)
end
julia> @einsum a = b +
(:(a = b),:+)
2 |
Similar situation: julia> [1 +
2 0]
2×2 Array{Any,2}:
1 +
2 0
julia> [1 +
2 0]
1×2 Array{Int64,2}:
3 0 The only difference is that there is a trailing whitespace in the second example. |
As mentioned in #20258, this seems to occur only for operators like |
The macro invocation below fails with an error "wrong number of arguments". Notice that the expression is spread over two lines. Somehow the loader is seeing the text after
@einsum
as two (or more?) arguments to the einsum macro instead of just one. This is version 0.4.5 (downloaded today)The problem goes away if I concatenate the two lines into one. Even more oddly, the problem goes away if I simply insert a space character after the plus sign that terminates the first line!
This problem is not special for the einsum macro; the same thing happens for other macros I tried.
The text was updated successfully, but these errors were encountered: