A union type should not merge class fields
まだ誰も着手していません。
評価
調査の方向性
Visual Studio Code 拡張機能で注釈付きの TypeA|TypeB の例を再現し、その後、language server が union class のフィールドをどのようにマージするかを追跡します。完了の条件は、discriminator が正しいクラスを選択し、例に示されている不一致の commonField とメンバー固有のフィールドを報告することです。
索引モデルが issue の本文から書いたものです。
説明
How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
MacOS
What is the issue affecting?
Annotations
Expected Behaviour
---@class (exact) TypeA
---@field type 'A'
---@field commonField number
---@field specificFieldA number
---@class (exact) TypeB
---@field type 'B'
---@field commonField string
---@field specificFieldB string
---@alias Type_Either_A_Or_B_But_Not_Both TypeA|TypeB
---@type Type_Either_A_Or_B_But_Not_Both
local testA = {
type = 'A', --- Indicates that this should be of TypeA
commonField = 'test', --- Should be an error. TypeA.commonField should be a number
specificFieldA = 123, --- OK
specificFieldB = 'Hello' --- Should be an error. TypeA.specificFieldB doesn't exist
}
---@type Type_Either_A_Or_B_But_Not_Both
local testB = {
type = 'B', --- Indicates that this should be of TypeB
commonField = 'test', --- OK
specificFieldA = 123, --- Should be an error. TypeB.specificFieldA doesn't exist
specificFieldB = 'Hello' --- OK
}
Actual Behaviour
TypeA|TypeB is merged, so none of the mismatched fields/types are reported as errors.
local testA: TypeA|TypeB {
commonField: string|number,
specificFieldA: number,
specificFieldB: string,
type: 'A'|'B',
}
Reproduction steps
Paste the code into vscode
Additional Notes
No response
Log File
No response
- 主要言語
- Lua
- スター
- 4.4k
- フォーク
- 442
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
LuaLS/lua-language-server のほかの issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
LuaLS/lua-language-server#1776 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
LuaLS/lua-language-server#3461 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
LuaLS/lua-language-server#3460 · コメント 1 件 · リアクション 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
LuaLS/lua-language-server#3459 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 64/100
LuaLS/lua-language-server#3458 ·
LuaLS/lua-language-server の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
api7/lua-resty-saml#62 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 94/100
codymikol/multiverse.nvim#320 ·
-
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100