diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-07-07 15:10:19 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-07-07 15:10:19 +0800 |
commit | 0b87804cba3f24318362993ca2e32e0f95ce990d (patch) | |
tree | 18eb9d21b8b824255a18fedbbf9a6bcd9452c78f /test/type_inference | |
parent | ca299b0289c0f79972d83c44baa29cde20ce31f4 (diff) | |
download | lua-language-server-0b87804cba3f24318362993ca2e32e0f95ce990d.zip |
#1294 fix operator `and`/`or` for boolean
Diffstat (limited to 'test/type_inference')
-rw-r--r-- | test/type_inference/init.lua | 19 |
1 files changed, 19 insertions, 0 deletions
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 <?b?> = '' % 1 ]] + +TEST 'string|integer' [[ +---@type boolean +local bool + +local <?x?> = bool and '' or 0 +]] + +TEST 'string|integer' [[ +local bool + +if X then + bool = true +else + bool = false +end + +local <?x?> = bool and '' or 0 +]] |