[FIR2IR] Don't replace while loop and when branch body blocks with single expression. Skip some empty blocks.
https://youtrack.jetbrains.com/issue/KT-60264/K2-while-loop-body-block-sometimes-replaced-with-single-expression Merge-request: KT-MR-12035 Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
f4df4f8007
commit
9a2eff6487
@@ -8,9 +8,11 @@ fun test() {
|
||||
<unary>
|
||||
}
|
||||
while (less(arg0 = x, arg1 = 10)) { // BLOCK
|
||||
val <unary>: Int = x
|
||||
x = <unary>.inc()
|
||||
<unary>
|
||||
{ // BLOCK
|
||||
val <unary>: Int = x
|
||||
x = <unary>.inc()
|
||||
<unary>
|
||||
}
|
||||
}
|
||||
{ // BLOCK
|
||||
do// COMPOSITE {
|
||||
@@ -24,11 +26,13 @@ fun test() {
|
||||
} while (less(arg0 = x, arg1 = 15))
|
||||
}
|
||||
{ // BLOCK
|
||||
do{ // BLOCK
|
||||
do// COMPOSITE {
|
||||
{ // BLOCK
|
||||
val <unary>: Int = x
|
||||
x = <unary>.inc()
|
||||
<unary>
|
||||
} while (less(arg0 = x, arg1 = 20))
|
||||
}
|
||||
// } while (less(arg0 = x, arg1 = 20))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,3 +49,4 @@ fun testSmartcastInCondition() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user