Maybe this should throw an error.
julia> identity.[3,4,5]
:([3, 4, 5])
FWIW I'm only seeing this with identity
:
julia> sum.[1,2,3]
ERROR: MethodError: no method matching start(::Expr)
Closest candidates are:
start(::SimpleVector) at essentials.jl:259
start(::Base.MethodList) at reflection.jl:560
start(::ExponentialBackOff) at error.jl:107
...
Stacktrace:
[1] mapfoldl(::Base.#identity, ::Function, ::Expr) at ./reduce.jl:67
[2] sum(::Expr) at ./reduce.jl:342
[3] broadcast(::Function, ::Expr) at ./broadcast.jl:415
julia> identity.[1,2,3]
:([1, 2, 3])
julia> length.[1,2,3]
ERROR: MethodError: no method matching length(::Expr)
Closest candidates are:
length(::SimpleVector) at essentials.jl:257
length(::Base.MethodList) at reflection.jl:558
length(::MethodTable) at reflection.jl:634
...
Stacktrace:
[1] broadcast(::Function, ::Expr) at ./broadcast.jl:415
It looks like it's being lowered to broadcast(identity, :([1,2,3]))
.
This is not an expression that has ever meant anything. It gives various different errors in all versions of julia. We allow parsing it, so it should probably be some kind of error during lowering.
Most helpful comment
This is not an expression that has ever meant anything. It gives various different errors in all versions of julia. We allow parsing it, so it should probably be some kind of error during lowering.