LuaLS / LuaLS/lua-language-server
duplicate-set-field diagnostic when assigning a function to a table field
まだ誰も着手していません。
- 主要言語
- 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 にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
再現手順と、Diagnostics/Syntax Checking サブシステムの duplicate-set-field 診断から始めてください。提示された Lua スニペット内の 3 つの info.func 代入を比較し、その後、診断の既存のテストまたは実装を見つけてください。2 つのインライン関数代入が報告された警告を生成しなくなり、l1 代入とその他の duplicate-field チェックについては引き続きカバレッジが維持されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- lua
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100