JVM_IR KT-29822 KT-48669 loop over unsigned array, indices, withIndex
This commit is contained in:
committed by
TeamCityServer
parent
2cc6b589f3
commit
be28b3c74d
+17
@@ -0,0 +1,17 @@
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: WASM
|
||||
|
||||
fun test(uis: UIntArray): String {
|
||||
var s = ""
|
||||
for (ui in uis) {
|
||||
s += ui
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
|
||||
fun box(): String {
|
||||
val test = test(uintArrayOf(1U, 2U, 3U))
|
||||
if (test != "123") return "Failed: $test"
|
||||
return "OK"
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: WASM
|
||||
|
||||
fun test(uis: UIntArray): String {
|
||||
var s = ""
|
||||
for (i in uis.indices) {
|
||||
s += "$i:${uis[i]};"
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
|
||||
fun box(): String {
|
||||
val test = test(uintArrayOf(1U, 2U, 3U))
|
||||
if (test != "0:1;1:2;2:3;") return "Failed: $test"
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: WASM
|
||||
|
||||
fun test(uis: UIntArray): String {
|
||||
var s = ""
|
||||
for (i in uis.indices.reversed()) {
|
||||
s += "$i:${uis[i]};"
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
|
||||
fun box(): String {
|
||||
val test = test(uintArrayOf(1U, 2U, 3U))
|
||||
if (test != "2:3;1:2;0:1;") return "Failed: $test"
|
||||
return "OK"
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: WASM
|
||||
|
||||
fun test(uis: UIntArray): String {
|
||||
var s = ""
|
||||
for (ui in uis.reversed()) {
|
||||
s += ui
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
|
||||
fun box(): String {
|
||||
val test = test(uintArrayOf(1U, 2U, 3U))
|
||||
if (test != "321") return "Failed: $test"
|
||||
return "OK"
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: WASM
|
||||
|
||||
fun test(uis: UIntArray): String {
|
||||
var s = ""
|
||||
for ((i, ui) in uis.withIndex()) {
|
||||
s += "$i:$ui;"
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
|
||||
fun box(): String {
|
||||
val test = test(uintArrayOf(1U, 2U, 3U))
|
||||
if (test != "0:1;1:2;2:3;") return "Failed: $test"
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: WASM
|
||||
|
||||
fun test(uis: UIntArray): String {
|
||||
var s = ""
|
||||
for ((i, _) in uis.withIndex()) {
|
||||
s += "$i:${uis[i]};"
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
|
||||
fun box(): String {
|
||||
val test = test(uintArrayOf(1U, 2U, 3U))
|
||||
if (test != "0:1;1:2;2:3;") return "Failed: $test"
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: WASM
|
||||
|
||||
fun test(uis: UIntArray): String {
|
||||
var s = ""
|
||||
for ((_, ui) in uis.withIndex()) {
|
||||
s += ui
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
|
||||
fun box(): String {
|
||||
val test = test(uintArrayOf(1U, 2U, 3U))
|
||||
if (test != "123") return "Failed: $test"
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: WASM
|
||||
|
||||
fun test(uis: UIntArray): String {
|
||||
var s = ""
|
||||
for ((i, ui) in uis.withIndex().reversed()) {
|
||||
s += "$i:$ui;"
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
|
||||
fun box(): String {
|
||||
val test = test(uintArrayOf(1U, 2U, 3U))
|
||||
if (test != "2:3;1:2;0:1;") return "Failed: $test"
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user