ConvertToForEachLoopIntention - renamed

This commit is contained in:
Valentin Kipyatkov
2015-04-16 13:59:27 +03:00
parent a155b0c860
commit a8d629f609
25 changed files with 73 additions and 73 deletions
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.intentions.ConvertForEachToForLoopIntention
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun main() {
val x = 1..4
<caret>x.reverse().forEach { it }
}
@@ -0,0 +1,8 @@
// WITH_RUNTIME
fun main() {
val x = 1..4
for (it in x.reverse()) {
it
}
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val x = 1..4
<caret>x.forEach({ y -> y })
}
@@ -0,0 +1,8 @@
// WITH_RUNTIME
fun foo() {
val x = 1..4
for (y in x) {
y
}
}
@@ -0,0 +1,11 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
class Foo {
fun forEach(predicate: (Int) -> Int, bar: Int): Int = predicate(bar)
}
fun main() {
val x = Foo()
<caret>x.forEach({ it * 2 }, 2)
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val x = 1..4
<caret>x.forEach { it }
}
@@ -0,0 +1,8 @@
// WITH_RUNTIME
fun foo() {
val x = 1..4
for (it in x) {
it
}
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val x = 1..4
<caret>x forEach { a -> a }
}
@@ -0,0 +1,8 @@
// WITH_RUNTIME
fun foo() {
val x = 1..4
for (a in x) {
a
}
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun main() {
<caret>(1 rangeTo 2).forEach { x -> x }
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun main() {
for (x in 1 rangeTo 2) {
x
}
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val x = 1..4
<caret>x.forEach { it.equals(1) }
}
@@ -0,0 +1,8 @@
// WITH_RUNTIME
fun foo() {
val x = 1..4
for (it in x) {
it.equals(1)
}
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val x = 1..4
<caret>x.forEach<Int>({ it })
}
@@ -0,0 +1,8 @@
// WITH_RUNTIME
fun foo() {
val x = 1..4
for (it in x) {
it
}
}
@@ -0,0 +1,11 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
class Foo {
fun forEach(predicate: (Int) -> Int): Int = predicate(0)
}
fun main() {
val x = Foo()
<caret>x.forEach({ it * 2 })
}
@@ -0,0 +1,11 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
class Foo {
fun forEach(): Int = 0
}
fun main() {
val x = Foo()
<caret>x.forEach()
}