Shorten References: Fix removal of explicit companion references in the position of callee expression
#KT-10102
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<selection>fun foo(): Factory = Factory.Companion { k -> IntPredicate { n -> n % k == 0 } }</selection>
|
||||
@@ -0,0 +1,11 @@
|
||||
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 } }
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
class T {
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<selection>fun foo(): T.Factory = T.Factory.Companion { k -> IntPredicate { n -> n % k == 0 } }</selection>
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
class T {
|
||||
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(): T.Factory = T.Factory { k -> IntPredicate { n -> n % k == 0 } }
|
||||
Reference in New Issue
Block a user