LuaLS / LuaLS/lua-language-server
Diagnostics.(param-type-mismatch)
Open
Nobody has claimed this yet.
enhancement
feat/type check
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
---@enum Test
local Test = {
Test1 = 1,
Test2 = 2,
Test3 = 2,
}
---@type Test|Test[]
local a
---@param c Test
local function b(c) end
if type(a) == "table" then
b(a[1]);
else
b(a);
end
---@class Class
---@field a Test|Test[]
local Class = {};
function Class:Test()
if type(self.a) == "table" then
b(self.a[1]);
else
b(self.a);
end
end


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
No source file or test is named. Start by reproducing the shown Lua snippet and inspecting the param-type-mismatch diagnostics for both the local union and the class field; done means the diagnostics correctly handle the type narrowed by each type check.
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
- Needs clarification
- Newbie friendliness
- 35/100