summaryrefslogtreecommitdiff
path: root/test/diagnostics/type-check.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-02-02 15:45:07 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-02-02 15:45:07 +0800
commit36ed61dc66433c13c99feb9d3650b31792454615 (patch)
tree62ffba89f4a4797b4553e75dd924a9b96c780ee6 /test/diagnostics/type-check.lua
parente28d88a96995c617427534e93cf7affcd202f8e2 (diff)
downloadlua-language-server-36ed61dc66433c13c99feb9d3650b31792454615.zip
fix #1871
Diffstat (limited to 'test/diagnostics/type-check.lua')
-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 8f3d6936..13df5a95 100644
--- a/test/diagnostics/type-check.lua
+++ b/test/diagnostics/type-check.lua
@@ -1190,6 +1190,17 @@ end
print(is_string(3))
]]
+TEST [[
+---@class SomeClass
+---@field [1] string
+-- ...
+
+---@param some_param SomeClass|SomeClass[]
+local function some_fn(some_param) return end
+
+some_fn { { "test" } } -- <- diagnostic: "Cannot assign `table` to `string`."
+]]
+
config.remove(nil, 'Lua.diagnostics.disable', 'unused-local')
config.remove(nil, 'Lua.diagnostics.disable', 'unused-function')
config.remove(nil, 'Lua.diagnostics.disable', 'undefined-global')