summaryrefslogtreecommitdiff
path: root/test/diagnostics
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2024-08-15 15:16:03 +0800
committerGitHub <noreply@github.com>2024-08-15 15:16:03 +0800
commit2c798703ca854d670fb28f51adc85c2b41f08f37 (patch)
treeaa192cf6d6ed02d02dda8c8b7a4c240dded64efb /test/diagnostics
parentabd5daae1885cdf7a9e21a1cbdfea945385124fc (diff)
parentb71cb7aecd9337c9463a4dfbdb9d06cac7b825fd (diff)
downloadlua-language-server-2c798703ca854d670fb28f51adc85c2b41f08f37.zip
Merge branch 'master' into cast-table-to-class
Diffstat (limited to 'test/diagnostics')
-rw-r--r--test/diagnostics/missing-fields.lua122
1 files changed, 122 insertions, 0 deletions
diff --git a/test/diagnostics/missing-fields.lua b/test/diagnostics/missing-fields.lua
index ab87f81d..8c1ffbbb 100644
--- a/test/diagnostics/missing-fields.lua
+++ b/test/diagnostics/missing-fields.lua
@@ -231,3 +231,125 @@ local t = {
y = 1,
}
]]
+
+TEST [[
+---@diagnostic disable: unused-local
+
+---@class Foo
+---@field a number
+---@field b number
+---@field c number
+
+---@class Foo
+
+---@class Bar
+---@field ba number
+---@field bb number
+---@field bc number
+
+---@class Bar
+---@field bd number
+
+---@type Foo|Bar
+local x = {
+ ba = 1,
+ bb = 2,
+ bc = 3,
+ bd = 4,
+}
+]]
+
+TEST [[
+---@diagnostic disable: unused-local
+
+---@class Foo
+---@field a number
+---@field b number
+---@field c number
+
+---@class Foo
+
+---@class Bar
+---@field ba number
+---@field bb number
+---@field bc number
+
+---@class Bar
+---@field bd number
+
+---@type Foo|Bar
+local x = {
+ a = 1,
+ b = 2,
+ c = 3,
+}
+]]
+
+TEST [[
+---@diagnostic disable: unused-local
+
+---@class Foo
+---@field a number
+---@field b number
+---@field c number
+
+---@class Foo
+
+---@class Bar
+---@field ba number
+---@field bb number
+---@field bc number
+
+---@class Bar
+---@field bd number
+
+---@type Foo|Bar
+local x = <!{
+ a = 1,
+ b = 2,
+}!>
+]]
+
+TEST [[
+---@diagnostic disable: unused-local
+
+---@class Foo
+---@field a number
+---@field b number
+---@field c number
+
+---@class Foo
+
+---@class Bar
+---@field ba number
+---@field bb number
+---@field bc number
+
+---@class Bar
+---@field bd number
+
+---@type Foo|Bar
+local x = <!{
+ ba = 1,
+ bb = 2,
+ bd = 4,
+}!>
+]]
+
+TEST[[
+---@class A
+---@field [1] string
+---@field x number
+
+---@type A
+local t = {x = 1, ""}
+]]
+
+TEST[[
+---@class A
+---@field [1] string
+---@field x number
+
+---@type A
+local t = <!{x = 1}!>
+]] \ No newline at end of file