summaryrefslogtreecommitdiff
path: root/test/diagnostics
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-07-06 16:01:05 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-07-06 16:01:05 +0800
commit25cae7df6bff76e6a44adf85dfef06742ebf7193 (patch)
tree8606dc8bf2d7c539206f66ee888f24cdac3c7b3c /test/diagnostics
parenteca994d10e4f069a4cc9348d27a4f3723a19f551 (diff)
downloadlua-language-server-25cae7df6bff76e6a44adf85dfef06742ebf7193.zip
dose not infer as `nil` by `t.field = nil`
Diffstat (limited to 'test/diagnostics')
-rw-r--r--test/diagnostics/type-check.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/diagnostics/type-check.lua b/test/diagnostics/type-check.lua
index cc60a969..082d0b41 100644
--- a/test/diagnostics/type-check.lua
+++ b/test/diagnostics/type-check.lua
@@ -570,9 +570,9 @@ end
]]
TEST [[
+---@class A
+---@field x number?
local t = {}
-t.x = 1
-t.x = nil
---@return number
function F()
@@ -688,5 +688,11 @@ local t
t = a.x
]]
+TEST [[
+local mt = {}
+mt.x = 1
+mt.x = nil
+]]
+
config.remove(nil, 'Lua.diagnostics.disable', 'unused-local')
config.remove(nil, 'Lua.diagnostics.disable', 'undefined-global')