diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/SuspiciousCollectionReassignmentInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/SuspiciousCollectionReassignmentInspection.kt index 22f413f53f3..ce8835a2eb3 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/SuspiciousCollectionReassignmentInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/SuspiciousCollectionReassignmentInspection.kt @@ -5,10 +5,7 @@ package org.jetbrains.kotlin.idea.inspections -import com.intellij.codeInspection.LocalQuickFix -import com.intellij.codeInspection.ProblemDescriptor -import com.intellij.codeInspection.ProblemHighlightType -import com.intellij.codeInspection.ProblemsHolder +import com.intellij.codeInspection.* import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.builtins.KotlinBuiltIns @@ -17,15 +14,13 @@ import org.jetbrains.kotlin.diagnostics.Severity import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall import org.jetbrains.kotlin.idea.core.replaced +import org.jetbrains.kotlin.idea.intentions.ReplaceWithOrdinaryAssignmentIntention import org.jetbrains.kotlin.idea.project.builtIns import org.jetbrains.kotlin.idea.references.mainReference import org.jetbrains.kotlin.lexer.KtSingleValueToken import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.anyDescendantOfType -import org.jetbrains.kotlin.psi.psiUtil.endOffset -import org.jetbrains.kotlin.psi.psiUtil.getPrevSiblingIgnoringWhitespaceAndComments -import org.jetbrains.kotlin.psi.psiUtil.siblings +import org.jetbrains.kotlin.psi.psiUtil.* import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall import org.jetbrains.kotlin.resolve.calls.callUtil.getType @@ -60,11 +55,10 @@ class SuspiciousCollectionReassignmentInspection : AbstractKotlinInspection() { if (ReplaceWithFilterFix.isApplicable(binaryExpression, leftDefaultType, context)) { fixes.add(ReplaceWithFilterFix()) } - if (ReplaceWithAssignmentFix.isApplicable(binaryExpression, property, context)) { - fixes.add(ReplaceWithAssignmentFix()) - } - if (JoinWithInitializerFix.isApplicable(binaryExpression, property)) { - fixes.add(JoinWithInitializerFix(operationToken)) + when { + ReplaceWithAssignmentFix.isApplicable(binaryExpression, property, context) -> fixes.add(ReplaceWithAssignmentFix()) + JoinWithInitializerFix.isApplicable(binaryExpression, property) -> fixes.add(JoinWithInitializerFix(operationToken)) + else -> fixes.add(IntentionWrapper(ReplaceWithOrdinaryAssignmentIntention(), binaryExpression.containingKtFile)) } val typeText = leftDefaultType.toString().takeWhile { it != '<' }.toLowerCase() @@ -150,7 +144,7 @@ class SuspiciousCollectionReassignmentInspection : AbstractKotlinInspection() { } private class ReplaceWithAssignmentFix : LocalQuickFix { - override fun getName() = "Replace with assignment" + override fun getName() = "Replace with assignment (original is empty)" override fun getFamilyName() = name diff --git a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/differentType.kt b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/differentType.kt index 74835ceb3ef..b0bcd659ba6 100644 --- a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/differentType.kt +++ b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/differentType.kt @@ -1,4 +1,4 @@ -// "Replace with assignment" "false" +// "Replace with assignment (original is empty)" "false" // TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection // ACTION: Change type to mutable // ACTION: Replace overloaded operator with function call diff --git a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyList.kt b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyList.kt index cd6ebc2e1ba..68b17e0155d 100644 --- a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyList.kt +++ b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyList.kt @@ -1,4 +1,4 @@ -// "Replace with assignment" "true" +// "Replace with assignment (original is empty)" "true" // TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection // WITH_RUNTIME fun test(otherList: List) { diff --git a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyList.kt.after b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyList.kt.after index d526253267a..a86f66f4228 100644 --- a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyList.kt.after +++ b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyList.kt.after @@ -1,4 +1,4 @@ -// "Replace with assignment" "true" +// "Replace with assignment (original is empty)" "true" // TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection // WITH_RUNTIME fun test(otherList: List) { diff --git a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyListOf.kt b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyListOf.kt index 9457af4c8b1..1ee642e98b5 100644 --- a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyListOf.kt +++ b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyListOf.kt @@ -1,4 +1,4 @@ -// "Replace with assignment" "true" +// "Replace with assignment (original is empty)" "true" // TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection // WITH_RUNTIME fun test(otherList: List) { diff --git a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyListOf.kt.after b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyListOf.kt.after index f7c9c84b10d..e4d0a728020 100644 --- a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyListOf.kt.after +++ b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyListOf.kt.after @@ -1,4 +1,4 @@ -// "Replace with assignment" "true" +// "Replace with assignment (original is empty)" "true" // TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection // WITH_RUNTIME fun test(otherList: List) { diff --git a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyMap.kt b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyMap.kt index 7cb0cfb4882..612111f5286 100644 --- a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyMap.kt +++ b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyMap.kt @@ -1,4 +1,4 @@ -// "Replace with assignment" "true" +// "Replace with assignment (original is empty)" "true" // TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection // WITH_RUNTIME fun test(otherMap: Map) { diff --git a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyMap.kt.after b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyMap.kt.after index e1c693f6d19..a4e1012fe38 100644 --- a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyMap.kt.after +++ b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyMap.kt.after @@ -1,4 +1,4 @@ -// "Replace with assignment" "true" +// "Replace with assignment (original is empty)" "true" // TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection // WITH_RUNTIME fun test(otherMap: Map) { diff --git a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyMapOf.kt b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyMapOf.kt index 91392f9d0c5..7f772349492 100644 --- a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyMapOf.kt +++ b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyMapOf.kt @@ -1,4 +1,4 @@ -// "Replace with assignment" "true" +// "Replace with assignment (original is empty)" "true" // TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection // WITH_RUNTIME fun test(otherMap: Map) { diff --git a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyMapOf.kt.after b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyMapOf.kt.after index 48ebed29761..2f481cf4f95 100644 --- a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyMapOf.kt.after +++ b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptyMapOf.kt.after @@ -1,4 +1,4 @@ -// "Replace with assignment" "true" +// "Replace with assignment (original is empty)" "true" // TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection // WITH_RUNTIME fun test(otherMap: Map) { diff --git a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptySet.kt b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptySet.kt index 13768310144..1ae064e44ec 100644 --- a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptySet.kt +++ b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptySet.kt @@ -1,4 +1,4 @@ -// "Replace with assignment" "true" +// "Replace with assignment (original is empty)" "true" // TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection // WITH_RUNTIME fun test(otherList: Set) { diff --git a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptySet.kt.after b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptySet.kt.after index 8f55796d01a..19f881c1808 100644 --- a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptySet.kt.after +++ b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptySet.kt.after @@ -1,4 +1,4 @@ -// "Replace with assignment" "true" +// "Replace with assignment (original is empty)" "true" // TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection // WITH_RUNTIME fun test(otherList: Set) { diff --git a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptySetOf.kt b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptySetOf.kt index 4893b5d36e5..311787be4f4 100644 --- a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptySetOf.kt +++ b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptySetOf.kt @@ -1,4 +1,4 @@ -// "Replace with assignment" "true" +// "Replace with assignment (original is empty)" "true" // TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection // WITH_RUNTIME fun test(otherList: Set) { diff --git a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptySetOf.kt.after b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptySetOf.kt.after index b91d4b8d3d3..ced305d68c6 100644 --- a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptySetOf.kt.after +++ b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/emptySetOf.kt.after @@ -1,4 +1,4 @@ -// "Replace with assignment" "true" +// "Replace with assignment (original is empty)" "true" // TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection // WITH_RUNTIME fun test(otherList: Set) { diff --git a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/listOf.kt b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/listOf.kt index 474b403794d..9fd03a290e7 100644 --- a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/listOf.kt +++ b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/listOf.kt @@ -1,4 +1,4 @@ -// "Replace with assignment" "false" +// "Replace with assignment (original is empty)" "false" // TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection // ACTION: Change type to mutable // ACTION: Replace overloaded operator with function call diff --git a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/mapOf.kt b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/mapOf.kt index 2eb68706a66..9a9e7afa158 100644 --- a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/mapOf.kt +++ b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/mapOf.kt @@ -1,4 +1,4 @@ -// "Replace with assignment" "false" +// "Replace with assignment (original is empty)" "false" // TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection // ACTION: Change type to mutable // ACTION: Replace overloaded operator with function call diff --git a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/minusEq.kt b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/minusEq.kt index d8746ea6556..ca1fb1d0d64 100644 --- a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/minusEq.kt +++ b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/minusEq.kt @@ -1,4 +1,4 @@ -// "Replace with assignment" "false" +// "Replace with assignment (original is empty)" "false" // TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection // ACTION: Change type to mutable // ACTION: Replace overloaded operator with function call diff --git a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/noInitializer.kt b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/noInitializer.kt index 475cb273378..e363cf6c1fe 100644 --- a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/noInitializer.kt +++ b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/noInitializer.kt @@ -1,4 +1,4 @@ -// "Replace with assignment" "false" +// "Replace with assignment (original is empty)" "false" // ACTION: Replace overloaded operator with function call // ACTION: Replace with ordinary assignment // WITH_RUNTIME diff --git a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/notEmpty.kt b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/notEmpty.kt index 168bfe48370..cce5ff85d66 100644 --- a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/notEmpty.kt +++ b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/notEmpty.kt @@ -1,4 +1,4 @@ -// "Replace with assignment" "false" +// "Replace with assignment (original is empty)" "false" // TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection // ACTION: Change type to mutable // ACTION: Replace overloaded operator with function call diff --git a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/notLocal.kt b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/notLocal.kt index 31a7a311926..036ff562974 100644 --- a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/notLocal.kt +++ b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/notLocal.kt @@ -1,4 +1,4 @@ -// "Replace with assignment" "false" +// "Replace with assignment (original is empty)" "false" // ACTION: Replace overloaded operator with function call // ACTION: Replace with ordinary assignment // WITH_RUNTIME diff --git a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/setOf.kt b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/setOf.kt index b8975468f68..01d06f43fc7 100644 --- a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/setOf.kt +++ b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/setOf.kt @@ -1,4 +1,4 @@ -// "Replace with assignment" "false" +// "Replace with assignment (original is empty)" "false" // TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection // ACTION: Change type to mutable // ACTION: Replace overloaded operator with function call diff --git a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/used.kt b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/used.kt index eb0619daa4c..214e06b5e2d 100644 --- a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/used.kt +++ b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithAssignment/used.kt @@ -1,4 +1,4 @@ -// "Replace with assignment" "false" +// "Replace with assignment (original is empty)" "false" // TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection // ACTION: Change type to mutable // ACTION: Replace overloaded operator with function call diff --git a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithOrdinaryAssignment/simple.kt b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithOrdinaryAssignment/simple.kt new file mode 100644 index 00000000000..9058c03952d --- /dev/null +++ b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithOrdinaryAssignment/simple.kt @@ -0,0 +1,10 @@ +// "Replace with ordinary assignment" "true" +// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection +// ACTION: Replace overloaded operator with function call +// WITH_RUNTIME +fun test(otherList: List, flag: Boolean) { + var list = otherList + if (flag) { + list += 4 + } +} diff --git a/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithOrdinaryAssignment/simple.kt.after b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithOrdinaryAssignment/simple.kt.after new file mode 100644 index 00000000000..aa20dd2c8b3 --- /dev/null +++ b/idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithOrdinaryAssignment/simple.kt.after @@ -0,0 +1,10 @@ +// "Replace with ordinary assignment" "true" +// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection +// ACTION: Replace overloaded operator with function call +// WITH_RUNTIME +fun test(otherList: List, flag: Boolean) { + var list = otherList + if (flag) { + list = list + 4 + } +} diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixMultiFileTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixMultiFileTestGenerated.java index 10ecc4ad322..a51670344f1 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixMultiFileTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixMultiFileTestGenerated.java @@ -4022,6 +4022,19 @@ public class QuickFixMultiFileTestGenerated extends AbstractQuickFixMultiFileTes KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithFilter"), Pattern.compile("^(\\w+)\\.((before\\.Main\\.\\w+)|(test))$"), TargetBackend.ANY, true); } } + + @TestMetadata("idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithOrdinaryAssignment") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ReplaceWithOrdinaryAssignment extends AbstractQuickFixMultiFileTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTestWithExtraFile, TargetBackend.ANY, testDataFilePath); + } + + public void testAllFilesPresentInReplaceWithOrdinaryAssignment() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithOrdinaryAssignment"), Pattern.compile("^(\\w+)\\.((before\\.Main\\.\\w+)|(test))$"), TargetBackend.ANY, true); + } + } } @TestMetadata("idea/testData/quickfix/toString") diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java index 2f060211ce8..78112d92f77 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java @@ -11582,6 +11582,24 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { runTest("idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithFilter/plusEq.kt"); } } + + @TestMetadata("idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithOrdinaryAssignment") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ReplaceWithOrdinaryAssignment extends AbstractQuickFixTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + public void testAllFilesPresentInReplaceWithOrdinaryAssignment() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithOrdinaryAssignment"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true); + } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("idea/testData/quickfix/suspiciousCollectionReassignment/replaceWithOrdinaryAssignment/simple.kt"); + } + } } @TestMetadata("idea/testData/quickfix/toString")