summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-07-11 17:45:39 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-07-11 17:45:39 +0800
commit41f0744c4e601ec80e63cce15b6e50f02f6e4a71 (patch)
tree7f42eaa2e162578db943eef9fce74580c08f766d /test
parent2abeaaf81dd8c288a27a2c9638bf5b527ece3463 (diff)
downloadlua-language-server-41f0744c4e601ec80e63cce15b6e50f02f6e4a71.zip
fix #1320
Diffstat (limited to 'test')
-rw-r--r--test/type_inference/init.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index 3a24e5d0..de66517d 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -3680,3 +3680,26 @@ local t
local <?x?> = t and t[i]
]]
+
+TEST 'number' [[
+---@type number
+local x
+
+if not <?x?>.y then
+ x = nil
+end
+]]
+
+TEST 'number' [[
+---@type number|nil
+local x
+while x == nil do
+ if x == nil then
+ return
+ end
+
+ x = nil
+end
+
+print(<?x?>)
+]]