JVM_IR KT-47492 fix 'for' loop generation

This commit is contained in:
Dmitry Petrov
2021-06-28 16:21:39 +03:00
committed by TeamCityServer
parent 6993b86d3b
commit 768afc5ba4
11 changed files with 204 additions and 1 deletions
+11
View File
@@ -0,0 +1,11 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WITH_RUNTIME
fun p() {}
fun box(): String {
var sum = 1
for (i: Int? in sum downTo sum.toULong().countTrailingZeroBits())
p()
return "OK"
}
+20
View File
@@ -0,0 +1,20 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WITH_RUNTIME
fun a() = 5
fun b() = 1
fun p() {}
fun box(): String {
when (false) {
else -> {
val h1 = 1
val h2 = 2L
val h3 = 3L
}
}
var sum = 1
for (i: Int? in a() downTo b())
p()
return "OK"
}
+19
View File
@@ -0,0 +1,19 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WITH_RUNTIME
fun a() = 5
fun b() = 1
fun p() {}
fun box(): String {
try {
val h1 = 1
val h2 = 2L
val h3 = 3L
} catch (e: Exception) { throw e }
var sum = 1
for (i: Int? in a() downTo b())
p()
return "OK"
}