diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-07-06 15:35:16 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-07-06 15:35:16 +0800 |
commit | eca994d10e4f069a4cc9348d27a4f3723a19f551 (patch) | |
tree | 31c2a61261dc939bc0b339e88fac4f41e2c4d5e5 /test/diagnostics | |
parent | 997109ebfd4e9ec2bd2b22cc8c35fd1e7cdf0b91 (diff) | |
download | lua-language-server-eca994d10e4f069a4cc9348d27a4f3723a19f551.zip |
resolve #1285 ignore `nil` in `getfield`
Diffstat (limited to 'test/diagnostics')
-rw-r--r-- | test/diagnostics/type-check.lua | 24 |
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') |