From 0b87804cba3f24318362993ca2e32e0f95ce990d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 7 Jul 2022 15:10:19 +0800 Subject: #1294 fix operator `and`/`or` for boolean --- test/type_inference/init.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test') diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua index 8607625e..da109bd7 100644 --- a/test/type_inference/init.lua +++ b/test/type_inference/init.lua @@ -3601,3 +3601,22 @@ TEST 'string' [[ local = '' % 1 ]] + +TEST 'string|integer' [[ +---@type boolean +local bool + +local = bool and '' or 0 +]] + +TEST 'string|integer' [[ +local bool + +if X then + bool = true +else + bool = false +end + +local = bool and '' or 0 +]] -- cgit v1.2.3