SymbolServer.jl icon indicating copy to clipboard operation
SymbolServer.jl copied to clipboard

Argument type parameter `Vararg{Int,0}` causes crash in `cache_methods`

Open ReubenJ opened this issue 10 months ago • 0 comments

function f(x::Vararg{Int,0}) x end

causes a crash in cache_methods to throw a BoundsError here:

https://github.com/julia-vscode/SymbolServer.jl/blob/2201c26a43013a7bf71b4829ee4967e072070cab/src/symbols.jl#L213-L215

because nargs and the length of signatures do not match.

To reproduce, add

function f(x::Vararg{Int,0}) x end

to the A module in testenv2 and run tests. You'll see the following error.

BoundsError

ERROR: LoadError: BoundsError: attempt to access Core.SimpleVector at index [2]
Stacktrace:
 [1] getindex(v::Core.SimpleVector, i::Int64)
   @ Base ./essentials.jl:932
 [2] cache_methods(f::Any, name::Symbol, env::Dict{Symbol, Main.SymbolServer.ModuleStore}, get_return_type::Bool)
   @ Main.SymbolServer ~/.../SymbolServer.jl/src/symbols.jl:214
 [3] symbols(env::Dict{Symbol, Main.SymbolServer.ModuleStore}, m::Module, allnames::IdSet{Symbol}, visited::IdSet{Module}; get_return_type::Bool)
   @ Main.SymbolServer ~/.../SymbolServer.jl/src/symbols.jl:448
 [4] symbols
   @ ~/.../SymbolServer.jl/src/symbols.jl:419 [inlined]
 [5] symbols(env::Dict{Symbol, Main.SymbolServer.ModuleStore}, m::Nothing, allnames::IdSet{Symbol}, visited::IdSet{Module}; get_return_type::Bool)
   @ Main.SymbolServer ~/.../SymbolServer.jl/src/symbols.jl:479
 [6] symbols(env::Dict{Symbol, Main.SymbolServer.ModuleStore}, m::Nothing, allnames::IdSet{Symbol}, visited::IdSet{Module})
   @ Main.SymbolServer ~/.../SymbolServer.jl/src/symbols.jl:419
 [7] top-level scope
   @ ~/.../SymbolServer.jl/src/server.jl:119
in expression starting at /.../SymbolServer.jl/src/server.jl:1

ReubenJ avatar Feb 20 '25 11:02 ReubenJ