Checking "infix" modifier in completion and import popup
This commit is contained in:
@@ -57,9 +57,8 @@ public sealed class CallType<TReceiver : JetElement?>(val descriptorKindFilter:
|
|||||||
object TYPE : CallType<JetExpression?>(DescriptorKindFilter(DescriptorKindFilter.CLASSIFIERS_MASK or DescriptorKindFilter.PACKAGES_MASK))
|
object TYPE : CallType<JetExpression?>(DescriptorKindFilter(DescriptorKindFilter.CLASSIFIERS_MASK or DescriptorKindFilter.PACKAGES_MASK))
|
||||||
|
|
||||||
private object NonInfixExclude : DescriptorKindExclude() {
|
private object NonInfixExclude : DescriptorKindExclude() {
|
||||||
//TODO: check 'infix' modifier
|
|
||||||
override fun excludes(descriptor: DeclarationDescriptor) =
|
override fun excludes(descriptor: DeclarationDescriptor) =
|
||||||
!(descriptor is SimpleFunctionDescriptor && descriptor.valueParameters.size() == 1)
|
!(descriptor is SimpleFunctionDescriptor && descriptor.isInfix)
|
||||||
|
|
||||||
override val fullyExcludedDescriptorKinds: Int
|
override val fullyExcludedDescriptorKinds: Int
|
||||||
get() = 0
|
get() = 0
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
fun Int.func(s: String): Int{}
|
infix fun Int.func(s: String): Int{}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val floor = "Floor"
|
val floor = "Floor"
|
||||||
|
|||||||
+6
-6
@@ -1,18 +1,18 @@
|
|||||||
class C {
|
class C {
|
||||||
fun foo(){}
|
fun foo(p: Int){}
|
||||||
fun bar(p: Int) {}
|
infix fun bar(p: Int) {}
|
||||||
fun zoo(p1: Int, p2: Int){}
|
fun zoo(p1: Int, p2: Int){}
|
||||||
val prop: Int = 1
|
val prop: Int = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
fun C.xxx() {}
|
fun C.xxx(p: Int) {}
|
||||||
fun C.yyy(p: Int) {}
|
infix fun C.yyy(p: Int) {}
|
||||||
fun C.zzz(p1: Int, p2: Int) {}
|
fun C.zzz(p1: Int, p2: Int) {}
|
||||||
val C.extensionProp: Int get() = 1
|
val C.extensionProp: Int get() = 1
|
||||||
|
|
||||||
fun <A, B> A.and(that: B): Pair<A, B> = Pair(this, that)
|
infix fun <A, B> A.and(that: B): Pair<A, B> = Pair(this, that)
|
||||||
|
|
||||||
fun String.ttt(p: Int) {}
|
infix fun String.ttt(p: Int) {}
|
||||||
|
|
||||||
fun f() {
|
fun f() {
|
||||||
C() <caret>
|
C() <caret>
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
// checks that no special item "ext1 { String, Int -> ... }" created for infix call
|
// checks that no special item "ext1 { String, Int -> ... }" created for infix call
|
||||||
fun Int.ext1(handler: (String, Int) -> Unit){}
|
infix fun Int.ext1(handler: (String, Int) -> Unit){}
|
||||||
fun Int.ext2(c: Char){}
|
infix fun Int.ext2(c: Char){}
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
val pair = 1 ext<caret>
|
val pair = 1 ext<caret>
|
||||||
|
|||||||
+1
-1
@@ -2,4 +2,4 @@ package dependency
|
|||||||
|
|
||||||
class MyPair<A, B>(public val first: A, public val second: B)
|
class MyPair<A, B>(public val first: A, public val second: B)
|
||||||
|
|
||||||
public fun <A, B> A.pair(that: B): MyPair<A, B> = MyPair(this, that)
|
infix fun <A, B> A.pair(that: B): MyPair<A, B> = MyPair(this, that)
|
||||||
|
|||||||
+2
-2
@@ -2,8 +2,8 @@ package other
|
|||||||
|
|
||||||
import pack.C
|
import pack.C
|
||||||
|
|
||||||
fun C.xxx() {}
|
fun C.xxx(p: Int) {}
|
||||||
fun C.yyy(p: Int) {}
|
infix fun C.yyy(p: Int) {}
|
||||||
fun C.zzz(p1: Int, p2: Int) {}
|
fun C.zzz(p1: Int, p2: Int) {}
|
||||||
val C.extensionProp: Int get() = 1
|
val C.extensionProp: Int get() = 1
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
fun <A, B> A.to(that: B): Pair<A, B> = Pair(this, that)
|
infix fun <A, B> A.to(that: B): Pair<A, B> = Pair(this, that)
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
val pair = 1 to<caret>
|
val pair = 1 to<caret>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
fun <A, B> A.to(that: B): Pair<A, B> = Pair(this, that)
|
infix fun <A, B> A.to(that: B): Pair<A, B> = Pair(this, that)
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
val pair = 1 to <caret>
|
val pair = 1 to <caret>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
fun <A, B> A.to(that: B): Pair<A, B> = Pair(this, that)
|
infix fun <A, B> A.to(that: B): Pair<A, B> = Pair(this, that)
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
val pair = 1 to<caret>
|
val pair = 1 to<caret>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
fun <A, B> A.to(that: B): Pair<A, B> = Pair(this, that)
|
infix fun <A, B> A.to(that: B): Pair<A, B> = Pair(this, that)
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
val pair = 1 to <caret>
|
val pair = 1 to <caret>
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
package other
|
package other
|
||||||
|
|
||||||
fun <A, B> A.makePair(that: B): Pair<A, B> = Pair(this, that)
|
infix fun <A, B> A.makePair(that: B): Pair<A, B> = Pair(this, that)
|
||||||
|
|||||||
+4
-4
@@ -1,11 +1,11 @@
|
|||||||
class X {
|
class X {
|
||||||
fun foo(i: Int) = ""
|
infix fun foo(i: Int) = ""
|
||||||
fun bar() = ""
|
fun bar(i: Int) = ""
|
||||||
val prop: String = ""
|
val prop: String = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
fun X.ext1(s: String) = ""
|
infix fun X.ext1(s: String) = ""
|
||||||
fun X.ext2() = ""
|
fun X.ext2(p: Int) = ""
|
||||||
fun X.extProp: String get() = ""
|
fun X.extProp: String get() = ""
|
||||||
|
|
||||||
val s: String = X() <caret>
|
val s: String = X() <caret>
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
package util
|
package util
|
||||||
|
|
||||||
fun h.H.foo(other: h.H) = ""
|
infix fun h.H.foo(other: h.H) = ""
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
package util
|
||||||
|
|
||||||
|
fun h.H.foo(other: h.H) = ""
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// "Import" "false"
|
||||||
|
// ERROR: Unresolved reference: foo
|
||||||
|
// ACTION: Create extension function 'foo'
|
||||||
|
// ACTION: Create extension property 'foo'
|
||||||
|
// ACTION: Create local variable 'foo'
|
||||||
|
// ACTION: Create member function 'foo'
|
||||||
|
// ACTION: Create member property 'foo'
|
||||||
|
// ACTION: Create parameter 'foo'
|
||||||
|
// ACTION: Replace infix call with ordinary call
|
||||||
|
|
||||||
|
package h
|
||||||
|
|
||||||
|
interface H
|
||||||
|
|
||||||
|
fun f(h: H) {
|
||||||
|
h <caret>foo h
|
||||||
|
}
|
||||||
@@ -149,6 +149,12 @@ public class QuickFixMultiFileTestGenerated extends AbstractQuickFixMultiFileTes
|
|||||||
doTestWithExtraFile(fileName);
|
doTestWithExtraFile(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("infixCall2.before.Main.kt")
|
||||||
|
public void testInfixCall2() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/infixCall2.before.Main.kt");
|
||||||
|
doTestWithExtraFile(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("minusOperator.before.Main.kt")
|
@TestMetadata("minusOperator.before.Main.kt")
|
||||||
public void testMinusOperator() throws Exception {
|
public void testMinusOperator() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/minusOperator.before.Main.kt");
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/minusOperator.before.Main.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user