[FIR] Remove implicit coercion of ifs and whens to Unit

The rule of thumb is the following:
If the `if` and `when` can be successfully replaced with `while`,
then it is used as a statement, otherwise, it is used as an expression.

#KT-59883
This commit is contained in:
Evgeniy.Zhelenskiy
2024-02-20 03:12:56 +01:00
committed by Space Team
parent 2e66954d01
commit 931f2eab58
16 changed files with 256 additions and 68 deletions
@@ -71,7 +71,7 @@ fun main1() {
1.<!ILLEGAL_SELECTOR!>"sdf"<!>
1.<!ILLEGAL_SELECTOR!>{}<!>
1.<!ILLEGAL_SELECTOR!><!INVALID_IF_AS_EXPRESSION!>if<!> (true) {}<!>
1.<!ILLEGAL_SELECTOR!>if (true) {}<!>
}
fun test() {