diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-03-07 21:05:08 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-03-07 21:05:08 +0800 |
commit | 5e795825cc9a09d7bc895ab389d32e6482063917 (patch) | |
tree | 3508b0f95c608bc5e141a192bff712b22b343080 /test | |
parent | 46974b3b740c7f58ecd8094392ab7f4c5c254f44 (diff) | |
download | lua-language-server-5e795825cc9a09d7bc895ab389d32e6482063917.zip |
update
Diffstat (limited to 'test')
-rw-r--r-- | test/definition/luadoc.lua | 39 |
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 |