Skip to content

Commit

Permalink
fix #476: isdefined with QuoteNode
Browse files Browse the repository at this point in the history
  • Loading branch information
simeonschaub committed Apr 22, 2021
1 parent 5e723d4 commit 5b06312
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/interpret.jl
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,9 @@ function check_isdefined(frame, @nospecialize(node))
return isdefined(node.mod, node.name)
elseif isa(node, Symbol)
return isdefined(moduleof(frame), node)
else # QuoteNode or other implicitly quoted object
return true
end
error("unrecognized isdefined node ", node)
end

# For "profiling" where JuliaInterpreter spends its time. See the commented-out block
Expand Down
12 changes: 12 additions & 0 deletions test/interpret.jl
Original file line number Diff line number Diff line change
Expand Up @@ -746,3 +746,15 @@ end
@testset "#466 parametric_type_to_expr" begin
@test JuliaInterpreter.parametric_type_to_expr(Array) == :(Core.Array{T, N})
end

@testset "#476 isdefined QuoteNode" begin
f() = !true

@generated function g()
ci = @code_lowered f()
ci.code[1] = Expr(:isdefined, QuoteNode(Float64))
return ci
end

@test @interpret(g()) === true
end

0 comments on commit 5b06312

Please sign in to comment.