summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-11-06 23:35:34 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-11-06 23:35:34 +0800
commit885013052b8ad1f5d736a26212fc5926b228c020 (patch)
treea472eb3740eeae0b91ebc603153e736dd054d69a /test
parentfe5eb506a4aef026fd92f0ee6ce3290fdceaab61 (diff)
downloadlua-language-server-885013052b8ad1f5d736a26212fc5926b228c020.zip
type check: supports array part in literal table
resolve #1374
Diffstat (limited to 'test')
-rw-r--r--test/diagnostics/type-check.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/diagnostics/type-check.lua b/test/diagnostics/type-check.lua
index f6b8f008..5f10856d 100644
--- a/test/diagnostics/type-check.lua
+++ b/test/diagnostics/type-check.lua
@@ -942,6 +942,20 @@ local function bar(opts)
end
]]
+TEST [[
+---@type {[1]: string, [10]: number, xx: boolean}
+local t = {
+ <!true!>,
+ <![10]!> = 's',
+ <!xx!> = 1,
+}
+]]
+
+TEST [[
+---@type boolean[]
+local t = { <!1!>, <!2!>, <!3!> }
+]]
+
config.remove(nil, 'Lua.diagnostics.disable', 'unused-local')
config.remove(nil, 'Lua.diagnostics.disable', 'unused-function')
config.remove(nil, 'Lua.diagnostics.disable', 'undefined-global')