diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-03-04 16:57:57 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-03-04 16:57:57 +0800 |
commit | 171ed306f84850be46620145358dcfdf37387de2 (patch) | |
tree | 614bf1479866b23e6663e71daf4cb8bb0b4024f9 /test/definition/luadoc.lua | |
parent | 9451329b33de1e7b69f2793ac5f94715826c9895 (diff) | |
download | lua-language-server-171ed306f84850be46620145358dcfdf37387de2.zip |
update
Diffstat (limited to 'test/definition/luadoc.lua')
-rw-r--r-- | test/definition/luadoc.lua | 82 |
1 files changed, 70 insertions, 12 deletions
diff --git a/test/definition/luadoc.lua b/test/definition/luadoc.lua index 8124261c..118eff5e 100644 --- a/test/definition/luadoc.lua +++ b/test/definition/luadoc.lua @@ -17,7 +17,7 @@ local x TEST [[ ---@class Class -local <!t!> +local t ---@type Class local <?<!x!>?> ]] @@ -35,21 +35,59 @@ obj:<?cast?>() TEST [[ ---@class A -local <!mt!> = {} -function mt:cast() -end +---@field x number ----@type A -local <!obj!> -<?obj?>:cast() +---@class B: A +---@field <!x!> boolean + +---@type B +local t + +t.<?x?> ]] TEST [[ ----@type A -local <?<!obj!>?> +---@class A +---@field <!x!> number +---@class B: A + +---@type B +local t + +t.<?x?> +]] + +TEST [[ ---@class A -local <!mt!> +local A + +function A:x() end + +---@class B: A +local B + +<!function B:x() end!> + +---@type B +local t + +local <!<?v?>!> = t.x +]] + +TEST [[ +---@class A +local A + +<!function A:x() end!> + +---@class B: A +local B + +---@type B +local t + +local <!<?v?>!> = t.x ]] TEST [[ @@ -116,11 +154,12 @@ print(<?f?>) TEST [[ local function f() - return 1 + local x + return x end ---@class Class -local <!mt!> +local mt ---@type Class local <?<!x!>?> = f() @@ -212,6 +251,25 @@ TEST [[ ]] TEST [[ +---@class A +local A + +---@return A +function A:x() end + +---@class B: A +local <!B!> + +---@return B +function B:x() end + +---@type B +local t + +local <!<?v?>!> = t.x() +]] + +TEST [[ ---@return <!fun()!> local function f() end |