More correct checking of forEach requiring asSequence()

This commit is contained in:
Valentin Kipyatkov
2016-10-15 23:42:35 +03:00
parent a87ca8432e
commit 53220b980e
4 changed files with 25 additions and 17 deletions
@@ -1,5 +1,5 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filter{}.forEach{}'"
// IS_APPLICABLE: false
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.forEach{}'"
fun foo(list: List<String>): Int {
var count = 0
@@ -1,10 +0,0 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filter{}.forEach{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.forEach{}'"
fun foo(list: List<String>): Int {
var count = 0
list
.filter { it.length > count }
.forEach { count++ }
return count
}
@@ -1,5 +1,5 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filter{}.forEach{}'"
// IS_APPLICABLE: false
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.forEach{}'"
fun foo(list: List<String>): Int {
var count = 0