[FIR2IR] Fix generating body for for-loop
This commit is contained in:
committed by
TeamCityServer
parent
5d78b0a962
commit
d0a148074f
@@ -0,0 +1,34 @@
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// DUMP_IR
|
||||
// WITH_STDLIB
|
||||
|
||||
var result = 0
|
||||
|
||||
fun takeString(s: String) {
|
||||
s.split("\n").forEach {
|
||||
result += it.toIntOrNull() ?: 0
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val x = 10
|
||||
val y = 10
|
||||
|
||||
fun localFunc() {
|
||||
for (i in 0..x) {
|
||||
val s = buildString {
|
||||
for (j in 0..y) {
|
||||
appendLine("${i * j}")
|
||||
}
|
||||
}
|
||||
takeString(s)
|
||||
}
|
||||
}
|
||||
|
||||
localFunc()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
test()
|
||||
return if (result == 3025) "OK" else "Fail: $result"
|
||||
}
|
||||
Reference in New Issue
Block a user