Skip to content

Commit

Permalink
[REPLCompletions] fix #51505, guard against empty tuple expression (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk authored Sep 30, 2023
1 parent 292562c commit a4562e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stdlib/REPL/src/REPLCompletions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
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 @@ -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))[]."
Expand Down

0 comments on commit a4562e6

Please sign in to comment.