KT-14341 for to stdlib to forEach: if the loop variable is not used in the last/innerest statement the conversion is not proposed
#KT-14341 Fixed
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'filter{}.forEach{}'"
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.forEach{}'"
|
||||
fun foo(list: List<Int>){
|
||||
<caret>for (any in list) {
|
||||
if (any > 0)
|
||||
println("positive number")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'filter{}.forEach{}'"
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.forEach{}'"
|
||||
fun foo(list: List<Int>){
|
||||
list
|
||||
.filter { it > 0 }
|
||||
.forEach { println("positive number") }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'filter{}.forEach{}'"
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.forEach{}'"
|
||||
fun foo(list: List<Int>){
|
||||
list
|
||||
.asSequence()
|
||||
.filter { it > 0 }
|
||||
.forEach { println("positive number") }
|
||||
}
|
||||
Reference in New Issue
Block a user