Check current behaviour of stepping over inline 'hasNext' and 'next' in for

(cherry picked from commit 008e574)

 #KT-14296 Open
This commit is contained in:
Nikolay Krasko
2016-10-11 17:35:26 +03:00
committed by Nikolay Krasko
parent 40d810ce60
commit 7510ff4864
3 changed files with 59 additions and 0 deletions
@@ -0,0 +1,31 @@
package soInlineOperatorIterator
// TODO: Test with current bad behaviour of KT-14296
fun main(args: Array<String>) {
//Breakpoint!
val list = listOf("a", "b", "c")
for (element in Some(list)) { // No inlining visible on this string
nonInline(element)
}
}
fun <T> nonInline(p: T): T = p
class Some<T>(val list: List<T>) {
operator fun iterator() = SomeIterator(list)
}
class SomeIterator<T>(list: List<T>) {
val iterator = list.iterator()
inline operator fun hasNext() : Boolean {
return iterator.hasNext()
}
inline operator fun next(): T {
return iterator.next()
}
}
// STEP_OVER: 15