summaryrefslogtreecommitdiff
path: root/test/diagnostics
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-07-06 15:35:16 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-07-06 15:35:16 +0800
commiteca994d10e4f069a4cc9348d27a4f3723a19f551 (patch)
tree31c2a61261dc939bc0b339e88fac4f41e2c4d5e5 /test/diagnostics
parent997109ebfd4e9ec2bd2b22cc8c35fd1e7cdf0b91 (diff)
downloadlua-language-server-eca994d10e4f069a4cc9348d27a4f3723a19f551.zip
resolve #1285 ignore `nil` in `getfield`
Diffstat (limited to 'test/diagnostics')
-rw-r--r--test/diagnostics/type-check.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/diagnostics/type-check.lua b/test/diagnostics/type-check.lua
index f1f14b48..cc60a969 100644
--- a/test/diagnostics/type-check.lua
+++ b/test/diagnostics/type-check.lua
@@ -664,5 +664,29 @@ local a = {}
local <!b!> = setmetatable({}, {__index = a})
]]
+TEST [[
+---@class A
+---@field x number?
+local a
+
+---@class B
+---@field x number
+local b
+
+b.x = a.x
+]]
+
+TEST [[
+
+---@class A
+---@field x number?
+local a
+
+---@type number
+local t
+
+t = a.x
+]]
+
config.remove(nil, 'Lua.diagnostics.disable', 'unused-local')
config.remove(nil, 'Lua.diagnostics.disable', 'undefined-global')