ForLoopsLowering: Handle Iterable.withIndex() where the type is a
bounded type parameter. TODO: Handle Sequences by extending DefaultIterableHandler.
This commit is contained in:
committed by
max-kammerer
parent
e8252ea874
commit
1a2e09e6a5
+20
@@ -0,0 +1,20 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
// WITH_RUNTIME
|
||||
|
||||
val xs = listOf("a", "b", "c", "d")
|
||||
|
||||
fun <T : Iterable<*>> test(iterable: T): String {
|
||||
val s = StringBuilder()
|
||||
|
||||
for ((index, x) in iterable.withIndex()) {
|
||||
s.append("$index:$x;")
|
||||
}
|
||||
|
||||
return s.toString()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val ss = test(xs)
|
||||
return if (ss == "0:a;1:b;2:c;3:d;") "OK" else "fail: '$ss'"
|
||||
}
|
||||
Reference in New Issue
Block a user