summaryrefslogtreecommitdiff
path: root/test/diagnostics/init.lua
diff options
context:
space:
mode:
authorunknown <luoxingyue@cn.net.ntes>2021-09-23 12:10:01 +0800
committerunknown <luoxingyue@cn.net.ntes>2021-09-23 13:05:08 +0800
commitf777e326716005c65aab50dfb2b974cf983021e2 (patch)
tree4d683eff97fcb781c585bf52183c44994d510f0c /test/diagnostics/init.lua
parent0c8c6bbf23082d0b858646846a47a3001f718ae2 (diff)
downloadlua-language-server-f777e326716005c65aab50dfb2b974cf983021e2.zip
add typecheck
Diffstat (limited to 'test/diagnostics/init.lua')
-rw-r--r--test/diagnostics/init.lua67
1 files changed, 66 insertions, 1 deletions
diff --git a/test/diagnostics/init.lua b/test/diagnostics/init.lua
index 54ac73ef..79b267c3 100644
--- a/test/diagnostics/init.lua
+++ b/test/diagnostics/init.lua
@@ -491,7 +491,7 @@ f(1, 2, 3)
]]
TEST [[
-<!unpack!>(1)
+<!unpack!>(<!1!>)
]]
TEST [[
@@ -1164,3 +1164,68 @@ return {
[<!2!>] = 4,
}
]]
+
+TEST [[
+---@param table table
+---@param metatable table
+---@return table
+function Setmetatable(table, metatable) end
+
+Setmetatable(<!1!>, {})
+]]
+
+TEST [[
+---@param table table
+---@param metatable table
+---@return table
+function Setmetatable(table, metatable) end
+
+Setmetatable(<!'name'!>, {})
+
+]]
+
+TEST [[
+---@param table table
+---@param metatable table
+---@return table
+function Setmetatable(table, metatable) end
+
+---@type table
+local name
+---@type function
+local mt
+---err
+Setmetatable(name, <!mt!>)
+]]
+
+TEST [[
+---@param p1 string
+---@param p2 number
+---@return table
+local function func1(p1, p2) end
+
+---@type string
+local s
+---@type table
+local t
+---err
+func1(s, <!t!>)
+]]
+
+TEST [[
+---@class bird
+---@field wing string
+
+---@class eagle
+---@field family bird
+
+---@class chicken
+---@field family bird
+
+---@param bd eagle
+local function fly(bd) end
+
+---@type chicken
+local h
+fly(<!h!>)
+]]