diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/crossfile/hover.lua | 2 | ||||
-rw-r--r-- | test/definition/luadoc.lua | 5 | ||||
-rw-r--r-- | test/diagnostics/init.lua | 17 | ||||
-rw-r--r-- | test/hover/init.lua | 41 |
4 files changed, 63 insertions, 2 deletions
diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index 6357ab50..f23850a5 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -593,7 +593,7 @@ function f(arg1: integer, arg2: integer) --- ```lua -function f() +function f(arg3: any) ```]]} diff --git a/test/definition/luadoc.lua b/test/definition/luadoc.lua index 5f8c11ee..58c7c8fe 100644 --- a/test/definition/luadoc.lua +++ b/test/definition/luadoc.lua @@ -100,6 +100,11 @@ function f(<?...?>) end ]] TEST [[ +---@param ... <!fun():void!> +function f(<?...?>) end +]] + +TEST [[ ---@overload <!fun(y: boolean)!> ---@param x number ---@param y boolean diff --git a/test/diagnostics/init.lua b/test/diagnostics/init.lua index 4fcf38ab..fa67d229 100644 --- a/test/diagnostics/init.lua +++ b/test/diagnostics/init.lua @@ -1489,3 +1489,20 @@ local _ = type(function () ---@async return nil end) ]] + +TEST [[ +---@param ... number +local function f(...) + return ... +end + +return f +]] + +TEST [[ +---@type fun(...: string) +]] + +TEST [[ +---@type fun(xxx, yyy, ...): boolean +]] diff --git a/test/hover/init.lua b/test/hover/init.lua index d2a6e084..d5c47ddf 100644 --- a/test/hover/init.lua +++ b/test/hover/init.lua @@ -1118,6 +1118,45 @@ local t: Class[] ]] TEST [[ +---@class Class + +---@param ... Class +local function f(...) + local _, <?x?> = ... +end +f(1, 2, 3) +]] +[[ +local x: Class +]] + +TEST [[ +---@class Class + +---@param ... Class +local function f(...) + local t = {...} + local <?v?> = t[1] +end +]] +[[ +local v: Class +]] + +TEST [[ +---@class Class + +---@param ... Class +local function f(...) + local <?t?> = {...} +end +f(1, 2, 3) +]] +[[ +local t: Class[] +]] + +TEST [[ ---@type string[] local <?x?> ]] @@ -1454,7 +1493,7 @@ TEST [[ local function f(<?callback?>) end ]] [[ -local callback: fun(x: integer, ...: nil) +local callback: fun(x: integer, ...: any) ]] TEST [[ |