summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-07-01 16:10:26 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-07-01 16:10:33 +0800
commit87e0a180f97cd6bc31909b60228f1148c0289529 (patch)
treeda72f156113a156b960018ec352196823fe28649 /test
parentcbcac3afc40268eae82a41a82248d912b1cfeeb6 (diff)
downloadlua-language-server-87e0a180f97cd6bc31909b60228f1148c0289529.zip
#1260 `type.weakNilCheck`
Diffstat (limited to 'test')
-rw-r--r--test/diagnostics/type-check.lua22
1 files changed, 22 insertions, 0 deletions
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')