[K2] Properly evaluate complex boolean constants

Some boolean expressions could be transformed into `IrWhen`
node. To understand that this node is actually
a boolean expression, we need to analyze its origin.

#KT-62683
This commit is contained in:
Ivan Kylchik
2023-11-14 12:49:18 +01:00
committed by Space Team
parent ede77ea29c
commit 3fa82c7bb1
19 changed files with 114 additions and 9 deletions
@@ -76,11 +76,11 @@ fun testArithmeticOperations() {
fun testLogicOperations() {
js("{ var a = ${<!JSCODE_ARGUMENT_NON_CONST_EXPRESSION!>!true<!>}; }")
js("{ var a = ${<!JSCODE_ARGUMENT_NON_CONST_EXPRESSION!>true or false<!>}; }")
js(<!JSCODE_CAN_NOT_VERIFY_JAVASCRIPT!>"{ var a = ${true || false}; }"<!>)
js("{ var a = ${true || false}; }")
js("{ var a = ${<!JSCODE_ARGUMENT_NON_CONST_EXPRESSION!>true and false<!>}; }")
js(<!JSCODE_CAN_NOT_VERIFY_JAVASCRIPT!>"{ var a = ${true && false}; }"<!>)
js("{ var a = ${true && false}; }")
js(<!JSCODE_CAN_NOT_VERIFY_JAVASCRIPT!>"{ var a = ${TRUE && false}; }"<!>)
js("{ var a = ${TRUE && false}; }")
js("{ var a = ${TRUE or false}; }")
}