diff --git a/stdlib/REPL/src/REPLCompletions.jl b/stdlib/REPL/src/REPLCompletions.jl index 9c516581e9dae..59fcd29e4f7f3 100644 --- a/stdlib/REPL/src/REPLCompletions.jl +++ b/stdlib/REPL/src/REPLCompletions.jl @@ -576,7 +576,7 @@ end # lower `ex` and run type inference on the resulting top-level expression function repl_eval_ex(@nospecialize(ex), context_module::Module) - if isexpr(ex, :toplevel) || isexpr(ex, :tuple) + if (isexpr(ex, :toplevel) || isexpr(ex, :tuple)) && !isempty(ex.args) # get the inference result for the last expression ex = ex.args[end] end diff --git a/stdlib/REPL/test/replcompletions.jl b/stdlib/REPL/test/replcompletions.jl index d732d073fd6cc..58b29fccc66a6 100644 --- a/stdlib/REPL/test/replcompletions.jl +++ b/stdlib/REPL/test/replcompletions.jl @@ -1857,6 +1857,11 @@ let s = "@show some_issue36437.value.a; some_issue36437.value." @test n in c end end +# https://github.com/JuliaLang/julia/issues/51505 +let s = "()." + c, r, res = test_complete_context(s) + @test res +end # aggressive concrete evaluation on mutable allocation in `repl_frame` let s = "Ref(Issue36437(42))[]."