summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-24 00:05:42 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-24 00:05:42 +0800
commit999c5dd79a772d039b384ab856023942935592fb (patch)
treea2443b479f8663d474eae469ec6eacf796f46011 /test
parent3cadbfc7419542a8b56f0996bfbfbda146a30ea5 (diff)
downloadlua-language-server-999c5dd79a772d039b384ab856023942935592fb.zip
infer by `assert(x)`
Diffstat (limited to 'test')
-rw-r--r--test/type_inference/init.lua26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index a9ea81a7..357dd04b 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -1919,3 +1919,29 @@ local <?x?> = t[1]
TEST 'unknown' [[
local <?x?> = y and z
]]
+
+TEST 'integer' [[
+---@type integer?
+local x
+
+assert(x)
+
+print(<?x?>)
+]]
+
+TEST 'integer' [[
+---@type integer?
+local x
+
+assert(x ~= nil)
+
+print(<?x?>)
+]]
+
+TEST 'integer' [[
+local x
+
+assert(x == 1)
+
+print(<?x?>)
+]]