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()
if (!constraintSystem.getStatus().hasContradiction()) {
// currently ConstraintSystem return successful status in case there are problems with nullability
// that's why we have to check subtyping manually
val substitutor = constraintSystem.getResultingSubstitutor()
val substitutedType = substitutor.substitute(type, Variance.INVARIANT)
val otherSubstitutedType = substitutor.substitute(otherType.type, Variance.INVARIANT)
return if (substitutedType != null && otherSubstitutedType != null && substitutedType.checkInheritance(otherSubstitutedType))
constraintSystem.getPartialSubstitutor()
else
null
}
else {
return null
}
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
val substitutor = constraintSystem.getResultingSubstitutor()
val substitutedType = substitutor.substitute(type, Variance.INVARIANT) ?: return null
if (substitutedType.isError) return null
val otherSubstitutedType = substitutor.substitute(otherType.type, Variance.INVARIANT) ?: return null
if (otherSubstitutedType.isError) return null
return if (substitutedType.checkInheritance(otherSubstitutedType)) constraintSystem.getPartialSubstitutor() else 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);
}
@TestMetadata("NoAssertFailsWith.kt")
public void testNoAssertFailsWith() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/smart/NoAssertFailsWith.kt");
doTest(fileName);
}
@TestMetadata("NoExtensionMethodFromClassObject.kt")
public void testNoExtensionMethodFromClassObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/smart/NoExtensionMethodFromClassObject.kt");