Skip to content

Commit c3b5b5f

Browse files
authored
Fix for Expr->SyntaxTree conversion with interpolated field name (#64)
The second argument of `K"."` is implicitly `K"inert"` in our representation so we need to remove `QuoteNode` whenever it's present in the Expr form.
1 parent ee86584 commit c3b5b5f

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

src/compat.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ function _insert_convert_expr(@nospecialize(e), graph::SyntaxGraph, src::SourceA
256256
st_k = K"dotcall"
257257
tuple_exprs = collect_expr_parameters(a2, 1)
258258
child_exprs = pushfirst!(tuple_exprs, e.args[1])
259-
elseif a2 isa QuoteNode && a2.value isa Symbol
259+
elseif a2 isa QuoteNode
260260
child_exprs[2] = a2.value
261261
end
262262
elseif e.head === :for

test/compat.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,8 @@ const JL = JuliaLowering
300300
"module A end",
301301
"baremodule A end",
302302
"import A",
303+
"A.x",
304+
"A.\$x",
303305
]
304306

305307
for p in programs

test/quoting.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ end
8888
ex = JuliaLowering.include_string(test_mod, """
8989
let
9090
field_name = :(a)
91-
:(a.\$field_name)
91+
:(x.\$field_name)
9292
end
9393
""")
9494
@test kind(ex[2]) == K"Identifier"

0 commit comments

Comments
 (0)