Skip to content

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

Merged
simeonschaub merged 1 commit intoJuliaLang:masterfrom
aviatesk:fix27184
Apr 28, 2021
Merged

REPL: fix #27184, ensure macro existence before lowering#40621
simeonschaub merged 1 commit intoJuliaLang:masterfrom
aviatesk:fix27184

Conversation

@aviatesk
Copy link
Copy Markdown
Member

No description provided.

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

bugfix This change fixes an existing bug REPL Julia's REPL (Read Eval Print Loop)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants