From 87e0a180f97cd6bc31909b60228f1148c0289529 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, 1 Jul 2022 16:10:26 +0800 Subject: #1260 `type.weakNilCheck` --- test/diagnostics/type-check.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test') diff --git a/test/diagnostics/type-check.lua b/test/diagnostics/type-check.lua index f4765370..32f60f82 100644 --- a/test/diagnostics/type-check.lua +++ b/test/diagnostics/type-check.lua @@ -609,5 +609,27 @@ local mt = G mt._x = nil ]] +config.set(nil, 'Lua.type.weakNilCheck', true) +TEST [[ +---@type number? +local nb + +---@type number +local n + +n = nb +]] + +TEST [[ +---@type number|nil +local nb + +---@type number +local n + +n = nb +]] +config.set(nil, 'Lua.type.weakNilCheck', false) + config.remove(nil, 'Lua.diagnostics.disable', 'unused-local') config.remove(nil, 'Lua.diagnostics.disable', 'undefined-global') -- cgit v1.2.3