LuaLS / LuaLS/lua-language-server
Diagnostics for class array
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
### How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
### Which OS are you using?
Windows
### What is the issue affecting?
Type Checking
### Expected Behaviour
When a class is matched with its array it should produce a diagnostic error.
### Actual Behaviour
No diagnostic error is produced when a class array is matched with a class.
### Reproduction steps
1. Paste the following code:
```lua
---@class classA
local a
---@type classA[]
local b
---@param param1 classA[]
---@return classA
local function testFunc(param1)
param1 = a
return b
end
local result = testFunc(a)
```
2. Assigning `param1`, returning `b` and calling `testFunc` with `a` should all produce diagnostic errors, but no diagnostic error is produced.
### Additional Notes
Another class, such as `classB` can be matched with `classA[]` without error.
### Log File
_No response_
Contributor guide
Research direction
Run the Lua reproduction in the Visual Studio Code extension and inspect the type-checking diagnostic entry point for class-versus-array compatibility. Verify that assigning param1, returning b, and calling testFunc(a) each produce diagnostics, while the classB comparison remains covered by the existing behavior.
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
- 45/100