[FIR2IR] Fix generating body for for-loop

This commit is contained in:
Dmitriy Novozhilov
2021-03-29 14:12:22 +03:00
committed by TeamCityServer
parent 5d78b0a962
commit d0a148074f
19 changed files with 493 additions and 154 deletions
@@ -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"
}