You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Normally, if you type an incomplete binary expression like 1 + 1 +, then the parser automatically looks to the next line to complete the expression. However, this doesn't happen in macro calls (in both Julia 0.5 and 0.6):
julia>1+1+13
julia> Base.Test.@test1+1+
ERROR: MethodError: no method matching @test(::Expr, ::Symbol)
Closest candidates are:@test(::ANY) at test.jl:189
It seems to be related to the fact that + is both a binary and a unary operator, since it works fine for *, and hence I think it is a bug:
julia> Base.Test.@test1*1*1==1
Test Passed
Expression:1*1*1==1
Evaluated:1==1
(I got bitten by this in #20249 when .+ became a unary+binary operator.)
The text was updated successfully, but these errors were encountered:
stevengj
added
bug
Indicates an unexpected problem or unintended behavior
parser
Language parsing and surface syntax
labels
Jan 26, 2017
This seems to happen in all white-space sensitive contexts. For example
julia> [1+12]
2×2 Array{Any,2}:1+12
julia> [1+1]
ERROR: ArgumentError: number of columns of each array must match (got (2,1))
intyped_vcat(::Type{Any}, ::Array{Any,2}, ::Array{Int64,2}) at ./abstractarray.jl:1039invcat(::Array{Any,2}, ::Array{Int64,2}) at ./array.jl:726inhvcat(::Tuple{Int64,Int64}, ::Int64, ::Vararg{Any,N}) at ./abstractarray.jl:1361
Normally, if you type an incomplete binary expression like
1 + 1 +
, then the parser automatically looks to the next line to complete the expression. However, this doesn't happen in macro calls (in both Julia 0.5 and 0.6):It seems to be related to the fact that
+
is both a binary and a unary operator, since it works fine for*
, and hence I think it is a bug:(I got bitten by this in #20249 when
.+
became a unary+binary operator.)The text was updated successfully, but these errors were encountered: