From f777e326716005c65aab50dfb2b974cf983021e2 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 23 Sep 2021 12:10:01 +0800 Subject: add typecheck --- test/diagnostics/init.lua | 67 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) (limited to 'test/diagnostics/init.lua') diff --git a/test/diagnostics/init.lua b/test/diagnostics/init.lua index 54ac73ef..79b267c3 100644 --- a/test/diagnostics/init.lua +++ b/test/diagnostics/init.lua @@ -491,7 +491,7 @@ f(1, 2, 3) ]] TEST [[ -(1) +() ]] TEST [[ @@ -1164,3 +1164,68 @@ return { [] = 4, } ]] + +TEST [[ +---@param table table +---@param metatable table +---@return table +function Setmetatable(table, metatable) end + +Setmetatable(, {}) +]] + +TEST [[ +---@param table table +---@param metatable table +---@return table +function Setmetatable(table, metatable) end + +Setmetatable(, {}) + +]] + +TEST [[ +---@param table table +---@param metatable table +---@return table +function Setmetatable(table, metatable) end + +---@type table +local name +---@type function +local mt +---err +Setmetatable(name, ) +]] + +TEST [[ +---@param p1 string +---@param p2 number +---@return table +local function func1(p1, p2) end + +---@type string +local s +---@type table +local t +---err +func1(s, ) +]] + +TEST [[ +---@class bird +---@field wing string + +---@class eagle +---@field family bird + +---@class chicken +---@field family bird + +---@param bd eagle +local function fly(bd) end + +---@type chicken +local h +fly() +]] -- cgit v1.2.3