Shorten References: Fix removal of explicit companion references in the position of callee expression

#KT-10102
This commit is contained in:
Alexey Sedunov
2015-11-27 16:04:53 +03:00
parent 2dcc38b92f
commit 44bc937499
12 changed files with 131 additions and 1 deletions
@@ -0,0 +1,17 @@
package b
import java.util.function.IntPredicate
interface Factory {
operator fun invoke(i: Int): IntPredicate
companion object {
inline operator fun invoke(crossinline f: (Int) -> IntPredicate) = object : Factory {
override fun invoke(i: Int) = f(i)
}
}
}
fun foo(): Factory = Factory { k ->
IntPredicate { n -> n % k == 0 }
}
@@ -0,0 +1,4 @@
package b
import java.util.function.IntPredicate
@@ -0,0 +1,13 @@
package b
import java.util.function.IntPredicate
interface Factory {
operator fun invoke(i: Int): IntPredicate
companion object {
inline operator fun invoke(crossinline f: (Int) -> IntPredicate) = object : Factory {
override fun invoke(i: Int) = f(i)
}
}
}
@@ -0,0 +1,7 @@
package b
import java.util.function.IntPredicate
fun <caret>foo(): Factory = Factory { k ->
IntPredicate { n -> n % k == 0 }
}
@@ -0,0 +1,5 @@
{
"mainFile": "b/foo.kt",
"type": "MOVE_KOTLIN_TOP_LEVEL_DECLARATIONS",
"targetFile": "b/boo.kt"
}