summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-23 06:49:32 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-23 06:49:32 +0800
commit86557f99ac61fd23f6bb2184f8b9dfb94a76772e (patch)
tree4031107a835710a2fbf9fd052fb493b3c54f3e08 /test
parente8c06f25c2dc3a6a60e498449f29edc62020c0f9 (diff)
downloadlua-language-server-86557f99ac61fd23f6bb2184f8b9dfb94a76772e.zip
merge if results
Diffstat (limited to 'test')
-rw-r--r--test/type_inference/init.lua34
1 files changed, 30 insertions, 4 deletions
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index 270eb7ce..e592e320 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -1570,7 +1570,7 @@ x = '1'
<?x?> = 1
]]
-TEST 'string|integer' [[
+TEST 'unknown' [[
local x
print(<?x?>)
x = '1'
@@ -1599,7 +1599,7 @@ function A()
end
]]
-TEST 'string|integer' [[
+TEST 'unknown' [[
local x
function A()
@@ -1646,7 +1646,7 @@ x = '1'
x = 1
]]
-TEST 'string|integer' [[
+TEST 'unknown' [[
local x
function A()
@@ -1702,7 +1702,7 @@ x = '1'
x = 1
]]
-TEST 'string|integer' [[
+TEST 'unknown' [[
local x
function A()
@@ -1742,6 +1742,21 @@ if x then
print(<?x?>)
end
]]
+--[[
+#0 integer?
+save 1 #1 integer? --ifblock --block中的初始状态
+save 2 #2 integer? --ifblock --block外的状态
+save 3 #3 integer? --ifblock --filter的状态
+object get #3 integer? --if x then
+load 2 #2 integer? --ifblock
+falsy 2 #2 ? --ifblock
+load 1 #1 integer? --ifblock
+truly #1 integer --ifblock
+object get #1 integer --print(x)
+save 4 #?(1) integer --block中的最终状态
+load 2 #2 ? --ifblock -- block
+merge 4 #2 --if 最终状态
+]]
TEST 'integer?' [[
---@type integer?
@@ -1754,6 +1769,17 @@ end
print(<?x?>)
]]
+TEST 'integer' [[
+---@type integer?
+local x
+
+if not x then
+ x = 1
+end
+
+print(<?x?>)
+]]
+
TEST 'integer' [=[
local x