summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-01-30 14:38:08 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-01-30 14:38:08 +0800
commitc69e65f5468a3aff99f1de11ee7c72a0d9f75afe (patch)
tree225053bed8d7c4c6af6314c2f88de85cad544055 /test
parent02f6831344efd3a32c0ac8a1fbd0d00af3dec671 (diff)
downloadlua-language-server-c69e65f5468a3aff99f1de11ee7c72a0d9f75afe.zip
infer types of tableindex by semantic
fix #1831
Diffstat (limited to 'test')
-rw-r--r--test/diagnostics/type-check.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/diagnostics/type-check.lua b/test/diagnostics/type-check.lua
index 908920b9..ba0c78b4 100644
--- a/test/diagnostics/type-check.lua
+++ b/test/diagnostics/type-check.lua
@@ -1117,6 +1117,17 @@ local B = "World"
local x = A
]]
+TEST [[
+local enum = { a = 1, b = 2 }
+
+---@type { [integer] : boolean }
+local t = {
+ <![enum.a]!> = 1,
+ <![enum.b]!> = 2,
+ <![3]!> = 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')