diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/crossfile/hover.lua | 12 | ||||
-rw-r--r-- | test/hover/init.lua | 13 | ||||
-rw-r--r-- | test/type_inference/init.lua | 9 |
3 files changed, 24 insertions, 10 deletions
diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index 54d8d93c..aaf69e7a 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -850,3 +850,15 @@ hover = { name = 'bthci.rawhci', description = " Sends a raw HCI command to the BlueTooth controller." }} + +TEST {{ path = 'a.lua', content = '', }, { + path = 'b.lua', + content = [[ +---@type string | fun(): string +local <?t?> +]] +}, +hover = { + label = 'local t: string|fun():string', + name = 't', +}} diff --git a/test/hover/init.lua b/test/hover/init.lua index a7af112d..13cc87e0 100644 --- a/test/hover/init.lua +++ b/test/hover/init.lua @@ -1196,8 +1196,7 @@ TEST [[ local <?f?> ]] [[ -function f(x: number, y: number) - -> boolean +local f: fun(x: number, y: number):boolean ]] TEST [[ @@ -1216,8 +1215,7 @@ TEST [[ function t(<?f?>) end ]] [[ -function () - -> void +local f: fun():void ]] TEST [[ @@ -1227,7 +1225,7 @@ local t = {f = f} t:<?f?>() ]] [[ -function f(a: any, b: any) +field t:f: fun(a: any, b: any) ]] TEST [[ @@ -1286,8 +1284,7 @@ TEST [[ local <?f?> ]] [[ -function f(x?: boolean) - -> boolean? +local f: fun(x: boolean):boolean ]] TEST [[ @@ -1445,7 +1442,7 @@ TEST [[ local function f(<?callback?>) end ]] [[ -function (x: integer, ...) +local callback: fun(x: integer, ...: nil) ]] TEST [[ diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua index 3ca46cda..c23d12f5 100644 --- a/test/type_inference/init.lua +++ b/test/type_inference/init.lua @@ -343,7 +343,7 @@ TEST '"enum1"|"enum2"' [[ local <?x?> ]] -TEST 'function' [[ +TEST 'fun()' [[ ---@type fun() local <?x?> ]] @@ -508,7 +508,7 @@ local t local k, <?v?> = f(t) ]] -TEST 'function' [[ +TEST 'fun()' [[ ---@return fun() local function f() end @@ -767,3 +767,8 @@ local <?t?> ]] config.config.hover.enumsLimit = 5 + +TEST 'string|fun():string' [[ +---@type string | fun(): string +local <?t?> +]] |