diff options
Diffstat (limited to 'test/hover/init.lua')
-rw-r--r-- | test/hover/init.lua | 79 |
1 files changed, 76 insertions, 3 deletions
diff --git a/test/hover/init.lua b/test/hover/init.lua index b3d675bb..15bf60d4 100644 --- a/test/hover/init.lua +++ b/test/hover/init.lua @@ -20,6 +20,7 @@ local accept = { ['function'] = true, } +---@diagnostic disable: await-in-sync function TEST(script) return function (expect) files.removeAll() @@ -245,7 +246,7 @@ TEST [[ <?print?>() ]] [[ -function print(...) +function print(...: any) ]] TEST [[ @@ -299,7 +300,7 @@ end <?x?>(1, 2, 3, 4, 5, 6, 7) ]] [[ -function x(a: any, ...) +function x(a: any, ...: any) ]] TEST [[ @@ -1120,6 +1121,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?> ]] @@ -1456,7 +1496,7 @@ TEST [[ local function f(<?callback?>) end ]] [[ -local callback: fun(x: integer, ...: nil) +local callback: fun(x: integer, ...: any) ]] TEST [[ @@ -1728,3 +1768,36 @@ local function <?f?>() end function f() -> nil ]] + +TEST [[ +---@async +local function <?f?>() end +]] +[[ +async function f() +]] + +TEST [[ +---@type function +local <?f?> +]] +[[ +local f: function +]] + +TEST [[ +---@type async fun() +local <?f?> +]] +[[ +local f: async fun() +]] + +config.set('Lua.runtime.nonstandardSymbol', { '//' }) +TEST [[ +local <?x?> = 1 // 2 +]] +[[ +local x: integer = 1 +]] +config.set('runtime.nonstandardSymbol', {}) |