Files
kotlin-fork/compiler/testData/ir/irText/expressions/whileDoWhile.fir.kt.txt
T
Jinseong Jeon 7898d167f3 FIR2IR: wrap do-while loop in IrBlock
"so that variables declared in loop body are not visible outside of the
loop" (from commit d096f1d)
2021-04-01 20:07:47 +03:00

48 lines
923 B
Plaintext
Vendored

fun test() {
var x: Int = 0
while (less(arg0 = x, arg1 = 0)) { // BLOCK
}
while (less(arg0 = x, arg1 = 5)) { // BLOCK
val <unary>: Int = x
x = <unary>.inc()
<unary>
}
while (less(arg0 = x, arg1 = 10)) { // BLOCK
val <unary>: Int = x
x = <unary>.inc()
<unary>
}
{ // BLOCK
do// COMPOSITE {
// } while (less(arg0 = x, arg1 = 0))
}
{ // BLOCK
do{ // BLOCK
val <unary>: Int = x
x = <unary>.inc()
<unary>
} while (less(arg0 = x, arg1 = 15))
}
{ // BLOCK
do// COMPOSITE {
val <unary>: Int = x
x = <unary>.inc()
<unary>
// } while (less(arg0 = x, arg1 = 20))
}
}
fun testSmartcastInCondition() {
val a: Any? = null
when {
a is Boolean -> { // BLOCK
while (a /*as Boolean */) { // BLOCK
}
{ // BLOCK
do// COMPOSITE {
// } while (a /*as Boolean */)
}
}
}
}