From 5b950742705515c4bc2502e8a902221f44bf644f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 28 Jun 2022 20:06:34 +0800 Subject: cleanup --- test/diagnostics/type-check.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test/diagnostics/type-check.lua') diff --git a/test/diagnostics/type-check.lua b/test/diagnostics/type-check.lua index d586c5de..b00e1ba0 100644 --- a/test/diagnostics/type-check.lua +++ b/test/diagnostics/type-check.lua @@ -557,5 +557,28 @@ function F() end ]] +TEST [[ +---@class A +---@field x number? + +---@return number +function F() + ---@type A + local t + return t.x +end +]] + +TEST [[ +local t = {} +t.x = 1 +t.x = nil + +---@return number +function F() + return t.x +end +]] + config.remove(nil, 'Lua.diagnostics.disable', 'unused-local') config.remove(nil, 'Lua.diagnostics.disable', 'undefined-global') -- cgit v1.2.3