LuaLS / LuaLS/lua-language-server
Multipe parameters infer differently?
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
Infers `a` and `aa` correctly but not the rest
```lua
---@diagnostic disable: codestyle-check, spell-check, unused-local
---@alias AnyChild A|B|C
---@class PARENT
local PARENT = {}
---@class A: PARENT
local A = {}
---@class B: PARENT
local B = {}
---@class C: PARENT
local C = {}
---@overload fun(self:PARENT): A
---@overload fun(self:AnyChild, other: A): A
---@overload fun(self:AnyChild, other: B): B
function PARENT:new(other)
self.a = 2
return {}
end
local a = A:new()
local aa = a:new()
local aaa = a:new(B)
local b = B:new(B)
local bb = b:new(B)
local bbb = b:new(C)
```

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 with the embedded Lua reproduction and inspect the language server's inferred types for `aaa`, `b`, `bb`, and `bbb` compared with `a` and `aa`. Trace overload resolution for colon calls and multiple parameters, then add or run a focused regression test that confirms the expected inferred types for all examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100