Skip to content

Commit

Permalink
put a try catch around calls to propertynames in tab completion. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
oscardssmith authored Jan 31, 2024
1 parent 9df7a67 commit 1295379
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
11 changes: 7 additions & 4 deletions stdlib/REPL/src/REPLCompletions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,14 @@ function complete_symbol(@nospecialize(ex), name::String, @nospecialize(ffunc),
append!(suggestions, filtered_mod_names(p, mod, name, true, false))
end
elseif val !== nothing # looking for a property of an instance
for property in propertynames(val, false)
# TODO: support integer arguments (#36872)
if property isa Symbol && startswith(string(property), name)
push!(suggestions, PropertyCompletion(val, property))
try
for property in propertynames(val, false)
# TODO: support integer arguments (#36872)
if property isa Symbol && startswith(string(property), name)
push!(suggestions, PropertyCompletion(val, property))
end
end
catch
end
elseif field_completion_eligible(t)
# Looking for a member of a type
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 @@ -2247,3 +2247,8 @@ let s = "using ...Issue52922.Inn"
@test res
@test "Inner2" in c
end

struct Issue53126
end
Base.propertynames(::Type{A}) = error()
@test isempty(test_complete_foo(A))

0 comments on commit 1295379

Please sign in to comment.