Files
kotlin-fork/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.kt.txt
T
Kirill Rakhman 3b9724d20e [FIR] Desugar increment/decrement in body resolve phase
The expression needs to be resolved first to determine if there is a
receiver that needs to be extracted to a temporary variable. Also, the
special case for prefix increment/decrement on local variable without
delegates requires resolution to check if the variable is local.

^KT-56771 Fixed
^KT-56659 Fixed
2023-03-02 10:19:57 +00:00

88 lines
1.7 KiB
Kotlin
Vendored

fun test1(c: Boolean?) {
L@ while (true) { // BLOCK
L2@ while ({ // BLOCK
val <elvis>: Boolean? = c
when {
EQEQ(arg0 = <elvis>, arg1 = null) -> break@L
else -> <elvis>
}
}) { // BLOCK
}
}
}
fun test2(c: Boolean?) {
L@ while (true) { // BLOCK
L2@ while ({ // BLOCK
val <elvis>: Boolean? = c
when {
EQEQ(arg0 = <elvis>, arg1 = null) -> continue@L
else -> <elvis>
}
}) { // BLOCK
}
}
}
fun test3(ss: List<String>?) {
L@ while (true) { // BLOCK
{ // BLOCK
val <iterator>: Iterator<String> = { // BLOCK
val <elvis>: List<String>? = ss
when {
EQEQ(arg0 = <elvis>, arg1 = null) -> continue@L
else -> <elvis>
}
}.iterator()
L2@ while (<iterator>.hasNext()) { // BLOCK
val s: String = <iterator>.next()
{ // BLOCK
}
}
}
}
}
fun test4(ss: List<String>?) {
L@ while (true) { // BLOCK
{ // BLOCK
val <iterator>: Iterator<String> = { // BLOCK
val <elvis>: List<String>? = ss
when {
EQEQ(arg0 = <elvis>, arg1 = null) -> break@L
else -> <elvis>
}
}.iterator()
L2@ while (<iterator>.hasNext()) { // BLOCK
val s: String = <iterator>.next()
{ // BLOCK
}
}
}
}
}
fun test5() {
var i: Int = 0
Outer@ while (true) { // BLOCK
{ // BLOCK
i = i.inc()
i
} /*~> Unit */
var j: Int = 0
{ // BLOCK
Inner@ do{ // BLOCK
j = j.inc()
j
} while (when {
greaterOrEqual(arg0 = j, arg1 = 3) -> false
else -> break@Inner
})
}
when {
EQEQ(arg0 = i, arg1 = 3) -> break@Outer
}
}
}