LuaLS / LuaLS/lua-language-server
Cannot type for-loop variable
オープン
まだ誰も着手していません。
- 主要言語
- Lua
- スター
- 4.4k
- フォーク
- 442
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
How are you using the lua-language-server?
NeoVim
Which OS are you using?
Linux
What is the issue affecting?
Type Checking, Diagnostics/Syntax Checking
Expected Behaviour
The variables s and r are typed according to the @type annotation.
Actual Behaviour
In the following code snippet I cannot type the for loop variables s and r using the @type annotation:
---@type integer, string
for s, r in str:gmatch("[,]?%s*()([^,]+)%s*[,]?") do
...
end
Instead I get a Can not infer type. error for r and s is shown as of type string
Reproduction steps
Additional Notes
I think #1367 enabled this, but only for primitive for loops.
Log File
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
ソースファイルもテストも指定されていません。Lua スニペットから始め、@type アノテーションがジェネリック for ループ変数にどのように適用されるかを調べ、その経路を #1367 で参照されているプリミティブ for ループのサポートと比較してください。完了条件は、s が integer、r が string と推論され、診断が解消されることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- lua
- 領域
- devtools, tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100