diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-03-07 21:33:23 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-03-07 21:33:23 +0800 |
commit | dd37471ee6bd108fad9e3014a827621114ac4257 (patch) | |
tree | 2f4165149a49aa272631862b103a8580294dbfd9 /test | |
parent | 5e795825cc9a09d7bc895ab389d32e6482063917 (diff) | |
download | lua-language-server-dd37471ee6bd108fad9e3014a827621114ac4257.zip |
update generic
Diffstat (limited to 'test')
-rw-r--r-- | test/definition/luadoc.lua | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/test/definition/luadoc.lua b/test/definition/luadoc.lua index 96766f01..c7c67bb6 100644 --- a/test/definition/luadoc.lua +++ b/test/definition/luadoc.lua @@ -633,7 +633,7 @@ end ]] TEST [[ ----@class TT<V>: { <!x!>: V } +---@class TT<V>: { <!x: V!> } ---@type TT<A> local t @@ -644,7 +644,7 @@ print(t.<?x?>) ]] TEST [[ ----@alias TT<V> { <!x!>: V } +---@alias TT<V> { <!x: V!> } ---@type TT<A> local t @@ -672,6 +672,23 @@ end ]] TEST [[ +---@class TT<K, V>: { [K]: V } + +---@type TT<number, <!{}!>> +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 @@ -760,7 +777,7 @@ function Foo:<!bar1!>() end ---@generic T: table, V ---@param t T ----@return fun(table: V[], i?: integer):integer, V +---@return fun(table: table<number, V>, i?: integer):integer, V ---@return T ---@return integer i local function ipairs(t) end |