LuaLS / LuaLS/lua-language-server
duplicate-set-field diagnostic when assigning a function to a table field
还没有人认领这个 Issue。
- 主要语言
- Lua
- 星标
- 4.4k
- 派生
- 442
- PR 合并指标
- 30 天内没有已合并 PR
描述
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?
Diagnostics/Syntax Checking
Expected Behaviour
No diagnostic warning on assignment because the variable has been 'cleared'.
Actual Behaviour
The two info.func assignments that are "= function" get a Duplicate field 'func' (duplicate-set-field) diagnostic.
The info.func assignment "= l1" does not.
Scope depth does not seem to impact the diagnostic - within the same function.
Assignments to other fields that are string, integer, etc do not get the diagnostic.
FYI - the ".func" is expected in a library I cannot change.
Reproduction steps
local function l1()
end
local function f1()
local info = {};
do
info = {};
info.notCheckable = true
info.func = function()
-- any code
end
end
info = {};
info.notCheckable = true
info.func = function()
-- any code
end
info = {};
info.notCheckable = true
info.func = l1
end
Additional Notes
No response
Log File
No response
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从复现步骤和 Diagnostics/Syntax Checking 子系统中的 duplicate-set-field 诊断开始。比较所提供 Lua 代码片段中的三个 info.func 赋值,然后找到该诊断现有的测试或实现。当两个内联函数赋值不再产生所报告的警告,同时 l1 赋值和其他 duplicate-field 检查仍有覆盖时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- lua
- 领域
- devtools
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100