summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2022-03-12 03:58:08 +0800
committersumneko <sumneko@hotmail.com>2022-03-12 03:58:08 +0800
commita4baf8a43b0b25414d8fe08cb898e150d420e705 (patch)
tree58d562463229b5a42659027e6d47bafab3005e8b /test
parent7baee6a3d54dc7cb94fb9db95d01244a17f126f6 (diff)
downloadlua-language-server-a4baf8a43b0b25414d8fe08cb898e150d420e705.zip
update
Diffstat (limited to 'test')
-rw-r--r--test/type_inference/init.lua23
1 files changed, 17 insertions, 6 deletions
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index e253cba5..7d3e3280 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -423,7 +423,7 @@ local <?x?>
]]
TEST '"enum1"|"enum2"' [[
----@type '"enum1"' | '"enum2"'
+---@type 'enum1' | 'enum2'
local <?x?>
]]
@@ -544,7 +544,7 @@ print(t.<?a?>)
]]
TEST '"aaa"|"bbb"' [[
----@type table<string, '"aaa"'|'"bbb"'>
+---@type table<string, 'aaa'|'bbb'>
local t = {}
print(t.<?a?>)
@@ -1158,11 +1158,22 @@ end
--f = function (<?x?>) end
--]]
+TEST 'fun(i: integer)' [[
+--- @class Emit
+--- @field on fun(eventName: string, cb: function)
+--- @field on fun(eventName: 'died', cb: fun(i: integer))
+--- @field on fun(eventName: 'won', cb: fun(s: string))
+local emit = {}
+
+emit.on("died", <?function?> (i)
+end)
+]]
+
TEST 'integer' [[
--- @class Emit
--- @field on fun(eventName: string, cb: function)
---- @field on fun(eventName: '"died"', cb: fun(i: integer))
---- @field on fun(eventName: '"won"', cb: fun(s: string))
+--- @field on fun(eventName: 'died', cb: fun(i: integer))
+--- @field on fun(eventName: 'won', cb: fun(s: string))
local emit = {}
emit.on("died", function (<?i?>)
@@ -1172,8 +1183,8 @@ end)
TEST 'integer' [[
--- @class Emit
--- @field on fun(self: Emit, eventName: string, cb: function)
---- @field on fun(self: Emit, eventName: '"died"', cb: fun(i: integer))
---- @field on fun(self: Emit, eventName: '"won"', cb: fun(s: string))
+--- @field on fun(self: Emit, eventName: 'died', cb: fun(i: integer))
+--- @field on fun(self: Emit, eventName: 'won', cb: fun(s: string))
local emit = {}
emit:on("died", function (<?i?>)