Fix wrong unnecessary completion for the case of force completion

#KT-1187 Fixed
This commit is contained in:
Nikolay Krasko
2013-07-04 16:36:51 +04:00
parent 86274466c5
commit f0a10b70c1
5 changed files with 21 additions and 1 deletions
@@ -45,6 +45,7 @@ import org.jetbrains.jet.lang.resolve.lazy.ResolveSessionUtils;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
import org.jetbrains.jet.lang.types.ErrorUtils;
import org.jetbrains.jet.lang.types.JetType;
import org.jetbrains.jet.lang.types.expressions.ExpressionTypingUtils;
import org.jetbrains.jet.plugin.caches.resolve.IDELightClassGenerationSupport;
@@ -308,7 +309,7 @@ public class JetShortNamesCache extends PsiShortNamesCache {
JetType expressionType = context.get(BindingContext.EXPRESSION_TYPE, receiverExpression);
JetScope scope = context.get(BindingContext.RESOLUTION_SCOPE, receiverExpression);
if (expressionType != null && scope != null) {
if (expressionType != null && scope != null && !ErrorUtils.isErrorType(expressionType)) {
Collection<String> extensionFunctionsNames = getAllJetExtensionFunctionsNames(searchScope);
Set<FqName> functionFQNs = new java.util.HashSet<FqName>();
@@ -4,4 +4,5 @@ fun anyfun() {
a.b.c.d.e.f.<caret>
}
// TIME: 1
// NUMBER: 0
@@ -0,0 +1,8 @@
/// KT-1187 Wrong unnecessary completion
fun anyfun() {
a.b.c.d.e.f.<caret>
}
// TIME: 2
// NUMBER: 0
@@ -104,6 +104,11 @@ public class JetBasicJSCompletionTestGenerated extends AbstractJetJSCompletionTe
doTest("idea/testData/completion/basic/common/DoNotCompleteForErrorReceivers.kt");
}
@TestMetadata("DoNotCompleteForErrorReceiversForce.kt")
public void testDoNotCompleteForErrorReceiversForce() throws Exception {
doTest("idea/testData/completion/basic/common/DoNotCompleteForErrorReceiversForce.kt");
}
@TestMetadata("ExtendClassName.kt")
public void testExtendClassName() throws Exception {
doTest("idea/testData/completion/basic/common/ExtendClassName.kt");
@@ -104,6 +104,11 @@ public class JetBasicJavaCompletionTestGenerated extends AbstractJavaCompletionT
doTest("idea/testData/completion/basic/common/DoNotCompleteForErrorReceivers.kt");
}
@TestMetadata("DoNotCompleteForErrorReceiversForce.kt")
public void testDoNotCompleteForErrorReceiversForce() throws Exception {
doTest("idea/testData/completion/basic/common/DoNotCompleteForErrorReceiversForce.kt");
}
@TestMetadata("ExtendClassName.kt")
public void testExtendClassName() throws Exception {
doTest("idea/testData/completion/basic/common/ExtendClassName.kt");