Do not show "assertFailsWith" in any smart completion

This commit is contained in:
Valentin Kipyatkov
2015-11-06 15:25:59 +03:00
parent 63b5966212
commit 4c5d5ed18f
3 changed files with 27 additions and 14 deletions
@@ -128,19 +128,15 @@ class FuzzyType(
constraintSystem.fixVariables() constraintSystem.fixVariables()
if (!constraintSystem.getStatus().hasContradiction()) { if (constraintSystem.getStatus().hasContradiction()) return null
// currently ConstraintSystem return successful status in case there are problems with nullability
// that's why we have to check subtyping manually // currently ConstraintSystem return successful status in case there are problems with nullability
val substitutor = constraintSystem.getResultingSubstitutor() // that's why we have to check subtyping manually
val substitutedType = substitutor.substitute(type, Variance.INVARIANT) val substitutor = constraintSystem.getResultingSubstitutor()
val otherSubstitutedType = substitutor.substitute(otherType.type, Variance.INVARIANT) val substitutedType = substitutor.substitute(type, Variance.INVARIANT) ?: return null
return if (substitutedType != null && otherSubstitutedType != null && substitutedType.checkInheritance(otherSubstitutedType)) if (substitutedType.isError) return null
constraintSystem.getPartialSubstitutor() val otherSubstitutedType = substitutor.substitute(otherType.type, Variance.INVARIANT) ?: return null
else if (otherSubstitutedType.isError) return null
null return if (substitutedType.checkInheritance(otherSubstitutedType)) constraintSystem.getPartialSubstitutor() else null
}
else {
return null
}
} }
} }
@@ -0,0 +1,11 @@
import kotlin.test.*
interface I<T>
fun <T> foo(i: I<T>){}
fun bar() {
foo(ass<caret>)
}
// ABSENT: assertFailsWith
@@ -323,6 +323,12 @@ public class JvmSmartCompletionTestGenerated extends AbstractJvmSmartCompletionT
doTest(fileName); doTest(fileName);
} }
@TestMetadata("NoAssertFailsWith.kt")
public void testNoAssertFailsWith() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/smart/NoAssertFailsWith.kt");
doTest(fileName);
}
@TestMetadata("NoExtensionMethodFromClassObject.kt") @TestMetadata("NoExtensionMethodFromClassObject.kt")
public void testNoExtensionMethodFromClassObject() throws Exception { public void testNoExtensionMethodFromClassObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/smart/NoExtensionMethodFromClassObject.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/smart/NoExtensionMethodFromClassObject.kt");