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