julia icon indicating copy to clipboard operation
julia copied to clipboard

ParseError with list comprehension and broadcasting

Open dnl-1 opened this issue 6 months ago • 2 comments

"[1.0 .+[1 1] for i=1:1]" produces a ParseError while "1.0 .+[1 1]" and "[1.0 .+ [1 1] for i=1:1]" do not.

dnl-1 avatar May 29 '25 11:05 dnl-1

@c42f, this seems like a bit of a mis-parse, but I'm not sure. What do you think?

StefanKarpinski avatar Jun 05 '25 14:06 StefanKarpinski

unary + means that's failing for the same reason as

julia> [a b for i=1:1]
ERROR: ParseError:

I would call this a dup of https://github.com/JuliaLang/julia/issues/30464 or https://github.com/JuliaLang/julia/issues/27881 (which are actually probably dups of each other)

although admittedly the error message is kind of confusing here. I wonder if it could be something more like "a b is not a valid expression"

adienes avatar Jun 05 '25 15:06 adienes