summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
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?>
]]