Call chain into sequence: fix false negative on Iterable

#KT-26650 Fixed
This commit is contained in:
Toshiaki Kameyama
2018-09-10 12:35:05 +03:00
committed by Mikhail Glukhikh
parent 2e5ee242c7
commit 9a725b99b2
8 changed files with 48 additions and 15 deletions
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(i: Iterable<Int>): List<Int> {
return i.<caret>filter { it > 1 }.map { it * 2 }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(i: Iterable<Int>): List<Int> {
return i.asSequence().filter { it > 1 }.map { it * 2 }.toList()
}
@@ -0,0 +1,9 @@
// WITH_RUNTIME
class A<T>(private val list: List<T>) : Iterable<T> {
override fun iterator(): Iterator<T> = list.iterator()
}
fun test(i: A<Int>): List<Int> {
return i.<caret>filter { it > 1 }.map { it * 2 }
}
@@ -0,0 +1,9 @@
// WITH_RUNTIME
class A<T>(private val list: List<T>) : Iterable<T> {
override fun iterator(): Iterator<T> = list.iterator()
}
fun test(i: A<Int>): List<Int> {
return i.asSequence().filter { it > 1 }.map { it * 2 }.toList()
}