[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
+4
-6
@@ -36,8 +36,6 @@ fun test3(ss: List<String>?) {
|
||||
}.iterator()
|
||||
L2@ while (<iterator>.hasNext()) { // BLOCK
|
||||
val s: String = <iterator>.next()
|
||||
{ // BLOCK
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,8 +53,6 @@ fun test4(ss: List<String>?) {
|
||||
}.iterator()
|
||||
L2@ while (<iterator>.hasNext()) { // BLOCK
|
||||
val s: String = <iterator>.next()
|
||||
{ // BLOCK
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,10 +67,12 @@ fun test5() {
|
||||
} /*~> Unit */
|
||||
var j: Int = 0
|
||||
{ // BLOCK
|
||||
Inner@ do{ // BLOCK
|
||||
Inner@ do// COMPOSITE {
|
||||
{ // BLOCK
|
||||
j = j.inc()
|
||||
j
|
||||
} while (when {
|
||||
}
|
||||
// } while (when {
|
||||
greaterOrEqual(arg0 = j, arg1 = 3) -> false
|
||||
else -> break@Inner
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user