Julia: Parsing of macro call with kw argument broken

Created on 12 Jan 2017  Â·  4Comments  Â·  Source: JuliaLang/julia

julia> parse("@m(a; b=c)")
ERROR: ParseError("missing ) in argument list")
Stacktrace:
 [1] #parse#220(::Bool, ::Bool, ::Function, ::String, ::Int64) at ./parse.jl:180
 [2] (::Base.#kw##parse)(::Array{Any,1}, ::Base.#parse, ::String, ::Int64) at ./<missing>:0
 [3] #parse#221(::Bool, ::Function, ::String) at ./parse.jl:190
 [4] parse(::String) at ./parse.jl:190

This breaks the BenchmarkTools.jl test. Bisected to https://github.com/JuliaLang/julia/pull/19868 so I assume it isn't intentional. (I think we can make @m(a=b) parse as = while keep @(;a=b) to be parsed as :parameter since there isn't a similar case for parenthesisless syntax to be confused with)

parser

Most helpful comment

Segue: I'm not sure if "congratulations" is the correct word for the 20,000th issue (it means a lot of bug reports, improvements and hard work!), but it seems like a milestone to celebrate. :smile:

All 4 comments

Should the expressions inside parameters be parsed as = or kw? Or maybe we should try to get rid of the kw expression head entirely?

Should the expressions inside parameters be parsed as = or kw?

Keep it as kw unless we are getting rid of kw altogether?

Or maybe we should try to get rid of the kw expression head entirely?

It's convenient to be able to do f($ex) for arbitrary expression and knowing that the result will be a call to f with the result as argument.

Not an argument for anything but I've just realized that we were always parsing = as kw in a call..... This seems pretty confusing too....

julia> Meta.show_sexpr(parse("m(a, (b[]=c))"))
(:call, :m, :a, (:kw, (:ref, :b), :c))

Segue: I'm not sure if "congratulations" is the correct word for the 20,000th issue (it means a lot of bug reports, improvements and hard work!), but it seems like a milestone to celebrate. :smile:

20k issues is definitely a great milestone! It's a sure sign of an active, vibrant project.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TotalVerb picture TotalVerb  Â·  3Comments

tkoolen picture tkoolen  Â·  3Comments

StefanKarpinski picture StefanKarpinski  Â·  3Comments

wilburtownsend picture wilburtownsend  Â·  3Comments

helgee picture helgee  Â·  3Comments