summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-25 14:25:14 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-25 14:25:14 +0800
commit6e8e0737f5643114ee1bfc5edcb2aeef435ed436 (patch)
tree06224c562547885c3a9adfd0e19c27be1fc3f8ef /test
parent14bf8a0d00cd6e485eff604c67dc21e29b80eef1 (diff)
downloadlua-language-server-6e8e0737f5643114ee1bfc5edcb2aeef435ed436.zip
fix `assert` dose not remove `type nil`
Diffstat (limited to 'test')
-rw-r--r--test/type_inference/init.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index fb34da17..617d34db 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -1980,6 +1980,24 @@ print(<?x?>)
]]
TEST 'integer' [[
+---@type integer | nil
+local x
+
+assert(x)
+
+print(<?x?>)
+]]
+
+TEST 'integer' [[
+---@type integer | nil
+local x
+
+assert(x ~= nil)
+
+print(<?x?>)
+]]
+
+TEST 'integer' [[
local x
assert(x == 1)