summaryrefslogtreecommitdiff
path: root/test/diagnostics/type-check.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-28 20:06:34 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-28 20:06:34 +0800
commit5b950742705515c4bc2502e8a902221f44bf644f (patch)
treef57ba3f1159eecfba3d882703b1b5775e0e72541 /test/diagnostics/type-check.lua
parentdeac4582d38908c1281d4d5215b7b69ff8400dca (diff)
downloadlua-language-server-5b950742705515c4bc2502e8a902221f44bf644f.zip
cleanup
Diffstat (limited to 'test/diagnostics/type-check.lua')
-rw-r--r--test/diagnostics/type-check.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/diagnostics/type-check.lua b/test/diagnostics/type-check.lua
index d586c5de..b00e1ba0 100644
--- a/test/diagnostics/type-check.lua
+++ b/test/diagnostics/type-check.lua
@@ -557,5 +557,28 @@ function F()
end
]]
+TEST [[
+---@class A
+---@field x number?
+
+---@return number
+function F()
+ ---@type A
+ local t
+ return t.x
+end
+]]
+
+TEST [[
+local t = {}
+t.x = 1
+t.x = nil
+
+---@return number
+function F()
+ return t.x
+end
+]]
+
config.remove(nil, 'Lua.diagnostics.disable', 'unused-local')
config.remove(nil, 'Lua.diagnostics.disable', 'undefined-global')