diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-05-13 21:31:02 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-05-13 21:31:02 +0800 |
commit | d6966ae7915b4c5446c48c7a88793617502fd6c6 (patch) | |
tree | 7c44aed3ecf3418388fc5a1a9d9f14789b1ae81d /test | |
parent | 50832a63579ba96587a8bd9bcf408302cea808e0 (diff) | |
download | lua-language-server-d6966ae7915b4c5446c48c7a88793617502fd6c6.zip |
stash
Diffstat (limited to 'test')
-rw-r--r-- | test/definition/luadoc.lua | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/definition/luadoc.lua b/test/definition/luadoc.lua index 86366752..2b9ec464 100644 --- a/test/definition/luadoc.lua +++ b/test/definition/luadoc.lua @@ -427,6 +427,21 @@ local <?<!c!>?> = f(b) ]] TEST [[ +---@generic K +---@param x table<K, number> +---@return K +local function f(x) end + +---@class A +local <!a!> + +---@type table<A, number> +local b + +local <?<!c!>?> = f(b) +]] + +TEST [[ ---@generic V ---@return fun(t: V[]):V local function f() end @@ -557,6 +572,27 @@ TEST [[ local Foo = {} function Foo:<!bar1!>() end +---@type table<Foo, Foo> +local v1 + +---@generic T: table, K, V +---@param t T +---@return fun(table: table<K, V>, index: K):K, V +---@return T +---@return nil +local function pairs(t) end + +for k, v in pairs(v1) do + print(k.<?bar1?>) + print(v.bar1) +end +]] + +TEST [[ +---@class Foo +local Foo = {} +function Foo:<!bar1!>() end + ---@generic T: table, V ---@param t T ---@return fun(table: V[], i?: integer):integer, V |