summaryrefslogtreecommitdiff
path: root/test/type_inference
diff options
context:
space:
mode:
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?>)