LuaLS / LuaLS/lua-language-server
Incorrect types used for overloaded class when passed as argument
オープン
まだ誰も着手していません。
- 主要言語
- 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
Expected Behaviour
When a class which is overloaded as a function, if that class is passed as an argument to another function it should be checked as if it is a function if the argument has a function type.
---@param f function
local function call(f) f() end
---@class foo
---@overload fun()
local something = setmetatable({}, {__call = function () end})
call(something) -- <-- Here something should be treated as `fun()`
Actual Behaviour
The type of the class is treated as foo|fun() which results in a warning because foo does not match function.
Reproduction steps
- Create a class with an overload
- Pass it to another function which takes a function argument
- Observe that a warning is produced
Additional Notes
No response
Log File
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
提供された Lua の再現例から始め、関数引数とオーバーロードされたクラスの型チェック経路を追跡します。呼び出し可能なクラスを関数型のパラメーターに渡したときに例で警告が出なくなり、再現手順が引き続き正しく動作すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- lua
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100