From 3db634a3a2e48a97772065e7e9da4d29a07a8098 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 19 Nov 2021 20:02:04 +0800 Subject: fix #809 --- test/type_inference/init.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test/type_inference/init.lua') diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua index 1a07b807..80eae39d 100644 --- a/test/type_inference/init.lua +++ b/test/type_inference/init.lua @@ -926,6 +926,17 @@ TEST 'integer' [[ --- @field on fun(eventName: '"won"', cb: fun(s: string)) local emit = {} +emit.on("died", function () +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("died", function () end) ]] @@ -992,3 +1003,14 @@ TEST 'Test' [[ ---@class Test _G. = {} ]] + +TEST 'integer' [[ +local mt = {} + +---@param callback fun(i: integer) +function mt:loop(callback) end + +mt:loop(function () + +end) +]] -- cgit v1.2.3