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