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
---@class Iter
---@operator call:number?
local iter
for i in iter do end -- 'i' should be 'number'
Actual Behaviour
---@class Iter
---@operator call:number?
local iter
for i in iter do end -- 'i' is 'unknown'
Reproduction steps
- copy the code above into IDE
- hover the mouse over the var
i
Additional Notes
原因是luals在构造迭代器节点时,只对第一个表达式使用getReturn,而后者只能用来得到函数的返回类型。后续未处理__call的情况,导致除了函数之外的所有callable都被忽略。
Log File
No response
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
Actual Behaviour
Reproduction steps
iAdditional Notes
原因是luals在构造迭代器节点时,只对第一个表达式使用getReturn,而后者只能用来得到函数的返回类型。后续未处理__call的情况,导致除了函数之外的所有callable都被忽略。
Log File
No response