Fix 'infix call' diagnostic for in operation
#KT-8845 Fixed
This commit is contained in:
@@ -215,18 +215,22 @@ class QuickFixRegistrar : QuickFixContributor {
|
||||
UNSAFE_CALL.registerFactory(SurroundWithNullCheckFix)
|
||||
UNSAFE_IMPLICIT_INVOKE_CALL.registerFactory(SurroundWithNullCheckFix)
|
||||
UNSAFE_INFIX_CALL.registerFactory(SurroundWithNullCheckFix)
|
||||
UNSAFE_OPERATOR_CALL.registerFactory(SurroundWithNullCheckFix)
|
||||
ITERATOR_ON_NULLABLE.registerFactory(SurroundWithNullCheckFix.IteratorOnNullableFactory)
|
||||
TYPE_MISMATCH.registerFactory(SurroundWithNullCheckFix.TypeMismatchFactory)
|
||||
|
||||
UNSAFE_CALL.registerFactory(WrapWithSafeLetCallFix.UnsafeFactory)
|
||||
UNSAFE_IMPLICIT_INVOKE_CALL.registerFactory(WrapWithSafeLetCallFix.UnsafeFactory)
|
||||
UNSAFE_INFIX_CALL.registerFactory(WrapWithSafeLetCallFix.UnsafeFactory)
|
||||
UNSAFE_OPERATOR_CALL.registerFactory(WrapWithSafeLetCallFix.UnsafeFactory)
|
||||
TYPE_MISMATCH.registerFactory(WrapWithSafeLetCallFix.TypeMismatchFactory)
|
||||
|
||||
UNSAFE_CALL.registerFactory(AddExclExclCallFix)
|
||||
UNSAFE_INFIX_CALL.registerFactory(AddExclExclCallFix)
|
||||
UNSAFE_OPERATOR_CALL.registerFactory(AddExclExclCallFix)
|
||||
UNNECESSARY_NOT_NULL_ASSERTION.registerFactory(RemoveExclExclCallFix)
|
||||
UNSAFE_INFIX_CALL.registerFactory(ReplaceInfixOrOperatorCallFix)
|
||||
UNSAFE_OPERATOR_CALL.registerFactory(ReplaceInfixOrOperatorCallFix)
|
||||
UNSAFE_CALL.registerFactory(ReplaceInfixOrOperatorCallFix) // [] only
|
||||
UNSAFE_IMPLICIT_INVOKE_CALL.registerFactory(ReplaceInfixOrOperatorCallFix)
|
||||
UNSAFE_CALL.registerFactory(ReplaceWithSafeCallForScopeFunctionFix)
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fun call() {
|
||||
val list : String? = "sdfknsdkfm"
|
||||
"x" <error descr="[UNSAFE_OPERATOR_CALL] Operator call corresponds to a dot-qualified call 'list.contains(\"x\")' which is not allowed on a nullable receiver 'list'.">in</error> list
|
||||
|
||||
"x" <error descr="[UNSAFE_OPERATOR_CALL] Operator call corresponds to a dot-qualified call 'list.contains(\"x\")' which is not allowed on a nullable receiver 'list'.">!in</error> list
|
||||
}
|
||||
|
||||
<error>operator</error> fun CharSequence.contains(<warning>other</warning>: CharSequence, <warning>ignoreCase</warning>: Boolean = false): Boolean = true
|
||||
@@ -977,4 +977,19 @@ public class PsiCheckerTestGenerated extends AbstractPsiCheckerTest {
|
||||
doTestWithInfos(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/checker/diagnosticsMessage")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class DiagnosticsMessage extends AbstractPsiCheckerTest {
|
||||
public void testAllFilesPresentInDiagnosticsMessage() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/checker/diagnosticsMessage"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("operatorCallDiagnosticsOnInOperator.kt")
|
||||
public void testOperatorCallDiagnosticsOnInOperator() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/checker/diagnosticsMessage/operatorCallDiagnosticsOnInOperator.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user