Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions JuliaLowering/src/compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,7 @@ function est_to_dst(st::SyntaxTree)
r3 -> @ast g st [K"." rec(l) r3]
end
end
[K"inert" [K"Identifier"]] -> @ast g st st[1]=>K"Symbol"
# [K"quote" [K"Identifier"]] -> @ast g st st[1]=>K"Symbol"
([K"inert" [K"Identifier"]], when=!hasattr(st[1], :mod)) -> @ast g st st[1]=>K"Symbol"
[K"inert" _] -> st
[K"inert_syntaxtree" _] -> st
[K"module" _...] -> st
Expand Down
25 changes: 25 additions & 0 deletions JuliaLowering/test/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -881,3 +881,28 @@ end
mac_st = JuliaLowering.expr_to_est(mac_ex, LineNumberNode(1, "badfile"))
@test JuliaLowering.eval(test_mod, mac_st) == "none"
end

@testset "macro QuoteNode + inert behavior" begin
Base.include_string(test_mod, raw"""
macro quoted_gr()
QuoteNode(GlobalRef(Base, :dontresolveme))
end
""")
let gr = JuliaLowering.include_string(test_mod, "@quoted_gr")
@test gr.mod === Base
@test gr.name === :dontresolveme
end
end

@testset "Base macros" begin
jl_eval(test_mod,
:(function test_invokelatest()
@eval invokelatest_target(x, y) = x + y
out = @invokelatest(invokelatest_target(1, 2))
Base.delete_binding(@__MODULE__, :invokelatest_target)
out
end))
# the following test needs to define this to be effective
@test_throws UndefVarError JuliaLowering.include_string(test_mod, "invokelatest_target(1,2)")
@test JuliaLowering.include_string(test_mod, "test_invokelatest()") === 3
end
Loading