RedundantRequireNotNullCallInspection: should use BodyResolveMode.PARTIAL_WITH_CFA instead of BodyResolveMode.PARTIAL

#KT-34672 Fixed
This commit is contained in:
Dmitry Gridin
2019-10-31 17:35:14 +07:00
parent 04c8c888ee
commit f641e2a139
5 changed files with 1 additions and 19 deletions
@@ -71,7 +71,7 @@ private class RemoveRequireNotNullCallFix(private val functionName: String) : Lo
val callExpression = descriptor.psiElement.getStrictParentOfType<KtCallExpression>() ?: return
val argument = callExpression.valueArguments.firstOrNull()?.getArgumentExpression() ?: return
val target = callExpression.getQualifiedExpressionForSelector() ?: callExpression
if (callExpression.isUsedAsExpression(callExpression.analyze(BodyResolveMode.PARTIAL))) {
if (callExpression.isUsedAsExpression(callExpression.analyze(BodyResolveMode.PARTIAL_WITH_CFA))) {
target.replace(argument)
} else {
target.delete()
@@ -1,5 +0,0 @@
Actual data differs from file content: usedAsExpression.kt.after expected:<...: Int) {
val a =[ i]
}> but was:<...: Int) {
val a =[]
}>
@@ -1,5 +0,0 @@
Actual data differs from file content: usedAsExpression2.kt.after expected:<... Int) {
println([i])
}> but was:<... Int) {
println([])
}>
@@ -1,5 +0,0 @@
Actual data differs from file content: usedAsExpression3.kt.after expected:<...st(i: Int) {
"${[i]}"
}> but was:<...st(i: Int) {
"${[]}"
}>
-3
View File
@@ -16,9 +16,6 @@ org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.t
org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testLambdaReceiverType, KT-34659
org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testNestedFunctionsInsideSuspendLambda, KT-34659
org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testSimpleCoroutineScope, KT-34659
org.jetbrains.kotlin.idea.inspections.LocalInspectionTestGenerated.RedundantRequireNotNullCall.testUsedAsExpression, KT-34672, FAIL
org.jetbrains.kotlin.idea.inspections.LocalInspectionTestGenerated.RedundantRequireNotNullCall.testUsedAsExpression2, KT-34672, FAIL
org.jetbrains.kotlin.idea.inspections.LocalInspectionTestGenerated.RedundantRequireNotNullCall.testUsedAsExpression3, KT-34672, FAIL
org.jetbrains.kotlin.idea.parameterInfo.ParameterInfoTestGenerated.WithLib1.testUseJavaFromLib, KT-34542, FAIL
org.jetbrains.kotlin.idea.parameterInfo.ParameterInfoTestGenerated.WithLib2.testUseJavaSAMFromLib, KT-34542, FAIL
org.jetbrains.kotlin.idea.parameterInfo.ParameterInfoTestGenerated.WithLib3.testUseJavaSAMFromLib, KT-34542, FAIL