KT-13780 No completion and assertion error in log

#KT-13780 Fixed
This commit is contained in:
Valentin Kipyatkov
2016-10-07 17:52:29 +03:00
parent 09a3741eb9
commit 7b12dd498f
20 changed files with 94 additions and 24 deletions
@@ -153,7 +153,7 @@ class LookupElementFactory(
//TODO: order for them
val fuzzyParameterType = parameterType.toFuzzyType(descriptor.typeParameters)
for ((variable, substitutor) in contextVariablesProvider.functionTypeVariables(fuzzyParameterType)) {
val substitutedDescriptor = descriptor.substitute(substitutor)
val substitutedDescriptor = descriptor.substitute(substitutor) ?: continue
add(createFunctionCallElementWithArguments(substitutedDescriptor, variable.name.render(), useReceiverTypes))
}
}
@@ -210,7 +210,7 @@ class TypeInstantiationItems(
1 -> {
val constructor = visibleConstructors.single()
val substitutor = TypeSubstitutor.create(fuzzyType.presentationType())
val substitutedConstructor = constructor.substitute(substitutor)
val substitutedConstructor = constructor.substitute(substitutor) ?: constructor // render original signature if failed to substitute
BasicLookupElementFactory.SHORT_NAMES_RENDERER.renderFunctionParameters(substitutedConstructor)
}
+9
View File
@@ -0,0 +1,9 @@
class ResolvedCall<out D>(val candidateDescriptor: D)
fun test(myResolvedCall: ResolvedCall<String>) {
bar(my<caret>)
}
fun bar(foo: ResolvedCall<*>) {}
// EXIST: myResolvedCall
@@ -0,0 +1,9 @@
class ResolvedCall<out D>(val candidateDescriptor: D)
fun test(myResolvedCall: ResolvedCall<Any>) {
bar(my<caret>)
}
fun bar(foo: ResolvedCall<out CharSequence>) {}
// EXIST: myResolvedCall
@@ -0,0 +1,9 @@
class X<D>()
fun test() {
bar(<caret>)
}
fun bar(foo: X<*>) {}
// EXIST: { lookupString:"X", itemText:"X", tailText:"() (<root>)" }
@@ -0,0 +1,9 @@
class X<D>(d: D)
fun test() {
bar(<caret>)
}
fun bar(foo: X<*>) {}
// EXIST: { lookupString:"X", itemText:"X", tailText:"(d: D) (<root>)" }
@@ -493,6 +493,18 @@ public class JSBasicCompletionTestGenerated extends AbstractJSBasicCompletionTes
doTest(fileName);
}
@TestMetadata("KT13780.kt")
public void testKT13780() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/KT13780.kt");
doTest(fileName);
}
@TestMetadata("KT13780_1.kt")
public void testKT13780_1() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/KT13780_1.kt");
doTest(fileName);
}
@TestMetadata("LocalMultideclarationValues.kt")
public void testLocalMultideclarationValues() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/LocalMultideclarationValues.kt");
@@ -493,6 +493,18 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT
doTest(fileName);
}
@TestMetadata("KT13780.kt")
public void testKT13780() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/KT13780.kt");
doTest(fileName);
}
@TestMetadata("KT13780_1.kt")
public void testKT13780_1() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/KT13780_1.kt");
doTest(fileName);
}
@TestMetadata("LocalMultideclarationValues.kt")
public void testLocalMultideclarationValues() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/LocalMultideclarationValues.kt");
@@ -874,6 +874,18 @@ public class JvmSmartCompletionTestGenerated extends AbstractJvmSmartCompletionT
doTest(fileName);
}
@TestMetadata("StarProjection1.kt")
public void testStarProjection1() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/smart/constructor/StarProjection1.kt");
doTest(fileName);
}
@TestMetadata("StarProjection2.kt")
public void testStarProjection2() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/smart/constructor/StarProjection2.kt");
doTest(fileName);
}
@TestMetadata("WithParameters.kt")
public void testWithParameters() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/smart/constructor/WithParameters.kt");