summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2022-03-12 04:48:33 +0800
committersumneko <sumneko@hotmail.com>2022-03-12 04:48:33 +0800
commitc461d51bf40563c3b74c652d8789ae302ea7c9e1 (patch)
treeefae279e57602aa19bc993dfcd10bd5990959313 /test
parenta4baf8a43b0b25414d8fe08cb898e150d420e705 (diff)
downloadlua-language-server-c461d51bf40563c3b74c652d8789ae302ea7c9e1.zip
update
Diffstat (limited to 'test')
-rw-r--r--test/type_inference/init.lua27
1 files changed, 22 insertions, 5 deletions
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index 7d3e3280..bdd13760 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -17,7 +17,8 @@ local function getSource(pos)
or source.type == 'getglobal'
or source.type == 'field'
or source.type == 'method'
- or source.type == 'function' then
+ or source.type == 'function'
+ or source.type == 'table' then
result = source
end
end)
@@ -1210,14 +1211,14 @@ local x
<?x?> = 1
]]
-TEST 'any' [[
+TEST 'unknown' [[
---@return number
local function f(x)
local <?y?> = x()
end
]]
-TEST 'any' [[
+TEST 'unknown' [[
local mt
---@return number
@@ -1226,7 +1227,7 @@ function mt:f() end
local <?v?> = mt()
]]
-TEST 'any' [[
+TEST 'unknown' [[
local <?mt?>
---@class X
@@ -1240,7 +1241,7 @@ local mt
function mt:f(<?x?>) end
]]
-TEST 'any' [[
+TEST 'unknown' [[
local <?mt?>
---@type number
@@ -1270,6 +1271,22 @@ mt:loop(function (<?i?>)
end)
]]
+TEST 'C' [[
+---@class D
+---@field y integer # D comment
+
+---@class C
+---@field x integer # C comment
+---@field d D
+
+---@param c C
+local function f(c) end
+
+f <?{?>
+ x = ,
+}
+]]
+
TEST 'integer' [[
---@class D
---@field y integer # D comment