From ada7287c66a835841473a2fcad0cd06b3fedf5f1 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 20 Dec 2017 16:02:15 +0300 Subject: [PATCH] Refactoring: make "replace call with binary operator" an inspection --- .../ReplaceCallWithBinaryOperator.html | 4 + .../ReplaceCallWithComparison.html | 4 - .../after.kt.template | 6 - .../before.kt.template | 6 - .../description.html | 6 - idea/src/META-INF/plugin.xml | 9 +- ...eplaceCallWithBinaryOperatorInspection.kt} | 99 ++++++----- .../inspectionData/expected.xml | 32 +++- .../inspectionData/inspections.test | 2 +- .../replaceCallWithComparison/test.kt | 4 +- .../replaceCallWithBinaryOperator/.inspection | 1 + .../divSanityTest.kt | 4 +- .../divSanityTest.kt.after | 2 +- .../replaceCallWithBinaryOperator/equals.kt | 3 + .../equals.kt.after | 3 + .../equalsCompareTo.kt | 2 +- .../equalsExtensionFunction.kt | 2 +- .../extensionFunction.kt | 2 +- .../extensionFunction.kt.after | 0 .../functionLiteralArgument.kt | 0 .../functionLiteralArgument.kt.after | 0 .../replaceCallWithBinaryOperator/greater.kt | 3 + .../greater.kt.after | 3 + .../lessEquals.kt | 3 + .../lessEquals.kt.after | 3 + .../minusSanityTest.kt | 2 +- .../minusSanityTest.kt.after | 2 +- .../missingDefaultArgument.kt | 2 +- .../modSanityTest.kt} | 5 +- .../multipleArguments.kt | 2 +- .../notEquals.kt | 3 + .../notEquals.kt.after | 3 + .../notEqualsBrackets.kt | 3 + .../notEqualsBrackets.kt.after | 3 + .../notEqualsBracketsComplex.kt | 3 + .../notEqualsBracketsComplex.kt.after | 3 + .../plusSanityTest.kt | 2 +- .../plusSanityTest.kt.after | 2 +- .../qualifier.kt | 0 .../qualifier.kt.after | 0 .../rangeToSanityTest.kt | 4 +- .../rangeToSanityTest.kt.after | 2 +- .../remSanityTest.kt | 4 +- .../remSanityTest.kt.after | 2 +- .../safeCompareTo.kt | 2 +- .../replaceCallWithBinaryOperator/super.kt | 2 +- .../timesSanityTest.kt | 2 +- .../timesSanityTest.kt.after | 2 +- .../typeArguments.kt | 2 +- .../unacceptableVararg1.kt | 2 +- .../unacceptableVararg2.kt | 2 +- .../validNamedArgument.kt | 0 .../validNamedArgument.kt.after | 0 .../replaceCallWithBinaryOperator/.intention | 1 - .../replaceCallWithBinaryOperator/equals.kt | 3 - .../equals.kt.after | 3 - .../replaceCallWithBinaryOperator/greater.kt | 3 - .../greater.kt.after | 3 - .../lessEquals.kt | 3 - .../lessEquals.kt.after | 3 - .../modSanityTest.kt | 10 -- .../notEquals.kt | 3 - .../notEquals.kt.after | 3 - .../notEqualsBrackets.kt | 3 - .../notEqualsBrackets.kt.after | 3 - .../notEqualsBracketsComplex.kt | 3 - .../notEqualsBracketsComplex.kt.after | 3 - .../LocalInspectionTestGenerated.java | 165 ++++++++++++++++++ .../intentions/IntentionTestGenerated.java | 165 ------------------ 69 files changed, 320 insertions(+), 321 deletions(-) create mode 100644 idea/resources/inspectionDescriptions/ReplaceCallWithBinaryOperator.html delete mode 100644 idea/resources/inspectionDescriptions/ReplaceCallWithComparison.html delete mode 100644 idea/resources/intentionDescriptions/ReplaceCallWithBinaryOperatorIntention/after.kt.template delete mode 100644 idea/resources/intentionDescriptions/ReplaceCallWithBinaryOperatorIntention/before.kt.template delete mode 100644 idea/resources/intentionDescriptions/ReplaceCallWithBinaryOperatorIntention/description.html rename idea/src/org/jetbrains/kotlin/idea/{intentions/conventionNameCalls/ReplaceCallWithBinaryOperatorIntention.kt => inspections/conventionNameCalls/ReplaceCallWithBinaryOperatorInspection.kt} (57%) create mode 100644 idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/.inspection rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/divSanityTest.kt (61%) rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/divSanityTest.kt.after (72%) create mode 100644 idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/equals.kt create mode 100644 idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/equals.kt.after rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/equalsCompareTo.kt (59%) rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/equalsExtensionFunction.kt (83%) rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/extensionFunction.kt (81%) rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/extensionFunction.kt.after (100%) rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/functionLiteralArgument.kt (100%) rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/functionLiteralArgument.kt.after (100%) create mode 100644 idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/greater.kt create mode 100644 idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/greater.kt.after create mode 100644 idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/lessEquals.kt create mode 100644 idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/lessEquals.kt.after rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/minusSanityTest.kt (75%) rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/minusSanityTest.kt.after (73%) rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/missingDefaultArgument.kt (90%) rename idea/testData/{intentions/conventionNameCalls/replaceCallWithBinaryOperator/modSanityTest.kt.after => inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/modSanityTest.kt} (57%) rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/multipleArguments.kt (91%) create mode 100644 idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEquals.kt create mode 100644 idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEquals.kt.after create mode 100644 idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBrackets.kt create mode 100644 idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBrackets.kt.after create mode 100644 idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBracketsComplex.kt create mode 100644 idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBracketsComplex.kt.after rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/plusSanityTest.kt (74%) rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/plusSanityTest.kt.after (73%) rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/qualifier.kt (100%) rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/qualifier.kt.after (100%) rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/rangeToSanityTest.kt (60%) rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/rangeToSanityTest.kt.after (72%) rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/remSanityTest.kt (61%) rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/remSanityTest.kt.after (73%) rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/safeCompareTo.kt (90%) rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/super.kt (87%) rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/timesSanityTest.kt (75%) rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/timesSanityTest.kt.after (73%) rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/typeArguments.kt (85%) rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/unacceptableVararg1.kt (91%) rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/unacceptableVararg2.kt (91%) rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/validNamedArgument.kt (100%) rename idea/testData/{intentions => inspectionsLocal}/conventionNameCalls/replaceCallWithBinaryOperator/validNamedArgument.kt.after (100%) delete mode 100644 idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/.intention delete mode 100644 idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/equals.kt delete mode 100644 idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/equals.kt.after delete mode 100644 idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/greater.kt delete mode 100644 idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/greater.kt.after delete mode 100644 idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/lessEquals.kt delete mode 100644 idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/lessEquals.kt.after delete mode 100644 idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/modSanityTest.kt delete mode 100644 idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEquals.kt delete mode 100644 idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEquals.kt.after delete mode 100644 idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBrackets.kt delete mode 100644 idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBrackets.kt.after delete mode 100644 idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBracketsComplex.kt delete mode 100644 idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBracketsComplex.kt.after diff --git a/idea/resources/inspectionDescriptions/ReplaceCallWithBinaryOperator.html b/idea/resources/inspectionDescriptions/ReplaceCallWithBinaryOperator.html new file mode 100644 index 00000000000..ddce5993958 --- /dev/null +++ b/idea/resources/inspectionDescriptions/ReplaceCallWithBinaryOperator.html @@ -0,0 +1,4 @@ + +This inspection reports function calls that can be replaced with binary operators, especially comparison-related. +Example: 2.compareTo(1) > 0 can be replaced by 2 > 1. + \ No newline at end of file diff --git a/idea/resources/inspectionDescriptions/ReplaceCallWithComparison.html b/idea/resources/inspectionDescriptions/ReplaceCallWithComparison.html deleted file mode 100644 index 1ed3a69bb52..00000000000 --- a/idea/resources/inspectionDescriptions/ReplaceCallWithComparison.html +++ /dev/null @@ -1,4 +0,0 @@ - -This inspection reports equals() and compareTo() calls that can be replaced with binary comparison. -Example: 2.compareTo(1) > 0 can be replaced by 2 > 1. - \ No newline at end of file diff --git a/idea/resources/intentionDescriptions/ReplaceCallWithBinaryOperatorIntention/after.kt.template b/idea/resources/intentionDescriptions/ReplaceCallWithBinaryOperatorIntention/after.kt.template deleted file mode 100644 index ec1fb563f1d..00000000000 --- a/idea/resources/intentionDescriptions/ReplaceCallWithBinaryOperatorIntention/after.kt.template +++ /dev/null @@ -1,6 +0,0 @@ -a + b -a - b -a * b -a / b -a % b -a .. b diff --git a/idea/resources/intentionDescriptions/ReplaceCallWithBinaryOperatorIntention/before.kt.template b/idea/resources/intentionDescriptions/ReplaceCallWithBinaryOperatorIntention/before.kt.template deleted file mode 100644 index b7900977148..00000000000 --- a/idea/resources/intentionDescriptions/ReplaceCallWithBinaryOperatorIntention/before.kt.template +++ /dev/null @@ -1,6 +0,0 @@ -a.plus(b) -a.minus(b) -a.times(b) -a.div(b) -a.mod(b) -a.rangeTo(b) diff --git a/idea/resources/intentionDescriptions/ReplaceCallWithBinaryOperatorIntention/description.html b/idea/resources/intentionDescriptions/ReplaceCallWithBinaryOperatorIntention/description.html deleted file mode 100644 index ce532c73157..00000000000 --- a/idea/resources/intentionDescriptions/ReplaceCallWithBinaryOperatorIntention/description.html +++ /dev/null @@ -1,6 +0,0 @@ - - -This intention replaces any calls to infix operators -(plus, minus, div, times, mod, rangeTo) with their respective infixes. - - \ No newline at end of file diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index 6777fa3ceaf..af00acc586f 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -827,11 +827,6 @@ Kotlin - - org.jetbrains.kotlin.idea.intentions.conventionNameCalls.ReplaceCallWithBinaryOperatorIntention - Kotlin - - org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.FoldIfToReturnAsymmetricallyIntention Kotlin @@ -2005,8 +2000,8 @@ language="kotlin" /> - ( - ReplaceCallWithBinaryOperatorIntention::class, - { qualifiedExpression -> - val calleeExpression = qualifiedExpression.callExpression?.calleeExpression as? KtSimpleNameExpression - val identifier = calleeExpression?.getReferencedNameAsName() - identifier == OperatorNameConventions.EQUALS || identifier == OperatorNameConventions.COMPARE_TO - } -) - -class ReplaceCallWithBinaryOperatorIntention : SelfTargetingRangeIntention( - KtDotQualifiedExpression::class.java, - "Replace call with binary operator" -), HighPriorityAction { +class ReplaceCallWithBinaryOperatorInspection : AbstractApplicabilityBasedInspection() { + override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean, session: LocalInspectionToolSession): KtVisitorVoid = + object : KtVisitorVoid() { + override fun visitDotQualifiedExpression(expression: KtDotQualifiedExpression) { + super.visitDotQualifiedExpression(expression) + visitTargetElement(expression, holder, isOnTheFly) + } + } private fun IElementType.inverted(): KtSingleValueToken? = when (this) { KtTokens.LT -> KtTokens.GT @@ -62,46 +58,67 @@ class ReplaceCallWithBinaryOperatorIntention : SelfTargetingRangeIntention null } - override fun applicabilityRange(element: KtDotQualifiedExpression): TextRange? { - val calleeExpression = element.callExpression?.calleeExpression as? KtSimpleNameExpression ?: return null - val operation = operation(calleeExpression) ?: return null + override fun isApplicable(element: KtDotQualifiedExpression): Boolean { + val calleeExpression = element.callExpression?.calleeExpression as? KtSimpleNameExpression ?: return false + val operation = operation(calleeExpression) ?: return false - val resolvedCall = element.toResolvedCall(BodyResolveMode.PARTIAL) ?: return null - if (!resolvedCall.isReallySuccess()) return null - if (resolvedCall.call.typeArgumentList != null) return null - val argument = resolvedCall.call.valueArguments.singleOrNull() ?: return null - if ((resolvedCall.getArgumentMapping(argument) as ArgumentMatch).valueParameter.index != 0) return null + val resolvedCall = element.toResolvedCall(BodyResolveMode.PARTIAL) ?: return false + if (!resolvedCall.isReallySuccess()) return false + if (resolvedCall.call.typeArgumentList != null) return false + val argument = resolvedCall.call.valueArguments.singleOrNull() ?: return false + if ((resolvedCall.getArgumentMapping(argument) as ArgumentMatch).valueParameter.index != 0) return false - if (!element.isReceiverExpressionWithValue()) return null - - text = "Replace with '${operation.value}' operator" - return calleeExpression.textRange + return element.isReceiverExpressionWithValue() } - override fun applyTo(element: KtDotQualifiedExpression, editor: Editor?) { - val callExpression = element.callExpression ?: return + override fun inspectionTarget(element: KtDotQualifiedExpression) = element.callExpression?.calleeExpression ?: element + + override fun inspectionHighlightType(element: KtDotQualifiedExpression): ProblemHighlightType { + val calleeExpression = element.callExpression?.calleeExpression as? KtSimpleNameExpression + val identifier = calleeExpression?.getReferencedNameAsName() + return if (identifier == OperatorNameConventions.EQUALS || identifier == OperatorNameConventions.COMPARE_TO) { + ProblemHighlightType.GENERIC_ERROR_OR_WARNING + } + else { + ProblemHighlightType.INFORMATION + } + } + + override fun inspectionText(element: KtDotQualifiedExpression) = "Call replaceable with binary operator" + + override val defaultFixText: String + get() = "Replace with binary operator" + + override fun fixText(element: KtDotQualifiedExpression): String { + val calleeExpression = element.callExpression?.calleeExpression as? KtSimpleNameExpression ?: return defaultFixText + val operation = operation(calleeExpression) ?: return defaultFixText + return "Replace with '${operation.value}' operator" + } + + override fun applyTo(element: PsiElement, project: Project, editor: Editor?) { + val qualifiedExpression = element.getParentOfType(strict = false) ?: return + val callExpression = qualifiedExpression.callExpression ?: return val operation = operation(callExpression.calleeExpression as? KtSimpleNameExpression ?: return) ?: return val argument = callExpression.valueArguments.single().getArgumentExpression() ?: return - val receiver = element.receiverExpression + val receiver = qualifiedExpression.receiverExpression - val factory = KtPsiFactory(element) + val factory = KtPsiFactory(qualifiedExpression) when (operation) { KtTokens.EXCLEQ -> { - val prefixExpression = element.getWrappingPrefixExpressionIfAny() ?: return + val prefixExpression = qualifiedExpression.getWrappingPrefixExpressionIfAny() ?: return val newExpression = factory.createExpressionByPattern("$0 != $1", receiver, argument) prefixExpression.replace(newExpression) } in OperatorConventions.COMPARISON_OPERATIONS -> { - val binaryParent = element.parent as? KtBinaryExpression ?: return + val binaryParent = qualifiedExpression.parent as? KtBinaryExpression ?: return val newExpression = factory.createExpressionByPattern("$0 ${operation.value} $1", receiver, argument) binaryParent.replace(newExpression) } else -> { val newExpression = factory.createExpressionByPattern("$0 ${operation.value} $1", receiver, argument) - element.replace(newExpression) + qualifiedExpression.replace(newExpression) } } - } private fun PsiElement.getWrappingPrefixExpressionIfAny() = diff --git a/idea/testData/inspections/replaceCallWithComparison/inspectionData/expected.xml b/idea/testData/inspections/replaceCallWithComparison/inspectionData/expected.xml index 4084903d0ae..c2625acdfdf 100644 --- a/idea/testData/inspections/replaceCallWithComparison/inspectionData/expected.xml +++ b/idea/testData/inspections/replaceCallWithComparison/inspectionData/expected.xml @@ -4,31 +4,47 @@ 2 light_idea_test_case - Can be replaced with comparison - Replace with '==' operator + Can be replaced with binary operator + Call replaceable with binary operator test.kt 3 light_idea_test_case - Can be replaced with comparison - Replace with '!=' operator + Can be replaced with binary operator + Call replaceable with binary operator test.kt 6 light_idea_test_case - Can be replaced with comparison - Replace with '>' operator + Can be replaced with binary operator + Call replaceable with binary operator test.kt 7 light_idea_test_case - Can be replaced with comparison - Replace with '<=' operator + Can be replaced with binary operator + Call replaceable with binary operator + + + test.kt + 8 + light_idea_test_case + + Can be replaced with binary operator + Call replaceable with binary operator + + + test.kt + 9 + light_idea_test_case + + Can be replaced with binary operator + Call replaceable with binary operator \ No newline at end of file diff --git a/idea/testData/inspections/replaceCallWithComparison/inspectionData/inspections.test b/idea/testData/inspections/replaceCallWithComparison/inspectionData/inspections.test index f8c25a1e1ba..3fdd60c5d82 100644 --- a/idea/testData/inspections/replaceCallWithComparison/inspectionData/inspections.test +++ b/idea/testData/inspections/replaceCallWithComparison/inspectionData/inspections.test @@ -1 +1 @@ -// INSPECTION_CLASS: org.jetbrains.kotlin.idea.intentions.conventionNameCalls.ReplaceCallWithComparisonInspection +// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.conventionNameCalls.ReplaceCallWithBinaryOperatorInspection diff --git a/idea/testData/inspections/replaceCallWithComparison/test.kt b/idea/testData/inspections/replaceCallWithComparison/test.kt index 0b4f0e8af70..bde63e5fed4 100644 --- a/idea/testData/inspections/replaceCallWithComparison/test.kt +++ b/idea/testData/inspections/replaceCallWithComparison/test.kt @@ -5,6 +5,6 @@ fun foo() { 1.compareTo(1) == 0 // NO 2.compareTo(1) > 0 // YES 0 >= 1.compareTo(2) // YES - 2.plus(2) // NO - 2.times(2) // NO + 2.plus(2) // YES (information) + 2.times(2) // YES (information) } \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/.inspection b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/.inspection new file mode 100644 index 00000000000..b13e2915e97 --- /dev/null +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/.inspection @@ -0,0 +1 @@ +org.jetbrains.kotlin.idea.inspections.conventionNameCalls.ReplaceCallWithBinaryOperatorInspection diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/divSanityTest.kt b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/divSanityTest.kt similarity index 61% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/divSanityTest.kt rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/divSanityTest.kt index 8263e4cbd0e..ca0893b0949 100644 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/divSanityTest.kt +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/divSanityTest.kt @@ -1,8 +1,8 @@ -// INTENTION_TEXT: Replace with '/' operator +// FIX: Replace with '/' operator fun test() { class Test { operator fun div(a: Int): Test = Test() } val test = Test() - test.div(1) + test.div(1) } diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/divSanityTest.kt.after b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/divSanityTest.kt.after similarity index 72% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/divSanityTest.kt.after rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/divSanityTest.kt.after index f8ca82a003f..76d297f77ad 100644 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/divSanityTest.kt.after +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/divSanityTest.kt.after @@ -1,4 +1,4 @@ -// INTENTION_TEXT: Replace with '/' operator +// FIX: Replace with '/' operator fun test() { class Test { operator fun div(a: Int): Test = Test() diff --git a/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/equals.kt b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/equals.kt new file mode 100644 index 00000000000..c93827dddbb --- /dev/null +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/equals.kt @@ -0,0 +1,3 @@ +// FIX: Replace with '==' operator + +val x = 2.equals(2) \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/equals.kt.after b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/equals.kt.after new file mode 100644 index 00000000000..dd570c9491a --- /dev/null +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/equals.kt.after @@ -0,0 +1,3 @@ +// FIX: Replace with '==' operator + +val x = 2 == 2 \ No newline at end of file diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/equalsCompareTo.kt b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/equalsCompareTo.kt similarity index 59% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/equalsCompareTo.kt rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/equalsCompareTo.kt index bba372a41f0..07cddc6928a 100644 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/equalsCompareTo.kt +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/equalsCompareTo.kt @@ -1,3 +1,3 @@ -// IS_APPLICABLE: false +// PROBLEM: none val x = 2.compareTo(2) == 0 \ No newline at end of file diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/equalsExtensionFunction.kt b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/equalsExtensionFunction.kt similarity index 83% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/equalsExtensionFunction.kt rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/equalsExtensionFunction.kt index cf6eeae1287..89ceccfd6a8 100644 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/equalsExtensionFunction.kt +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/equalsExtensionFunction.kt @@ -1,4 +1,4 @@ -// IS_APPLICABLE: false +// PROBLEM: none class Foo diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/extensionFunction.kt b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/extensionFunction.kt similarity index 81% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/extensionFunction.kt rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/extensionFunction.kt index 7884f13683d..eb051d9bae0 100644 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/extensionFunction.kt +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/extensionFunction.kt @@ -2,5 +2,5 @@ fun test() { class Test() operator fun Test.div(a: Int): Test = Test() val test = Test() - test.div(1) + test.div(1) } diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/extensionFunction.kt.after b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/extensionFunction.kt.after similarity index 100% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/extensionFunction.kt.after rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/extensionFunction.kt.after diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/functionLiteralArgument.kt b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/functionLiteralArgument.kt similarity index 100% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/functionLiteralArgument.kt rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/functionLiteralArgument.kt diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/functionLiteralArgument.kt.after b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/functionLiteralArgument.kt.after similarity index 100% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/functionLiteralArgument.kt.after rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/functionLiteralArgument.kt.after diff --git a/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/greater.kt b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/greater.kt new file mode 100644 index 00000000000..71749f0ed96 --- /dev/null +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/greater.kt @@ -0,0 +1,3 @@ +// FIX: Replace with '>' operator + +val x = 3.compareTo(2) > 0 \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/greater.kt.after b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/greater.kt.after new file mode 100644 index 00000000000..df2c57aa1ed --- /dev/null +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/greater.kt.after @@ -0,0 +1,3 @@ +// FIX: Replace with '>' operator + +val x = 3 > 2 \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/lessEquals.kt b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/lessEquals.kt new file mode 100644 index 00000000000..d59ce5794f0 --- /dev/null +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/lessEquals.kt @@ -0,0 +1,3 @@ +// FIX: Replace with '<=' operator + +val x = 0 >= 4.compareTo(5) \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/lessEquals.kt.after b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/lessEquals.kt.after new file mode 100644 index 00000000000..35926732057 --- /dev/null +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/lessEquals.kt.after @@ -0,0 +1,3 @@ +// FIX: Replace with '<=' operator + +val x = 4 <= 5 \ No newline at end of file diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/minusSanityTest.kt b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/minusSanityTest.kt similarity index 75% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/minusSanityTest.kt rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/minusSanityTest.kt index aa20928be9c..27b077967eb 100644 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/minusSanityTest.kt +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/minusSanityTest.kt @@ -1,4 +1,4 @@ -// INTENTION_TEXT: Replace with '-' operator +// FIX: Replace with '-' operator fun test() { class Test { operator fun minus(a: Int): Test = Test() diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/minusSanityTest.kt.after b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/minusSanityTest.kt.after similarity index 73% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/minusSanityTest.kt.after rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/minusSanityTest.kt.after index e9c18ff1860..4cb0c716356 100644 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/minusSanityTest.kt.after +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/minusSanityTest.kt.after @@ -1,4 +1,4 @@ -// INTENTION_TEXT: Replace with '-' operator +// FIX: Replace with '-' operator fun test() { class Test { operator fun minus(a: Int): Test = Test() diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/missingDefaultArgument.kt b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/missingDefaultArgument.kt similarity index 90% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/missingDefaultArgument.kt rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/missingDefaultArgument.kt index 3c3105a53df..4604412e199 100644 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/missingDefaultArgument.kt +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/missingDefaultArgument.kt @@ -1,4 +1,4 @@ -// IS_APPLICABLE: false +// PROBLEM: none // ERROR: 'operator' modifier is inapplicable on this function: must have a single value parameter fun test() { class Test{ diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/modSanityTest.kt.after b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/modSanityTest.kt similarity index 57% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/modSanityTest.kt.after rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/modSanityTest.kt index 645715d4a78..45391d5407c 100644 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/modSanityTest.kt.after +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/modSanityTest.kt @@ -1,10 +1,9 @@ -// INTENTION_TEXT: Replace with '%' operator -// IS_APPLICABLE: false +// PROBLEM: none fun test() { class Test { operator fun mod(a: Int): Test = Test() } val test = Test() - test % 1 + test.mod(1) } diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/multipleArguments.kt b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/multipleArguments.kt similarity index 91% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/multipleArguments.kt rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/multipleArguments.kt index cc057649521..9df22c29a1c 100644 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/multipleArguments.kt +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/multipleArguments.kt @@ -1,4 +1,4 @@ -// IS_APPLICABLE: false +// PROBLEM: none // ERROR: 'operator' modifier is inapplicable on this function: must have a single value parameter fun test() { class Test { diff --git a/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEquals.kt b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEquals.kt new file mode 100644 index 00000000000..79d3c4684e0 --- /dev/null +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEquals.kt @@ -0,0 +1,3 @@ +// FIX: Replace with '!=' operator + +val x = !2.equals(3) \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEquals.kt.after b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEquals.kt.after new file mode 100644 index 00000000000..0d28e41e266 --- /dev/null +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEquals.kt.after @@ -0,0 +1,3 @@ +// FIX: Replace with '!=' operator + +val x = 2 != 3 \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBrackets.kt b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBrackets.kt new file mode 100644 index 00000000000..3b0b90e44a1 --- /dev/null +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBrackets.kt @@ -0,0 +1,3 @@ +// FIX: Replace with '!=' operator + +val x = !(2.equals(3)) \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBrackets.kt.after b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBrackets.kt.after new file mode 100644 index 00000000000..0d28e41e266 --- /dev/null +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBrackets.kt.after @@ -0,0 +1,3 @@ +// FIX: Replace with '!=' operator + +val x = 2 != 3 \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBracketsComplex.kt b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBracketsComplex.kt new file mode 100644 index 00000000000..2cd0bdeeee5 --- /dev/null +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBracketsComplex.kt @@ -0,0 +1,3 @@ +// FIX: Replace with '==' operator + +val x = !(2.equals(3) && 4.equals(5)) \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBracketsComplex.kt.after b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBracketsComplex.kt.after new file mode 100644 index 00000000000..3c7b4a23974 --- /dev/null +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBracketsComplex.kt.after @@ -0,0 +1,3 @@ +// FIX: Replace with '==' operator + +val x = !(2 == 3 && 4.equals(5)) \ No newline at end of file diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/plusSanityTest.kt b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/plusSanityTest.kt similarity index 74% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/plusSanityTest.kt rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/plusSanityTest.kt index c5fc193b537..51201b36339 100644 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/plusSanityTest.kt +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/plusSanityTest.kt @@ -1,4 +1,4 @@ -// INTENTION_TEXT: Replace with '+' operator +// FIX: Replace with '+' operator fun test() { class Test { operator fun plus(a: Int): Test = Test() diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/plusSanityTest.kt.after b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/plusSanityTest.kt.after similarity index 73% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/plusSanityTest.kt.after rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/plusSanityTest.kt.after index 670b62267d6..2ed7f2e1e75 100644 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/plusSanityTest.kt.after +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/plusSanityTest.kt.after @@ -1,4 +1,4 @@ -// INTENTION_TEXT: Replace with '+' operator +// FIX: Replace with '+' operator fun test() { class Test { operator fun plus(a: Int): Test = Test() diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/qualifier.kt b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/qualifier.kt similarity index 100% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/qualifier.kt rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/qualifier.kt diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/qualifier.kt.after b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/qualifier.kt.after similarity index 100% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/qualifier.kt.after rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/qualifier.kt.after diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/rangeToSanityTest.kt b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/rangeToSanityTest.kt similarity index 60% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/rangeToSanityTest.kt rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/rangeToSanityTest.kt index 6449c181a85..51b4bac4c19 100644 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/rangeToSanityTest.kt +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/rangeToSanityTest.kt @@ -1,8 +1,8 @@ -// INTENTION_TEXT: Replace with '..' operator +// FIX: Replace with '..' operator fun test() { class Test { operator fun rangeTo(a: Int): Test = Test() } val test = Test() - test.rangeTo(1) + test.rangeTo(1) } diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/rangeToSanityTest.kt.after b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/rangeToSanityTest.kt.after similarity index 72% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/rangeToSanityTest.kt.after rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/rangeToSanityTest.kt.after index c44bede9a73..2bac3b9c05b 100644 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/rangeToSanityTest.kt.after +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/rangeToSanityTest.kt.after @@ -1,4 +1,4 @@ -// INTENTION_TEXT: Replace with '..' operator +// FIX: Replace with '..' operator fun test() { class Test { operator fun rangeTo(a: Int): Test = Test() diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/remSanityTest.kt b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/remSanityTest.kt similarity index 61% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/remSanityTest.kt rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/remSanityTest.kt index 87f2f294035..19d14fbb3aa 100644 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/remSanityTest.kt +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/remSanityTest.kt @@ -1,9 +1,9 @@ -// INTENTION_TEXT: Replace with '%' operator +// FIX: Replace with '%' operator fun test() { class Test { operator fun rem(a: Int): Test = Test() } val test = Test() - test.rem(1) + test.rem(1) } diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/remSanityTest.kt.after b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/remSanityTest.kt.after similarity index 73% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/remSanityTest.kt.after rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/remSanityTest.kt.after index f4644be3f76..f4018d5224a 100644 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/remSanityTest.kt.after +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/remSanityTest.kt.after @@ -1,4 +1,4 @@ -// INTENTION_TEXT: Replace with '%' operator +// FIX: Replace with '%' operator fun test() { class Test { diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/safeCompareTo.kt b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/safeCompareTo.kt similarity index 90% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/safeCompareTo.kt rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/safeCompareTo.kt index 31d9e26eaef..12812c33484 100644 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/safeCompareTo.kt +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/safeCompareTo.kt @@ -1,4 +1,4 @@ -// IS_APPLICABLE: false +// PROBLEM: none // ERROR: Operator call corresponds to a dot-qualified call 'nullable?.compareTo(1).compareTo(0)' which is not allowed on a nullable receiver 'nullable?.compareTo(1)'. val nullable: Int? = null diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/super.kt b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/super.kt similarity index 87% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/super.kt rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/super.kt index 97e1f9fbcf2..bb7bb1e426c 100644 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/super.kt +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/super.kt @@ -1,4 +1,4 @@ -// IS_APPLICABLE: false +// PROBLEM: none open class Base { open operator fun plus(s: String) = "" diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/timesSanityTest.kt b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/timesSanityTest.kt similarity index 75% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/timesSanityTest.kt rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/timesSanityTest.kt index fa013c9be1a..4d6360550b0 100644 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/timesSanityTest.kt +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/timesSanityTest.kt @@ -1,4 +1,4 @@ -// INTENTION_TEXT: Replace with '*' operator +// FIX: Replace with '*' operator fun test() { class Test { operator fun times(a: Int): Test = Test() diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/timesSanityTest.kt.after b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/timesSanityTest.kt.after similarity index 73% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/timesSanityTest.kt.after rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/timesSanityTest.kt.after index 51a9693a12c..4348f6be10a 100644 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/timesSanityTest.kt.after +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/timesSanityTest.kt.after @@ -1,4 +1,4 @@ -// INTENTION_TEXT: Replace with '*' operator +// FIX: Replace with '*' operator fun test() { class Test { operator fun times(a: Int): Test = Test() diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/typeArguments.kt b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/typeArguments.kt similarity index 85% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/typeArguments.kt rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/typeArguments.kt index f4e8b133a38..ee758b3eb72 100644 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/typeArguments.kt +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/typeArguments.kt @@ -1,4 +1,4 @@ -// IS_APPLICABLE: false +// PROBLEM: none fun test() { class Test { operator fun div(a: Test): T? = a as? T diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/unacceptableVararg1.kt b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/unacceptableVararg1.kt similarity index 91% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/unacceptableVararg1.kt rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/unacceptableVararg1.kt index ff65dc788f3..0c7053354e9 100644 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/unacceptableVararg1.kt +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/unacceptableVararg1.kt @@ -1,4 +1,4 @@ -// IS_APPLICABLE: false +// PROBLEM: none // ERROR: 'operator' modifier is inapplicable on this function: must have a single value parameter fun test() { class Test{ diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/unacceptableVararg2.kt b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/unacceptableVararg2.kt similarity index 91% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/unacceptableVararg2.kt rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/unacceptableVararg2.kt index df2c6685b7d..8547ab4193e 100644 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/unacceptableVararg2.kt +++ b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/unacceptableVararg2.kt @@ -1,4 +1,4 @@ -// IS_APPLICABLE: false +// PROBLEM: none // ERROR: 'operator' modifier is inapplicable on this function: must have a single value parameter fun test() { class Test{ diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/validNamedArgument.kt b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/validNamedArgument.kt similarity index 100% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/validNamedArgument.kt rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/validNamedArgument.kt diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/validNamedArgument.kt.after b/idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/validNamedArgument.kt.after similarity index 100% rename from idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/validNamedArgument.kt.after rename to idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/validNamedArgument.kt.after diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/.intention b/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/.intention deleted file mode 100644 index cf3891326f9..00000000000 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/.intention +++ /dev/null @@ -1 +0,0 @@ -org.jetbrains.kotlin.idea.intentions.conventionNameCalls.ReplaceCallWithBinaryOperatorIntention diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/equals.kt b/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/equals.kt deleted file mode 100644 index b60c3555f3d..00000000000 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/equals.kt +++ /dev/null @@ -1,3 +0,0 @@ -// INTENTION_TEXT: Replace with '==' operator - -val x = 2.equals(2) \ No newline at end of file diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/equals.kt.after b/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/equals.kt.after deleted file mode 100644 index cc156465d9f..00000000000 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/equals.kt.after +++ /dev/null @@ -1,3 +0,0 @@ -// INTENTION_TEXT: Replace with '==' operator - -val x = 2 == 2 \ No newline at end of file diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/greater.kt b/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/greater.kt deleted file mode 100644 index 512be417371..00000000000 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/greater.kt +++ /dev/null @@ -1,3 +0,0 @@ -// INTENTION_TEXT: Replace with '>' operator - -val x = 3.compareTo(2) > 0 \ No newline at end of file diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/greater.kt.after b/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/greater.kt.after deleted file mode 100644 index d1b34eee6e1..00000000000 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/greater.kt.after +++ /dev/null @@ -1,3 +0,0 @@ -// INTENTION_TEXT: Replace with '>' operator - -val x = 3 > 2 \ No newline at end of file diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/lessEquals.kt b/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/lessEquals.kt deleted file mode 100644 index 674875a0a13..00000000000 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/lessEquals.kt +++ /dev/null @@ -1,3 +0,0 @@ -// INTENTION_TEXT: Replace with '<=' operator - -val x = 0 >= 4.compareTo(5) \ No newline at end of file diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/lessEquals.kt.after b/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/lessEquals.kt.after deleted file mode 100644 index eef5c45d02f..00000000000 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/lessEquals.kt.after +++ /dev/null @@ -1,3 +0,0 @@ -// INTENTION_TEXT: Replace with '<=' operator - -val x = 4 <= 5 \ No newline at end of file diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/modSanityTest.kt b/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/modSanityTest.kt deleted file mode 100644 index ce5206d04ef..00000000000 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/modSanityTest.kt +++ /dev/null @@ -1,10 +0,0 @@ -// INTENTION_TEXT: Replace call with binary operator -// IS_APPLICABLE: false - -fun test() { - class Test { - operator fun mod(a: Int): Test = Test() - } - val test = Test() - test.mod(1) -} diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEquals.kt b/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEquals.kt deleted file mode 100644 index cb4b458cf59..00000000000 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEquals.kt +++ /dev/null @@ -1,3 +0,0 @@ -// INTENTION_TEXT: Replace with '!=' operator - -val x = !2.equals(3) \ No newline at end of file diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEquals.kt.after b/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEquals.kt.after deleted file mode 100644 index d750166c834..00000000000 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEquals.kt.after +++ /dev/null @@ -1,3 +0,0 @@ -// INTENTION_TEXT: Replace with '!=' operator - -val x = 2 != 3 \ No newline at end of file diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBrackets.kt b/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBrackets.kt deleted file mode 100644 index 98e40f7ff06..00000000000 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBrackets.kt +++ /dev/null @@ -1,3 +0,0 @@ -// INTENTION_TEXT: Replace with '!=' operator - -val x = !(2.equals(3)) \ No newline at end of file diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBrackets.kt.after b/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBrackets.kt.after deleted file mode 100644 index d750166c834..00000000000 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBrackets.kt.after +++ /dev/null @@ -1,3 +0,0 @@ -// INTENTION_TEXT: Replace with '!=' operator - -val x = 2 != 3 \ No newline at end of file diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBracketsComplex.kt b/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBracketsComplex.kt deleted file mode 100644 index 7a6fefbf036..00000000000 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBracketsComplex.kt +++ /dev/null @@ -1,3 +0,0 @@ -// INTENTION_TEXT: Replace with '==' operator - -val x = !(2.equals(3) && 4.equals(5)) \ No newline at end of file diff --git a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBracketsComplex.kt.after b/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBracketsComplex.kt.after deleted file mode 100644 index 70ff72fd904..00000000000 --- a/idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBracketsComplex.kt.after +++ /dev/null @@ -1,3 +0,0 @@ -// INTENTION_TEXT: Replace with '==' operator - -val x = !(2 == 3 && 4.equals(5)) \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java index 09a45e056d9..51b8d5b14a0 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java @@ -905,6 +905,171 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/inspectionsLocal/conventionNameCalls"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); } + @TestMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ReplaceCallWithBinaryOperator extends AbstractLocalInspectionTest { + public void testAllFilesPresentInReplaceCallWithBinaryOperator() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); + } + + @TestMetadata("divSanityTest.kt") + public void testDivSanityTest() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/divSanityTest.kt"); + doTest(fileName); + } + + @TestMetadata("equals.kt") + public void testEquals() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/equals.kt"); + doTest(fileName); + } + + @TestMetadata("equalsCompareTo.kt") + public void testEqualsCompareTo() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/equalsCompareTo.kt"); + doTest(fileName); + } + + @TestMetadata("equalsExtensionFunction.kt") + public void testEqualsExtensionFunction() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/equalsExtensionFunction.kt"); + doTest(fileName); + } + + @TestMetadata("extensionFunction.kt") + public void testExtensionFunction() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/extensionFunction.kt"); + doTest(fileName); + } + + @TestMetadata("functionLiteralArgument.kt") + public void testFunctionLiteralArgument() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/functionLiteralArgument.kt"); + doTest(fileName); + } + + @TestMetadata("greater.kt") + public void testGreater() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/greater.kt"); + doTest(fileName); + } + + @TestMetadata("lessEquals.kt") + public void testLessEquals() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/lessEquals.kt"); + doTest(fileName); + } + + @TestMetadata("minusSanityTest.kt") + public void testMinusSanityTest() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/minusSanityTest.kt"); + doTest(fileName); + } + + @TestMetadata("missingDefaultArgument.kt") + public void testMissingDefaultArgument() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/missingDefaultArgument.kt"); + doTest(fileName); + } + + @TestMetadata("modSanityTest.kt") + public void testModSanityTest() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/modSanityTest.kt"); + doTest(fileName); + } + + @TestMetadata("multipleArguments.kt") + public void testMultipleArguments() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/multipleArguments.kt"); + doTest(fileName); + } + + @TestMetadata("notEquals.kt") + public void testNotEquals() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEquals.kt"); + doTest(fileName); + } + + @TestMetadata("notEqualsBrackets.kt") + public void testNotEqualsBrackets() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBrackets.kt"); + doTest(fileName); + } + + @TestMetadata("notEqualsBracketsComplex.kt") + public void testNotEqualsBracketsComplex() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBracketsComplex.kt"); + doTest(fileName); + } + + @TestMetadata("plusSanityTest.kt") + public void testPlusSanityTest() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/plusSanityTest.kt"); + doTest(fileName); + } + + @TestMetadata("qualifier.kt") + public void testQualifier() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/qualifier.kt"); + doTest(fileName); + } + + @TestMetadata("rangeToSanityTest.kt") + public void testRangeToSanityTest() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/rangeToSanityTest.kt"); + doTest(fileName); + } + + @TestMetadata("remSanityTest.kt") + public void testRemSanityTest() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/remSanityTest.kt"); + doTest(fileName); + } + + @TestMetadata("safeCompareTo.kt") + public void testSafeCompareTo() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/safeCompareTo.kt"); + doTest(fileName); + } + + @TestMetadata("super.kt") + public void testSuper() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/super.kt"); + doTest(fileName); + } + + @TestMetadata("timesSanityTest.kt") + public void testTimesSanityTest() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/timesSanityTest.kt"); + doTest(fileName); + } + + @TestMetadata("typeArguments.kt") + public void testTypeArguments() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/typeArguments.kt"); + doTest(fileName); + } + + @TestMetadata("unacceptableVararg1.kt") + public void testUnacceptableVararg1() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/unacceptableVararg1.kt"); + doTest(fileName); + } + + @TestMetadata("unacceptableVararg2.kt") + public void testUnacceptableVararg2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/unacceptableVararg2.kt"); + doTest(fileName); + } + + @TestMetadata("validNamedArgument.kt") + public void testValidNamedArgument() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceCallWithBinaryOperator/validNamedArgument.kt"); + doTest(fileName); + } + } + @TestMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java index 8ba31c75e25..b09f2a33552 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java @@ -3086,171 +3086,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/conventionNameCalls"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); } - @TestMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class ReplaceCallWithBinaryOperator extends AbstractIntentionTest { - public void testAllFilesPresentInReplaceCallWithBinaryOperator() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); - } - - @TestMetadata("divSanityTest.kt") - public void testDivSanityTest() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/divSanityTest.kt"); - doTest(fileName); - } - - @TestMetadata("equals.kt") - public void testEquals() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/equals.kt"); - doTest(fileName); - } - - @TestMetadata("equalsCompareTo.kt") - public void testEqualsCompareTo() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/equalsCompareTo.kt"); - doTest(fileName); - } - - @TestMetadata("equalsExtensionFunction.kt") - public void testEqualsExtensionFunction() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/equalsExtensionFunction.kt"); - doTest(fileName); - } - - @TestMetadata("extensionFunction.kt") - public void testExtensionFunction() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/extensionFunction.kt"); - doTest(fileName); - } - - @TestMetadata("functionLiteralArgument.kt") - public void testFunctionLiteralArgument() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/functionLiteralArgument.kt"); - doTest(fileName); - } - - @TestMetadata("greater.kt") - public void testGreater() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/greater.kt"); - doTest(fileName); - } - - @TestMetadata("lessEquals.kt") - public void testLessEquals() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/lessEquals.kt"); - doTest(fileName); - } - - @TestMetadata("minusSanityTest.kt") - public void testMinusSanityTest() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/minusSanityTest.kt"); - doTest(fileName); - } - - @TestMetadata("missingDefaultArgument.kt") - public void testMissingDefaultArgument() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/missingDefaultArgument.kt"); - doTest(fileName); - } - - @TestMetadata("modSanityTest.kt") - public void testModSanityTest() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/modSanityTest.kt"); - doTest(fileName); - } - - @TestMetadata("multipleArguments.kt") - public void testMultipleArguments() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/multipleArguments.kt"); - doTest(fileName); - } - - @TestMetadata("notEquals.kt") - public void testNotEquals() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEquals.kt"); - doTest(fileName); - } - - @TestMetadata("notEqualsBrackets.kt") - public void testNotEqualsBrackets() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBrackets.kt"); - doTest(fileName); - } - - @TestMetadata("notEqualsBracketsComplex.kt") - public void testNotEqualsBracketsComplex() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/notEqualsBracketsComplex.kt"); - doTest(fileName); - } - - @TestMetadata("plusSanityTest.kt") - public void testPlusSanityTest() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/plusSanityTest.kt"); - doTest(fileName); - } - - @TestMetadata("qualifier.kt") - public void testQualifier() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/qualifier.kt"); - doTest(fileName); - } - - @TestMetadata("rangeToSanityTest.kt") - public void testRangeToSanityTest() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/rangeToSanityTest.kt"); - doTest(fileName); - } - - @TestMetadata("remSanityTest.kt") - public void testRemSanityTest() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/remSanityTest.kt"); - doTest(fileName); - } - - @TestMetadata("safeCompareTo.kt") - public void testSafeCompareTo() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/safeCompareTo.kt"); - doTest(fileName); - } - - @TestMetadata("super.kt") - public void testSuper() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/super.kt"); - doTest(fileName); - } - - @TestMetadata("timesSanityTest.kt") - public void testTimesSanityTest() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/timesSanityTest.kt"); - doTest(fileName); - } - - @TestMetadata("typeArguments.kt") - public void testTypeArguments() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/typeArguments.kt"); - doTest(fileName); - } - - @TestMetadata("unacceptableVararg1.kt") - public void testUnacceptableVararg1() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/unacceptableVararg1.kt"); - doTest(fileName); - } - - @TestMetadata("unacceptableVararg2.kt") - public void testUnacceptableVararg2() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/unacceptableVararg2.kt"); - doTest(fileName); - } - - @TestMetadata("validNamedArgument.kt") - public void testValidNamedArgument() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/validNamedArgument.kt"); - doTest(fileName); - } - } - @TestMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)