Extract Function: Fix call replacement for the case of lambda extraction

This commit is contained in:
Alexey Sedunov
2014-06-19 16:17:57 +04:00
parent a3f215fb34
commit e5ce5b7127
8 changed files with 86 additions and 1 deletions
@@ -0,0 +1,6 @@
fun <T> Array<T>.check(f: (T) -> Boolean): Boolean = false
// SIBLING:
fun foo(t: Array<Int>) {
t.check() <selection>{ it + 1 > 1 }</selection>
}
@@ -0,0 +1,10 @@
fun <T> Array<T>.check(f: (T) -> Boolean): Boolean = false
// SIBLING:
fun foo(t: Array<Int>) {
t.check(function())
}
fun function(): (Int) -> Boolean {
return { it + 1 > 1 }
}
@@ -0,0 +1,6 @@
fun <T> Array<T>.check(f: (T) -> Boolean): Boolean = false
// SIBLING:
fun foo(t: Array<Int>) {
t.check <selection>{ it + 1 > 1 }</selection>
}
@@ -0,0 +1,10 @@
fun <T> Array<T>.check(f: (T) -> Boolean): Boolean = false
// SIBLING:
fun foo(t: Array<Int>) {
t.check(function())
}
fun function(): (Int) -> Boolean {
return { it + 1 > 1 }
}
@@ -0,0 +1,6 @@
fun <T> Array<T>.check(a: Int, b: Int f: (T) -> Boolean): Boolean = false
// SIBLING:
fun foo(t: Array<Int>) {
t.check(1, 2) <selection>{ it + 1 > 1 }</selection>
}
@@ -0,0 +1,10 @@
fun <T> Array<T>.check(a: Int, b: Int f: (T) -> Boolean): Boolean = false
// SIBLING:
fun foo(t: Array<Int>) {
t.check(1, 2, function())
}
fun function(): (Int) -> Boolean {
return { it + 1 > 1 }
}