From 028a53341827dff350fe3a626404c607f4f67c8e 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, 19 Jul 2022 21:51:25 +0800 Subject: `close-non-object` don't check `unknown` --- script/core/diagnostics/close-non-object.lua | 3 ++- test/diagnostics/common.lua | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/script/core/diagnostics/close-non-object.lua b/script/core/diagnostics/close-non-object.lua index d07aaebe..1a42b800 100644 --- a/script/core/diagnostics/close-non-object.lua +++ b/script/core/diagnostics/close-non-object.lua @@ -28,7 +28,8 @@ return function (uri, callback) if not infer:hasClass(uri) and not infer:hasType(uri, 'nil') and not infer:hasType(uri, 'table') - and infer:view(uri, 'any') ~= 'any' then + and not infer:hasUnknown(uri) + and not infer:hasAny(uri) then callback { start = source.value.start, finish = source.value.finish, diff --git a/test/diagnostics/common.lua b/test/diagnostics/common.lua index 4c065ac6..886f086a 100644 --- a/test/diagnostics/common.lua +++ b/test/diagnostics/common.lua @@ -2000,3 +2000,10 @@ print(1) do return end ]] + +TEST [[ +---@type unknown +local t + +local _ = t +]] -- cgit debian/1.2.3+git2.25.1-1-2-gaceb0