From f641e2a139179dd3cde4ac13c702995f6acc17a9 Mon Sep 17 00:00:00 2001 From: Dmitry Gridin Date: Thu, 31 Oct 2019 17:35:14 +0700 Subject: [PATCH] RedundantRequireNotNullCallInspection: should use `BodyResolveMode.PARTIAL_WITH_CFA` instead of `BodyResolveMode.PARTIAL` #KT-34672 Fixed --- .../inspections/RedundantRequireNotNullCallInspection.kt | 2 +- .../redundantRequireNotNullCall/usedAsExpression.kt.fail.193 | 5 ----- .../usedAsExpression2.kt.fail.193 | 5 ----- .../usedAsExpression3.kt.fail.193 | 5 ----- tests/mute.csv.193 | 3 --- 5 files changed, 1 insertion(+), 19 deletions(-) delete mode 100644 idea/testData/inspectionsLocal/redundantRequireNotNullCall/usedAsExpression.kt.fail.193 delete mode 100644 idea/testData/inspectionsLocal/redundantRequireNotNullCall/usedAsExpression2.kt.fail.193 delete mode 100644 idea/testData/inspectionsLocal/redundantRequireNotNullCall/usedAsExpression3.kt.fail.193 diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantRequireNotNullCallInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantRequireNotNullCallInspection.kt index 9eecc6910fd..b217d062903 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantRequireNotNullCallInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantRequireNotNullCallInspection.kt @@ -71,7 +71,7 @@ private class RemoveRequireNotNullCallFix(private val functionName: String) : Lo val callExpression = descriptor.psiElement.getStrictParentOfType() ?: 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() diff --git a/idea/testData/inspectionsLocal/redundantRequireNotNullCall/usedAsExpression.kt.fail.193 b/idea/testData/inspectionsLocal/redundantRequireNotNullCall/usedAsExpression.kt.fail.193 deleted file mode 100644 index 84ee0c401a2..00000000000 --- a/idea/testData/inspectionsLocal/redundantRequireNotNullCall/usedAsExpression.kt.fail.193 +++ /dev/null @@ -1,5 +0,0 @@ -Actual data differs from file content: usedAsExpression.kt.after expected:<...: Int) { - val a =[ i] -}> but was:<...: Int) { - val a =[] -}> \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/redundantRequireNotNullCall/usedAsExpression2.kt.fail.193 b/idea/testData/inspectionsLocal/redundantRequireNotNullCall/usedAsExpression2.kt.fail.193 deleted file mode 100644 index b9660de3739..00000000000 --- a/idea/testData/inspectionsLocal/redundantRequireNotNullCall/usedAsExpression2.kt.fail.193 +++ /dev/null @@ -1,5 +0,0 @@ -Actual data differs from file content: usedAsExpression2.kt.after expected:<... Int) { - println([i]) -}> but was:<... Int) { - println([]) -}> \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/redundantRequireNotNullCall/usedAsExpression3.kt.fail.193 b/idea/testData/inspectionsLocal/redundantRequireNotNullCall/usedAsExpression3.kt.fail.193 deleted file mode 100644 index e4d38c8a41b..00000000000 --- a/idea/testData/inspectionsLocal/redundantRequireNotNullCall/usedAsExpression3.kt.fail.193 +++ /dev/null @@ -1,5 +0,0 @@ -Actual data differs from file content: usedAsExpression3.kt.after expected:<...st(i: Int) { - "${[i]}" -}> but was:<...st(i: Int) { - "${[]}" -}> \ No newline at end of file diff --git a/tests/mute.csv.193 b/tests/mute.csv.193 index 631e2d295db..a39ea0f51e7 100644 --- a/tests/mute.csv.193 +++ b/tests/mute.csv.193 @@ -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