diff options
author | sumneko <sumneko@hotmail.com> | 2022-03-07 01:18:35 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2022-03-07 01:18:35 +0800 |
commit | 587a0d5b8cd81914982633c61d95a0369b8062e8 (patch) | |
tree | 7d33e7c62b252f153dc5c9896534e5f52956de17 /test | |
parent | 4946063175c1a0cda7a11877b8c2b21b0c447c5f (diff) | |
download | lua-language-server-587a0d5b8cd81914982633c61d95a0369b8062e8.zip |
update
Diffstat (limited to 'test')
-rw-r--r-- | test/definition/luadoc.lua | 61 |
1 files changed, 44 insertions, 17 deletions
diff --git a/test/definition/luadoc.lua b/test/definition/luadoc.lua index 3a796aa3..c360057f 100644 --- a/test/definition/luadoc.lua +++ b/test/definition/luadoc.lua @@ -410,72 +410,99 @@ TEST [[ local function f(x) end ---@class A -local <!a!> +local a +a.<!x!> = 1 ---@type A[] local b -local <?<!c!>?> = f(b) +local c = f(b) +c.<?x?> ]] TEST [[ ---@generic V ----@param x table<number, V> +---@param x { [number]: V } ---@return V local function f(x) end ---@class A -local <!a!> +local a +a.<!x!> = 1 ----@type table<number, A> +---@type { [number]: A } local b -local <?<!c!>?> = f(b) +local c = f(b) +c.<?x?> ]] TEST [[ ---@generic V ----@param x V[] +---@param x { [number]: V } ---@return V local function f(x) end ---@class A -local <!a!> +local a +a.<!x!> = 1 ----@type table<number, A> +---@type { [integer]: A } local b -local <?<!c!>?> = f(b) +local c = f(b) +c.<?x?> ]] TEST [[ ---@generic V ----@param x table<number, V> +---@param x { [integer]: V } ---@return V local function f(x) end ---@class A -local <!a!> +local a +a.x = 1 + +---@type { [number]: A } +local b + +local c = f(b) +c.<?x?> +]] + +TEST [[ +---@generic V +---@param x { [number]: V } +---@return V +local function f(x) end + +---@class A +local a +a.<!x!> = 1 ---@type A[] local b -local <?<!c!>?> = f(b) +local c = f(b) +c.<?x?> ]] TEST [[ ---@generic K ----@param x table<K, number> +---@param x { [K]: number } ---@return K local function f(x) end ---@class A -local <!a!> +local a +a.<!x!> = 1 ----@type table<A, number> +---@type { [A]: number } local b -local <?<!c!>?> = f(b) +local c = f(b) +c.<?x?> ]] TEST [[ |