Skip to content

Commit

Permalink
interpret Expr(:isdefined, ::QuoteNode) correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
simeonschaub committed Apr 22, 2021
1 parent 50400fb commit 004bf08
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/interpreter.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ static jl_value_t *eval_value(jl_value_t *e, interpreter_state *s)
}
}
else {
assert(0 && "malformed isdefined expression");
// QuoteNode or other implicitly quoted object
defined = 1;
}
return defined ? jl_true : jl_false;
}
Expand Down
8 changes: 8 additions & 0 deletions test/interpreter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,11 @@ let p = Pipe(),
wait(proc)
close(p)
end

# interpreting Expr(:isdefined, ::QuoteNode)
let code = """
@generated f() = Expr(:isdefined, QuoteNode(Float64))
f()
"""
@test read(`$(Base.julia_cmd()) --startup-file=no --compile=min -E $code`, String) == "true\n"
end

0 comments on commit 004bf08

Please sign in to comment.