Fix the problem with code completion of type extension method
KT-23834 Fixed
This commit is contained in:
committed by
Alexander Podkhalyuzin
parent
9ff8c93529
commit
fd3fe52eb4
@@ -246,6 +246,15 @@ class ShadowedDeclarationsFilter(
|
|||||||
if (p1.varargElementType != p2.varargElementType) return false // both should be vararg or or both not
|
if (p1.varargElementType != p2.varargElementType) return false // both should be vararg or or both not
|
||||||
if (p1.type != p2.type) return false
|
if (p1.type != p2.type) return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val typeParameters1 = function.typeParameters
|
||||||
|
val typeParameters2 = other.function.typeParameters
|
||||||
|
if (typeParameters1.size != typeParameters2.size) return false
|
||||||
|
for (i in typeParameters1.indices) {
|
||||||
|
val t1 = typeParameters1[i]
|
||||||
|
val t2 = typeParameters2[i]
|
||||||
|
if (t1.upperBounds != t2.upperBounds) return false
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
class Shadow {
|
||||||
|
fun shade() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <X> Shadow.shade() {}
|
||||||
|
|
||||||
|
fun context() {
|
||||||
|
Shadow().sha<caret>
|
||||||
|
}
|
||||||
|
|
||||||
|
// EXIST: { lookupString: "shade", itemText: "shade", tailText: "()", typeText: "Unit" }
|
||||||
|
// EXIST: { lookupString: "shade", itemText: "shade", tailText: "() for Shadow in <root>", typeText: "Unit" }
|
||||||
|
// NOTHING_ELSE
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
fun <T, S> List<T>.xxx(t: T){}
|
||||||
|
fun <T, W> Iterable<T>.xxx(t: T){}
|
||||||
|
|
||||||
|
fun foo() {
|
||||||
|
listOf(1).xx<caret>
|
||||||
|
}
|
||||||
|
|
||||||
|
// EXIST: { lookupString: "xxx", itemText: "xxx", tailText: "(t: Int) for List<T> in <root>", typeText: "Unit" }
|
||||||
|
// NOTHING_ELSE
|
||||||
+10
@@ -2110,6 +2110,11 @@ public class JSBasicCompletionTestGenerated extends AbstractJSBasicCompletionTes
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/basic/common/shadowing"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/basic/common/shadowing"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("ExtensionShadows.kt")
|
||||||
|
public void testExtensionShadows() throws Exception {
|
||||||
|
runTest("idea/idea-completion/testData/basic/common/shadowing/ExtensionShadows.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("InInitializer1.kt")
|
@TestMetadata("InInitializer1.kt")
|
||||||
public void testInInitializer1() throws Exception {
|
public void testInInitializer1() throws Exception {
|
||||||
runTest("idea/idea-completion/testData/basic/common/shadowing/InInitializer1.kt");
|
runTest("idea/idea-completion/testData/basic/common/shadowing/InInitializer1.kt");
|
||||||
@@ -2200,6 +2205,11 @@ public class JSBasicCompletionTestGenerated extends AbstractJSBasicCompletionTes
|
|||||||
runTest("idea/idea-completion/testData/basic/common/shadowing/PreferMoreSpecificExtensionGeneric.kt");
|
runTest("idea/idea-completion/testData/basic/common/shadowing/PreferMoreSpecificExtensionGeneric.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("PreferMoreSpecificExtensionGenericWithMultipleParam.kt")
|
||||||
|
public void testPreferMoreSpecificExtensionGenericWithMultipleParam() throws Exception {
|
||||||
|
runTest("idea/idea-completion/testData/basic/common/shadowing/PreferMoreSpecificExtensionGenericWithMultipleParam.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("PreferMoreSpecificExtensionGenericWithParam.kt")
|
@TestMetadata("PreferMoreSpecificExtensionGenericWithParam.kt")
|
||||||
public void testPreferMoreSpecificExtensionGenericWithParam() throws Exception {
|
public void testPreferMoreSpecificExtensionGenericWithParam() throws Exception {
|
||||||
runTest("idea/idea-completion/testData/basic/common/shadowing/PreferMoreSpecificExtensionGenericWithParam.kt");
|
runTest("idea/idea-completion/testData/basic/common/shadowing/PreferMoreSpecificExtensionGenericWithParam.kt");
|
||||||
|
|||||||
+10
@@ -2110,6 +2110,11 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/basic/common/shadowing"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/basic/common/shadowing"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("ExtensionShadows.kt")
|
||||||
|
public void testExtensionShadows() throws Exception {
|
||||||
|
runTest("idea/idea-completion/testData/basic/common/shadowing/ExtensionShadows.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("InInitializer1.kt")
|
@TestMetadata("InInitializer1.kt")
|
||||||
public void testInInitializer1() throws Exception {
|
public void testInInitializer1() throws Exception {
|
||||||
runTest("idea/idea-completion/testData/basic/common/shadowing/InInitializer1.kt");
|
runTest("idea/idea-completion/testData/basic/common/shadowing/InInitializer1.kt");
|
||||||
@@ -2200,6 +2205,11 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT
|
|||||||
runTest("idea/idea-completion/testData/basic/common/shadowing/PreferMoreSpecificExtensionGeneric.kt");
|
runTest("idea/idea-completion/testData/basic/common/shadowing/PreferMoreSpecificExtensionGeneric.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("PreferMoreSpecificExtensionGenericWithMultipleParam.kt")
|
||||||
|
public void testPreferMoreSpecificExtensionGenericWithMultipleParam() throws Exception {
|
||||||
|
runTest("idea/idea-completion/testData/basic/common/shadowing/PreferMoreSpecificExtensionGenericWithMultipleParam.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("PreferMoreSpecificExtensionGenericWithParam.kt")
|
@TestMetadata("PreferMoreSpecificExtensionGenericWithParam.kt")
|
||||||
public void testPreferMoreSpecificExtensionGenericWithParam() throws Exception {
|
public void testPreferMoreSpecificExtensionGenericWithParam() throws Exception {
|
||||||
runTest("idea/idea-completion/testData/basic/common/shadowing/PreferMoreSpecificExtensionGenericWithParam.kt");
|
runTest("idea/idea-completion/testData/basic/common/shadowing/PreferMoreSpecificExtensionGenericWithParam.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user