Files
kotlin-fork/compiler/testData/ir/irText/expressions/whileDoWhile.fir.kt.txt
T
Vladimir Sukharev e9d4de658d [FIR2IR] Don't emit empty body of while/do_while loop
Merge-request: KT-MR-12283
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-09-20 10:06:00 +00:00

55 lines
1023 B
Kotlin
Vendored

fun test() {
var x: Int = 0
while (less(arg0 = x, arg1 = 0))
while (less(arg0 = x, arg1 = 5)) { // BLOCK
val <unary>: Int = x
x = <unary>.inc()
<unary>
}
while (less(arg0 = x, arg1 = 10)) { // BLOCK
{ // BLOCK
val <unary>: Int = x
x = <unary>.inc()
<unary>
}
}
{ // BLOCK
do while (less(arg0 = x, arg1 = 0))
}
{ // BLOCK
do// COMPOSITE {
// } while (less(arg0 = x, arg1 = 7))
}
{ // BLOCK
do{ // BLOCK
val <unary>: Int = x
x = <unary>.inc()
<unary>
} while (less(arg0 = x, arg1 = 15))
}
{ // BLOCK
do// COMPOSITE {
{ // BLOCK
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 */)
}
}
}
}