Skip to content
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

REPL: fix #27184, ensure macro existence before lowering #40621

Merged
merged 1 commit into from
Apr 28, 2021

Conversation

aviatesk
Copy link
Sponsor Member

No description provided.

@simeonschaub simeonschaub added kind:bugfix This change fixes an existing bug stdlib:REPL Julia's REPL (Read Eval Print Loop) labels Apr 27, 2021
@@ -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)
Copy link
Sponsor Member Author

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 ?

Copy link
Member

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 GlobalRefs emitted by the parser to actually exist, but I don't think being more defensive here hurts.

Copy link
Sponsor Member Author

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.

@KristofferC KristofferC removed their request for review April 27, 2021 08:29
@simeonschaub simeonschaub merged commit b5177e7 into JuliaLang:master Apr 28, 2021
@aviatesk aviatesk deleted the fix27184 branch April 28, 2021 10:32
ElOceanografo pushed a commit to ElOceanografo/julia that referenced this pull request May 4, 2021
jarlebring pushed a commit to jarlebring/julia that referenced this pull request May 4, 2021
antoine-levitt pushed a commit to antoine-levitt/julia that referenced this pull request May 9, 2021
@simeonschaub simeonschaub added backport 1.6 Change should be backported to release-1.6 backport 1.7 and removed backport 1.7 labels Nov 4, 2021
KristofferC pushed a commit that referenced this pull request Nov 8, 2021
KristofferC pushed a commit that referenced this pull request Nov 11, 2021
KristofferC pushed a commit that referenced this pull request Nov 12, 2021
@KristofferC KristofferC removed the backport 1.6 Change should be backported to release-1.6 label Nov 13, 2021
staticfloat pushed a commit that referenced this pull request Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bugfix This change fixes an existing bug stdlib:REPL Julia's REPL (Read Eval Print Loop)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants