LuaLS / LuaLS/lua-language-server
Invalid type diagnostic doesn't show when passing value from array directly to a function
オープン
まだ誰も着手していません。
enhancement
- 主要言語
- Lua
- スター
- 4.4k
- フォーク
- 442
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
How are you using the lua-language-server?
Other
Which OS are you using?
Linux
What is the issue affecting?
Type Checking, Diagnostics/Syntax Checking
Expected Behaviour
When using a value from an array as a parameter I expect type checking to work.
Actual Behaviour
Type checking only works when I assign the value from the array to a temporary variable, not when passing it to a function directly.
Reproduction steps
This doesn't show a warning:
---@param num integer
function receive(num)
end
---@type (integer?)[]
local values = {}
receive(values[1])
This works:
local value = values[1]
receive(value) -- Cannot assign `integer?` to parameter `integer`.
Additional Notes
No response
Log File
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
ソースファイルもテストも指定されていません。まず2つのLuaスニペットを再現し、配列インデックスを直接指定した引数と一時変数の場合で型チェック診断の経路を追跡します。直接の呼び出しで同じ integer? から integer への不一致が報告されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- lua
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 45/100