Extract Function: Support extraction of "it" parameter from lambdas
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
// PARAM_TYPES: kotlin.Int
|
||||
fun <T> Array<T>.check(f: (T) -> Boolean): Boolean = false
|
||||
|
||||
// SIBLING:
|
||||
fun foo(t: Array<Array<Int>>) {
|
||||
if (t.check { it.check{ <selection>it + 1</selection> > 1 } }) {
|
||||
println("OK")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// PARAM_TYPES: kotlin.Int
|
||||
fun <T> Array<T>.check(f: (T) -> Boolean): Boolean = false
|
||||
|
||||
// SIBLING:
|
||||
fun foo(t: Array<Array<Int>>) {
|
||||
if (t.check { it.check{ i(it) > 1 } }) {
|
||||
println("OK")
|
||||
}
|
||||
}
|
||||
|
||||
fun i(it: Int): Int {
|
||||
return it + 1
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// PARAM_TYPES: kotlin.Array<kotlin.Int>
|
||||
fun <T> Array<T>.check(f: (T) -> Boolean): Boolean = false
|
||||
|
||||
// SIBLING:
|
||||
fun foo(t: Array<Int>) {
|
||||
if (<selection>t.check { it + 1 > 1 }</selection>) {
|
||||
println("OK")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// PARAM_TYPES: kotlin.Array<kotlin.Int>
|
||||
fun <T> Array<T>.check(f: (T) -> Boolean): Boolean = false
|
||||
|
||||
// SIBLING:
|
||||
fun foo(t: Array<Int>) {
|
||||
if (b(t)) {
|
||||
println("OK")
|
||||
}
|
||||
}
|
||||
|
||||
fun b(t: Array<Int>): Boolean {
|
||||
return t.check { it + 1 > 1 }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// PARAM_TYPES: kotlin.Array<kotlin.Int>
|
||||
fun <T> Array<T>.check(f: (T) -> Boolean): Boolean = false
|
||||
|
||||
// SIBLING:
|
||||
fun foo(t: Array<Array<Int>>) {
|
||||
if (t.check { <selection>it.check{ it + 1 > 1 }</selection> }) {
|
||||
println("OK")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// PARAM_TYPES: kotlin.Array<kotlin.Int>
|
||||
fun <T> Array<T>.check(f: (T) -> Boolean): Boolean = false
|
||||
|
||||
// SIBLING:
|
||||
fun foo(t: Array<Array<Int>>) {
|
||||
if (t.check { b(it) }) {
|
||||
println("OK")
|
||||
}
|
||||
}
|
||||
|
||||
fun b(it: Array<Int>): Boolean {
|
||||
return it.check { it + 1 > 1 }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// PARAM_TYPES: kotlin.Int
|
||||
fun <T> Array<T>.check(f: (T) -> Boolean): Boolean = false
|
||||
|
||||
// SIBLING:
|
||||
fun foo(t: Array<Int>) {
|
||||
if (t.check { <selection>it + 1</selection> > 1 }) {
|
||||
println("OK")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// PARAM_TYPES: kotlin.Int
|
||||
fun <T> Array<T>.check(f: (T) -> Boolean): Boolean = false
|
||||
|
||||
// SIBLING:
|
||||
fun foo(t: Array<Int>) {
|
||||
if (t.check { i(it) > 1 }) {
|
||||
println("OK")
|
||||
}
|
||||
}
|
||||
|
||||
fun i(it: Int): Int {
|
||||
return it + 1
|
||||
}
|
||||
Reference in New Issue
Block a user