LuaLS / LuaLS/lua-language-server
generic in the loop
Open
Nobody has claimed this yet.
- 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?
Annotations, Type Checking
Expected Behaviour
Actual Behaviour
Reproduction steps
---@generic T
---@param t T[]
---@return fun(): { first: integer, second: T }
local function test_function(t)
local ending = #t
local begining = 1
local j = begining
return function()
if ending < j then
return nil
end
local i = t[j]
j = j + 1
if i then return { first = j - 1, second = i } end
end
end
---@type integer[]
local test_table = {}
local test_result = test_function(test_table)()
local test1 = test_result.second
for itr in test_function(test_table) do
local test2 = itr.first;
local test3 = itr.second;
end
Additional Notes
No response
Log File
No response
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 running the Lua reproduction in the issue and compare the inferred types with the Expected Behaviour and Actual Behaviour screenshots. Trace the language server's annotation and type-checking entry points for generic functions and iterator returns, then verify that the reported types match the expected result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, vscode
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100