diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-05-08 17:14:27 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-05-08 17:14:27 +0800 |
commit | 0af503e8ebe11fd6226c0363d40473007dbe1f6d (patch) | |
tree | 88a504b188edb22450905b56419c4d459ab1f197 /test | |
parent | 589055fefb2210b82dbd4a5cb601a230a1953d3b (diff) | |
download | lua-language-server-0af503e8ebe11fd6226c0363d40473007dbe1f6d.zip |
stash
Diffstat (limited to 'test')
-rw-r--r-- | test/definition/luadoc.lua | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/test/definition/luadoc.lua b/test/definition/luadoc.lua index 74cc5c81..3620f25e 100644 --- a/test/definition/luadoc.lua +++ b/test/definition/luadoc.lua @@ -282,6 +282,26 @@ print(v1.<?bar1?>) ]] TEST [[ +---@class A +local <!t!> + +---@type A[] +local b + +local <?<!c!>?> = b[1] +]] + +TEST [[ +---@class A +local <!t!> + +---@type table<number, A> +local b + +local <?<!c!>?> = b[1] +]] + +TEST [[ ---@class Foo local Foo = {} function Foo:<!bar1!>() end @@ -347,6 +367,66 @@ local <?<!v2!>?> = v1(<!{}!>) ]] TEST [[ +---@generic V +---@param x V[] +---@return V +local function f(x) end + +---@class A +local <!a!> + +---@type A[] +local b + +local <?<!c!>?> = f(b) +]] + +TEST [[ +---@generic V +---@param x table<number, V> +---@return V +local function f(x) end + +---@class A +local <!a!> + +---@type table<number, A> +local b + +local <?<!c!>?> = f(b) +]] + +TEST [[ +---@generic V +---@param x V[] +---@return V +local function f(x) end + +---@class A +local <!a!> + +---@type table<number, A> +local b + +local <?<!c!>?> = f(b) +]] + +TEST [[ +---@generic V +---@param x table<number, V> +---@return V +local function f(x) end + +---@class A +local <!a!> + +---@type A[] +local b + +local <?<!c!>?> = f(b) +]] + +TEST [[ ---@class Foo local Foo = {} function Foo:<!bar1!>() end |