Skip to content

Commit 8057061

Browse files
committed
REPL: fix #27184, ensure macro existence before lowering
1 parent 75c4f55 commit 8057061

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

stdlib/REPL/src/REPLCompletions.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,12 @@ function get_type(sym::Expr, fn::Module)
456456
# try to analyze nests of calls. if this fails, try using the expanded form.
457457
val, found = try_get_type(sym, fn)
458458
found && return val, found
459+
# https://github.com/JuliaLang/julia/issues/27184
460+
if isexpr(sym, :macrocall)
461+
s = first(sym.args)
462+
isa(s, Symbol) && !isdefined(fn, s) && return Any, false
463+
isa(s, GlobalRef) && !isdefined(s.mod, s.name) && return Any, false
464+
end
459465
return try_get_type(Meta.lower(fn, sym), fn)
460466
end
461467

stdlib/REPL/test/replcompletions.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,3 +1109,8 @@ let s = "test_dict[\"ab"
11091109
c, r = test_complete_context(s)
11101110
@test c == Any["\"abc\"", "\"abcd\""]
11111111
end
1112+
1113+
# https://github.com/JuliaLang/julia/issues/27184
1114+
let s = "@noexist."
1115+
(test_complete(s); @test true)
1116+
end

0 commit comments

Comments
 (0)