LuaLS / LuaLS/lua-language-server
Better support for varargs in functions in classes declared with @field
まだ誰も着手していません。
- 主要言語
- Lua
- スター
- 4.4k
- フォーク
- 442
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
I ran into a minor problem with how vararg is handled in function declarations in an field annotation when the function declaration itself later explicitly lists the arguments.
---@class Handler
---@field ReceiveMsg fun(self: Handler, type: number, ...: string)
local handler = {}
function handler:ReceiveMsg(arg1, arg2, arg3, arg4)
--- arg2 is inferred as string, but arg3 and arg4 are "any"
end
Why do I even have this mismatch between field and function declaration? The field annotation comes from a library and is an event handler -- the number of parameters depend on a lot of things, but for a given implementation you usually only care about a few that you explicitly declare.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、@field ReceiveMsg vararg アノテーションと明示的なメソッド宣言を使って、issue の Handler 例を再現します。関数宣言とパラメータ推論の間で vararg 型がどのように伝播するかを追跡します。完了条件は、arg2、arg3、arg4 が一貫して string として推論され、後続の引数が any のままにならないことです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- lua
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100