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:
committed by
Nikolay Krasko
parent
40d810ce60
commit
7510ff4864
+31
@@ -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
|
||||
Reference in New Issue
Block a user