diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/diagnostics/init.lua | 13 | ||||
-rw-r--r-- | test/references/init.lua | 25 |
2 files changed, 38 insertions, 0 deletions
diff --git a/test/diagnostics/init.lua b/test/diagnostics/init.lua index 5502093e..6374b4b7 100644 --- a/test/diagnostics/init.lua +++ b/test/diagnostics/init.lua @@ -1049,3 +1049,16 @@ m.x = nil return m ]] + +TEST [[ +---@class A +---@field a boolean + +---@return A +local function f() end + +local r = f() +r.x = 1 + +return r.x +]] diff --git a/test/references/init.lua b/test/references/init.lua index 61a33ee4..08dc30da 100644 --- a/test/references/init.lua +++ b/test/references/init.lua @@ -323,3 +323,28 @@ end function mt2:doSomething() end ]] + +TEST [[ +---@class A +local a = {} +a.<?x?> = 1 + +---@return A +local function f() end + +local b = f() +return b.<!x!> +]] + +TEST [[ +---@class A +local a = {} +a.<?x?> = 1 + +---@return table +---@return A +local function f() end + +local a, b = f() +return a.x, b.<!x!> +]] |