diff options
author | sumneko <sumneko@hotmail.com> | 2022-03-07 02:04:17 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2022-03-07 02:04:17 +0800 |
commit | d10e3b99be56ed6ae598a2c13892324f6994fb5c (patch) | |
tree | 3b32d0468d05cc1cc0469b18f95b5c502f0a6a9b /test | |
parent | 587a0d5b8cd81914982633c61d95a0369b8062e8 (diff) | |
download | lua-language-server-d10e3b99be56ed6ae598a2c13892324f6994fb5c.zip |
update
Diffstat (limited to 'test')
-rw-r--r-- | test/definition/luadoc.lua | 65 |
1 files changed, 56 insertions, 9 deletions
diff --git a/test/definition/luadoc.lua b/test/definition/luadoc.lua index c360057f..592cbef7 100644 --- a/test/definition/luadoc.lua +++ b/test/definition/luadoc.lua @@ -506,13 +506,61 @@ c.<?x?> ]] TEST [[ +---@generic K +---@param x { [K]: A } +---@return K +local function f(x) end + +---@class A +local a +a.x = 1 + +---@type A[] +local b + +local c = f(b) +c.<?x?> +]] + +TEST [[ +---@generic K +---@param x { [K]: number } +---@return K +local function f(x) end + +---@class A +local a +a.<!x!> = 1 + +---@type { [A]: integer } +local b + +local c = f(b) +c.<?x?> +]] + +TEST [[ +---@generic K +---@param x { [K]: integer } +---@return K +local function f(x) end + +---@class A +local a +a.x = 1 + +---@type { [A]: number } +local b + +local c = f(b) +c.<?x?> +]] + +TEST [[ ---@generic V ---@return fun(t: V[]):V local function f() end ----@class A -local <!a!> - ---@type A[] local b @@ -529,27 +577,26 @@ TEST [[ local function f(t) end ---@class A -local <!a!> +local a +a.<!x!> = 1 ---@type A[] local b local f2, c = f(b) -local <?<!d!>?> = f2(c) +local d = f2(c) +d.<?x?> ]] TEST [[ ----@class C -local <!v1!> - ---@generic V, T ---@param t T ---@return fun(t: V): V ---@return T local function iterator(t) end -for <!v!> in iterator(<!v1!>) do +for <!v!> in iterator(<!function () end!>) do print(<?v?>) end ]] |