LuaLS / LuaLS/lua-language-server
vararg overload issue
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
If you have a function which takes in only a vararg and you only overload it, the input type is as expected just each of the overloads:
---@overload fun(param1: "test", param2: string)
---@overload fun(param1: "test2", param2: number)
---@overload fun(param1: "test3", param2: boolean, param3: number)
local function test(...)
end
test()
However, if you have a param before the vararg, the input type always becomes param, ...any:
---@overload fun(param1: "test", param2: string)
---@overload fun(param1: "test2", param2: number)
---@overload fun(param1: "test3", param2: boolean, param3: number)
local function test(param1, ...)
end
test()
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing both annotated Lua examples from the issue and compare the inferred signatures for the two vararg forms. Trace the overload and vararg type-handling entry points, then verify that the parameter-before-vararg case preserves the overload-specific parameter types rather than collapsing to ...any.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100