mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-10 15:53:46 +00:00
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
@@ -0,0 +1,16 @@
|
||||
fun <T : Iterable<*>> test(iterable: T): String {
|
||||
val s = StringBuilder()
|
||||
|
||||
for ((index, x) in iterable.withIndex()) {
|
||||
s.append("$index:$x;")
|
||||
}
|
||||
|
||||
return s.toString()
|
||||
}
|
||||
|
||||
// 0 withIndex
|
||||
// 1 iterator
|
||||
// 1 hasNext
|
||||
// 1 next
|
||||
// 0 component1
|
||||
// 0 component2
|
||||
Reference in New Issue
Block a user