summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-05-13 20:28:55 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-05-13 20:28:55 +0800
commit50832a63579ba96587a8bd9bcf408302cea808e0 (patch)
tree4442745ee92df6ec2dbc0bb01f61f8dbd90fe95e /test
parent177f39f546fe9a78fb32eafab522712fd5e0d2f6 (diff)
downloadlua-language-server-50832a63579ba96587a8bd9bcf408302cea808e0.zip
fix
Diffstat (limited to 'test')
-rw-r--r--test/definition/luadoc.lua4
-rw-r--r--test/type_inference/init.lua24
2 files changed, 16 insertions, 12 deletions
diff --git a/test/definition/luadoc.lua b/test/definition/luadoc.lua
index d0d95847..86366752 100644
--- a/test/definition/luadoc.lua
+++ b/test/definition/luadoc.lua
@@ -547,8 +547,8 @@ local v1
local function pairs(t) end
for k, v in pairs(v1) do
- print(k.<?bar1?>)
- print(v.bar1)
+ print(k.bar1)
+ print(v.<?bar1?>)
end
]]
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index 95933b8d..3de36e5e 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -243,8 +243,10 @@ local function f(<?a?>, b)
end
]]
-TEST 'string' [[
----@return string
+TEST 'A' [[
+---@class A
+
+---@return A
local function f2() end
local function f()
@@ -266,14 +268,6 @@ local <?x?> = f()
--setmetatable(<?b?>)
--]]
-TEST 'function' [[
-string.<?sub?>()
-]]
-
-TEST 'function' [[
-(''):<?sub?>()
-]]
-
-- 不根据对方函数内的使用情况来推测
TEST 'any' [[
local function x(a)
@@ -325,16 +319,23 @@ local <?x?>
]]
TEST 'string' [[
+---@class string
+
---@type string
local <?x?>
]]
TEST 'string[]' [[
+---@class string
+
---@type string[]
local <?x?>
]]
TEST 'string|table' [[
+---@class string
+---@class table
+
---@type string | table
local <?x?>
]]
@@ -350,6 +351,9 @@ local <?x?>
]]
TEST 'table<string, number>' [[
+---@class string
+---@class number
+
---@type table<string, number>
local <?x?>
]]