Skip to content

Commit

Permalink
REPL: fix JuliaLang#27184, ensure macro existence before lowering
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk committed Apr 27, 2021
1 parent 75c4f55 commit 8057061
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions stdlib/REPL/src/REPLCompletions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,12 @@ function get_type(sym::Expr, fn::Module)
# try to analyze nests of calls. if this fails, try using the expanded form.
val, found = try_get_type(sym, fn)
found && return val, found
# https://github.com/JuliaLang/julia/issues/27184
if isexpr(sym, :macrocall)
s = first(sym.args)
isa(s, Symbol) && !isdefined(fn, s) && return Any, false
isa(s, GlobalRef) && !isdefined(s.mod, s.name) && return Any, false
end
return try_get_type(Meta.lower(fn, sym), fn)
end

Expand Down
5 changes: 5 additions & 0 deletions stdlib/REPL/test/replcompletions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1109,3 +1109,8 @@ let s = "test_dict[\"ab"
c, r = test_complete_context(s)
@test c == Any["\"abc\"", "\"abcd\""]
end

# https://github.com/JuliaLang/julia/issues/27184
let s = "@noexist."
(test_complete(s); @test true)
end

0 comments on commit 8057061

Please sign in to comment.