summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-03-07 21:05:08 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-03-07 21:05:08 +0800
commit5e795825cc9a09d7bc895ab389d32e6482063917 (patch)
tree3508b0f95c608bc5e141a192bff712b22b343080 /test
parent46974b3b740c7f58ecd8094392ab7f4c5c254f44 (diff)
downloadlua-language-server-5e795825cc9a09d7bc895ab389d32e6482063917.zip
update
Diffstat (limited to 'test')
-rw-r--r--test/definition/luadoc.lua39
1 files changed, 38 insertions, 1 deletions
diff --git a/test/definition/luadoc.lua b/test/definition/luadoc.lua
index 0021556f..96766f01 100644
--- a/test/definition/luadoc.lua
+++ b/test/definition/luadoc.lua
@@ -655,6 +655,43 @@ print(t.<?x?>)
]]
TEST [[
+---@class TT<V>: { [number]: V }
+
+---@type TT<<!{}!>>
+local v1
+
+---@generic V, T
+---@param t T
+---@return fun(t: { [number]: V }): V
+---@return T
+local function iterator(t) end
+
+for <!v!> in iterator(v1) do
+ print(<?v?>)
+end
+]]
+
+TEST [[
+---@class Foo
+local Foo = {}
+function Foo:<!bar1!>() end
+
+---@type { [number]: Foo }
+local v1
+
+---@generic T: table, V
+---@param t T
+---@return fun(table: { [number]: V }, i?: integer):integer, V
+---@return T
+---@return integer i
+local function ipairs(t) end
+
+for i, v in ipairs(v1) do
+ print(v.<?bar1?>)
+end
+]]
+
+TEST [[
---@class Foo
local Foo = {}
function Foo:<!bar1!>() end
@@ -664,7 +701,7 @@ local v1
---@generic T: table, V
---@param t T
----@return fun(table: V[], i?: integer):integer, V
+---@return fun(table: { [number]: V }, i?: integer):integer, V
---@return T
---@return integer i
local function ipairs(t) end