-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
REPL: fix #27184, ensure macro existence before lowering #40621
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
Conversation
@@ -384,6 +384,7 @@ function get_value(sym::Expr, fn) | |||
end | |||
get_value(sym::Symbol, fn) = isdefined(fn, sym) ? (getfield(fn, sym), true) : (nothing, false) | |||
get_value(sym::QuoteNode, fn) = isdefined(fn, sym.value) ? (getfield(fn, sym.value), true) : (nothing, false) | |||
get_value(sym::GlobalRef, fn) = get_value(sym.name, sym.mod) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this method because Core.@cmd
macro will be lowered with GlobalRef
, but this one looks a bit weird since it totally ignores the context fn
.
Maybe special-casing it inside isexpr(sym, :macrocall)
block within get_type
looks better ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like the correct thing to do to me. Of course, we would expect all GlobalRef
s emitted by the parser to actually exist, but I don't think being more defensive here hurts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, then I will leave this as is.
No description provided.