summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCrollie Rollz <crollierollz@gmail.com>2022-04-03 02:47:37 +0800
committerCrollie Rollz <crollierollz@gmail.com>2022-04-03 03:08:27 +0800
commitcd032f35f1922c663b0a67c41adee4996d5cb858 (patch)
tree5551a00700c06f6d29d77a147e52eb1098b0b099 /test
parent9f46e568af0a63e0db46596de3b32c779d27c5cd (diff)
downloadlua-language-server-cd032f35f1922c663b0a67c41adee4996d5cb858.zip
fix(infer): check second arg for event name
Diffstat (limited to 'test')
-rw-r--r--test/type_inference/init.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index ef2d1f62..7316730e 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -941,6 +941,17 @@ emit:on("died", function (<?i?>)
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))
+local emit = {}
+
+emit.on(self, "died", function (<?i?>)
+end)
+]]
+
TEST '👍' [[
---@class 👍
local <?x?>