summaryrefslogtreecommitdiff
path: root/test/definition/luadoc.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/definition/luadoc.lua')
-rw-r--r--test/definition/luadoc.lua80
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