-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
0.4.8 lets a.[1]
parse and lower
#410
Comments
Note that this was allowed in the flisp parser. julia +lts -E ':(a.[1])'
:(a.:([1])) |
There was a bug in the bisector backend. Should hopefully be fixed now. @LilithHafnerBot bisect() using JuliaSyntax
JuliaSyntax.parse(Expr, "a.[1]") |
@LilithHafnerBot bisect() using JuliaSyntax
JuliaSyntax.enable_in_core!()
eval(Meta.parse("""
Meta.lower(Main, :(a.[1]))
""")) |
✅ Bisect succeeded! The first new commit is 296cd5e
|
@LilithHafnerBot bisect() using JuliaSyntax
dump(JuliaSyntax.parse(Expr, "a.[1]")) |
✅ Bisect succeeded! The first new commit is 296cd5e
|
Alas, @savq, the old and new parsing results both print to julia> old = Expr(:., :a, Expr(:quote, :([1])))
:(a.:([1]))
julia> new = Expr(:., :a, QuoteNode(:([1])))
:(a.:([1]))
julia> old == new
false
julia> Meta.lower(Main, old)
:($(Expr(:error, "invalid syntax \"a.[1]\"")))
julia> Meta.lower(Main, new)
:($(Expr(:thunk, CodeInfo(
@ none within `top-level scope'
1 ─ %1 = Base.getproperty(a, $(QuoteNode(:([1]))))
└── return %1
)))) From the commit message, this looks intentional; perhaps the appropriate fix is to prohibit this in lowering (and possibly gate the new parsing to new versions of Julia) |
Are |
No, but the difference is subtle.
|
Note that the old parser uses julia> dump(JuliaSyntax.fl_parse(raw"x.$y"))
Expr
head: Symbol .
args: Array{Any}((2,))
1: Symbol x
2: QuoteNode
value: Expr
head: Symbol $
args: Array{Any}((1,))
1: Symbol y
julia> let
field_name = :a
quote
x.$field_name
end
end
quote
#= REPL[10]:4 =#
x.a
end But in the old parser, the following doesn't work because use of julia> let
field_name = :a
quote
x.[$field_name]
end
end
quote
#= REPL[11]:4 =#
x.:([$(Expr(:$, :field_name))])
end However, after #324, we have julia> JuliaSyntax.enable_in_core!()
julia> let
field_name = :a
quote
x.[$field_name]
end
end
quote
#= REPL[13]:4 =#
x.:([a])
end |
This came up at JuliaLang/julia#53119
@LilithHafnerBot bisect()
The text was updated successfully, but these errors were encountered: