summaryrefslogtreecommitdiff
path: root/test/type_inference
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-12-16 15:39:25 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-12-16 15:39:25 +0800
commit72a4342c054851b19b6b82105d34c2184414cd60 (patch)
tree9166fa71e2ad9175d4533d1f4eab4fb0c763c2a9 /test/type_inference
parentbc436972d2793e38f71cde5c1b01e9bb317e1c17 (diff)
downloadlua-language-server-72a4342c054851b19b6b82105d34c2184414cd60.zip
fix
Diffstat (limited to 'test/type_inference')
-rw-r--r--test/type_inference/init.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index 96393578..4479e031 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -4088,6 +4088,36 @@ elseif <?t?> then
end
]]
+TEST 'A|B' [[
+---@class A
+---@class B
+
+---@type A|B
+local t
+
+if x then
+ ---@cast t A
+ print(t)
+elseif <?t?> then
+end
+]]
+
+TEST 'A|B' [[
+---@class A
+---@class B
+
+---@type A|B
+local t
+
+if x then
+ ---@cast t A
+ print(t)
+elseif <?t?> then
+ ---@cast t A
+ print(t)
+end
+]]
+
TEST 'function' [[
local function x()
print(<?x?>)