summaryrefslogtreecommitdiff
path: root/test/type_inference/init.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-24 05:05:39 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-24 05:05:39 +0800
commitafbe46c3090e55ff08302b5306ce6dae99f09c54 (patch)
tree250d17bd9c841fc8ceb78de58637c7f555482471 /test/type_inference/init.lua
parente76e59948ff86f37a7b17fa79ca7041a1dae1bf8 (diff)
downloadlua-language-server-afbe46c3090e55ff08302b5306ce6dae99f09c54.zip
infer by `if not x or x.y then`
Diffstat (limited to 'test/type_inference/init.lua')
-rw-r--r--test/type_inference/init.lua47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index 41ec3df7..df1f538b 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -1965,3 +1965,50 @@ local x
if not x or <?x?> then
end
]]
+
+TEST 'integer?' [[
+---@type integer?
+local x
+
+if not x or XXX then
+ print(<?x?>)
+end
+]]
+
+TEST 'integer?' [[
+---@type integer?
+local x
+
+if x or XXX then
+ print(<?x?>)
+end
+]]
+
+TEST 'integer?' [[
+---@type integer?
+local x
+
+if XXX or x then
+ print(<?x?>)
+end
+]]
+
+TEST 'integer?' [[
+---@type integer?
+local x
+
+if XXX or not x then
+ print(<?x?>)
+end
+]]
+
+TEST 'integer' [[
+---@type integer?
+local x
+
+if not x or XXX then
+ return
+end
+
+print(<?x?>)
+]]