From 72a4342c054851b19b6b82105d34c2184414cd60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 16 Dec 2022 15:39:25 +0800 Subject: fix --- test/type_inference/init.lua | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'test/type_inference') 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 then end ]] +TEST 'A|B' [[ +---@class A +---@class B + +---@type A|B +local t + +if x then + ---@cast t A + print(t) +elseif then +end +]] + +TEST 'A|B' [[ +---@class A +---@class B + +---@type A|B +local t + +if x then + ---@cast t A + print(t) +elseif then + ---@cast t A + print(t) +end +]] + TEST 'function' [[ local function x() print() -- cgit v1.2.3