LuaLS / LuaLS/lua-language-server
Generics, inheritance and an overloaded constructor
まだ誰も着手していません。
- 主要言語
- Lua
- スター
- 4.4k
- フォーク
- 442
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
VisualStudio Code on Windows, lua-language-server v3.7.4 (Last updated 2024-01-07, 10:29:54)
The following error occurs only when a generic inherits from a type containing an overloaded constructor.
local e = Entity()
e:get(Transform2)
e:get(Transform)
The only difference between Transform and Transform2 is the overloaded constructor.
I could "workaround" this issue by removing : ComponentBase from the function Entity:get ... but I want to check whether the given component type is valid.
Here is the simplified annotation file:
---@class ComponentBase
---@class Transform: ComponentBase
Transform = {}
---@class Transform2: ComponentBase
---@overload fun(x: number, y: number): Transform2
Transform2 = {}
---@class Entity
---@overload fun(): Entity
Entity = {}
---@generic T: ComponentBase
---@param type T
---@return T
function Entity:get(type) end
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
issue にある簡略化されたアノテーションファイルから始め、lua-language-server v3.7.4を使用してWindows上のVisual Studio Codeで診断を再現します。TransformとTransform2に対する汎用的なEntity:get呼び出しを比較し、有効なコンポーネント型が報告されたエラーなしで一貫して処理されることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- lua
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100