diff --git a/idea/resources/inspectionDescriptions/ReplaceRangeToWithUntil.html b/idea/resources/inspectionDescriptions/ReplaceRangeToWithUntil.html
new file mode 100644
index 00000000000..574a5b22a61
--- /dev/null
+++ b/idea/resources/inspectionDescriptions/ReplaceRangeToWithUntil.html
@@ -0,0 +1,5 @@
+
+
+This inspection reports calls to 'rangeTo' or the '..' operator instead of calls to 'until'.
+
+
diff --git a/idea/resources/intentionDescriptions/ReplaceRangeToWithUntilIntention/after.kt.template b/idea/resources/intentionDescriptions/ReplaceRangeToWithUntilIntention/after.kt.template
deleted file mode 100644
index 1efa896629b..00000000000
--- a/idea/resources/intentionDescriptions/ReplaceRangeToWithUntilIntention/after.kt.template
+++ /dev/null
@@ -1 +0,0 @@
-a until b
\ No newline at end of file
diff --git a/idea/resources/intentionDescriptions/ReplaceRangeToWithUntilIntention/before.kt.template b/idea/resources/intentionDescriptions/ReplaceRangeToWithUntilIntention/before.kt.template
deleted file mode 100644
index e2c2168b033..00000000000
--- a/idea/resources/intentionDescriptions/ReplaceRangeToWithUntilIntention/before.kt.template
+++ /dev/null
@@ -1 +0,0 @@
-a..b-1
diff --git a/idea/resources/intentionDescriptions/ReplaceRangeToWithUntilIntention/description.html b/idea/resources/intentionDescriptions/ReplaceRangeToWithUntilIntention/description.html
deleted file mode 100644
index f7fcd47e779..00000000000
--- a/idea/resources/intentionDescriptions/ReplaceRangeToWithUntilIntention/description.html
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-This intention replaces calls to 'rangeTo' or the '..' operator with calls to 'until' and offsets the upper bound by 1.
-
-
\ No newline at end of file
diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml
index 35465587a74..45385c0a3db 100644
--- a/idea/src/META-INF/plugin.xml
+++ b/idea/src/META-INF/plugin.xml
@@ -1403,11 +1403,6 @@
Kotlin
-
- org.jetbrains.kotlin.idea.intentions.ReplaceRangeToWithUntilIntention
- Kotlin
-
-
org.jetbrains.kotlin.idea.intentions.ReplaceUntilWithRangeToIntention
Kotlin
@@ -2188,6 +2183,14 @@
language="kotlin"
/>
+
+
diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceRangeToWithUntilInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceRangeToWithUntilInspection.kt
new file mode 100644
index 00000000000..d7a0b6427d4
--- /dev/null
+++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceRangeToWithUntilInspection.kt
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2010-2017 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+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.openapi.project.Project
+import com.intellij.psi.PsiElementVisitor
+import org.jetbrains.kotlin.idea.caches.resolve.analyze
+import org.jetbrains.kotlin.idea.intentions.getArguments
+import org.jetbrains.kotlin.idea.intentions.getCallableDescriptor
+import org.jetbrains.kotlin.lexer.KtTokens
+import org.jetbrains.kotlin.psi.*
+import org.jetbrains.kotlin.resolve.calls.callUtil.getType
+import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluator
+import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
+import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
+
+private val REGEX_RANGE_TO = """kotlin.(Char|Byte|Short|Int|Long).rangeTo""".toRegex()
+
+class ReplaceRangeToWithUntilInspection : AbstractKotlinInspection() {
+
+ override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor {
+ return object : KtVisitorVoid() {
+ override fun visitExpression(expression: KtExpression) {
+ super.visitExpression(expression)
+
+ if (expression !is KtBinaryExpression && expression !is KtDotQualifiedExpression) return
+
+ val fqName = expression.getCallableDescriptor()?.fqNameUnsafe?.asString() ?: return
+ if (!fqName.matches(REGEX_RANGE_TO)) return
+
+ if (expression.getArguments()?.second?.isMinusOne() != true) return
+
+ holder.registerProblem(
+ expression,
+ "'rangeTo' or the '..' call can be replaced with 'until'",
+ ProblemHighlightType.WEAK_WARNING,
+ ReplaceWithUntilQuickFix()
+ )
+ }
+ }
+ }
+
+ class ReplaceWithUntilQuickFix : LocalQuickFix {
+
+ override fun getName() = "Replace with until"
+
+ override fun getFamilyName() = name
+
+ override fun applyFix(project: Project, descriptor: ProblemDescriptor) {
+ val element = descriptor.psiElement as KtExpression
+ val args = element.getArguments() ?: return
+ element.replace(KtPsiFactory(element).createExpressionByPattern(
+ "$0 until $1",
+ args.first ?: return,
+ (args.second as? KtBinaryExpression)?.left ?: return)
+ )
+ }
+
+ }
+
+ private fun KtExpression.isMinusOne(): Boolean {
+ if (this !is KtBinaryExpression) return false
+ if (operationToken != KtTokens.MINUS) return false
+
+ val right = right as? KtConstantExpression ?: return false
+ val context = right.analyze(BodyResolveMode.PARTIAL)
+ val constantValue = ConstantExpressionEvaluator.getConstant(right, context)?.toConstantValue(right.getType(context) ?: return false)
+ val rightValue = (constantValue?.value as? Number)?.toInt() ?: return false
+ return rightValue == 1
+ }
+}
\ No newline at end of file
diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceRangeToWithUntilIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceRangeToWithUntilIntention.kt
deleted file mode 100644
index 085953f9aed..00000000000
--- a/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceRangeToWithUntilIntention.kt
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright 2010-2016 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jetbrains.kotlin.idea.intentions
-
-import com.intellij.openapi.editor.Editor
-import org.jetbrains.kotlin.idea.caches.resolve.analyze
-import org.jetbrains.kotlin.lexer.KtTokens
-import org.jetbrains.kotlin.psi.*
-import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
-import org.jetbrains.kotlin.resolve.calls.callUtil.getType
-import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluator
-import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
-import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
-
-private fun KtExpression.getCallableDescriptor() = getResolvedCall(analyze())?.resultingDescriptor
-
-private fun KtExpression.getArguments() = when (this) {
- is KtBinaryExpression -> this.left to this.right
- is KtDotQualifiedExpression -> this.receiverExpression to this.callExpression?.valueArguments?.singleOrNull()?.getArgumentExpression()
- else -> null
-}
-
-private val REGEX_RANGE_TO = """kotlin.(Char|Byte|Short|Int|Long).rangeTo""".toRegex()
-
-class ReplaceRangeToWithUntilIntention : SelfTargetingIntention(
- KtExpression::class.java,
- "Replace with 'until' function call"
-) {
-
- override fun isApplicableTo(element: KtExpression, caretOffset: Int): Boolean {
- if (element !is KtBinaryExpression && element !is KtDotQualifiedExpression) return false
-
- val fqName = element.getCallableDescriptor()?.fqNameUnsafe?.asString() ?: return false
- if (!fqName.matches(REGEX_RANGE_TO)) return false
- return element.getArguments()?.second?.isMinusOne() == true
- }
-
- override fun applyTo(element: KtExpression, editor: Editor?) {
- val args = element.getArguments() ?: return
- element.replace(KtPsiFactory(element).createExpressionByPattern("$0 until $1",
- args.first ?: return,
- (args.second as? KtBinaryExpression)?.left ?: return))
- }
-
- private fun KtExpression.isMinusOne(): Boolean {
- if (this !is KtBinaryExpression) return false
- if (operationToken != KtTokens.MINUS) return false
-
- val right = right as? KtConstantExpression ?: return false
- val context = right.analyze(BodyResolveMode.PARTIAL)
- val constantValue = ConstantExpressionEvaluator.getConstant(right, context)?.toConstantValue(right.getType(context) ?: return false)
- val rightValue = (constantValue?.value as? Number)?.toInt() ?: return false
- return rightValue == 1
- }
-
-}
-
-class ReplaceUntilWithRangeToIntention : SelfTargetingIntention(KtExpression::class.java, "Replace with '..' operator") {
- override fun isApplicableTo(element: KtExpression, caretOffset: Int): Boolean {
- if (element !is KtBinaryExpression && element !is KtDotQualifiedExpression) return false
- val fqName = element.getCallableDescriptor()?.fqNameUnsafe?.asString() ?: return false
- return fqName == "kotlin.ranges.until"
- }
-
- override fun applyTo(element: KtExpression, editor: Editor?) {
- val args = element.getArguments() ?: return
- element.replace(KtPsiFactory(element).createExpressionByPattern("$0..$1 - 1", args.first ?: return, args.second ?: return))
- }
-}
\ No newline at end of file
diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceUntilWithRangeToIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceUntilWithRangeToIntention.kt
new file mode 100644
index 00000000000..cfc9d352f36
--- /dev/null
+++ b/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceUntilWithRangeToIntention.kt
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2010-2016 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.kotlin.idea.intentions
+
+import com.intellij.openapi.editor.Editor
+import org.jetbrains.kotlin.idea.caches.resolve.analyze
+import org.jetbrains.kotlin.psi.*
+import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
+import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
+
+internal fun KtExpression.getCallableDescriptor() = getResolvedCall(analyze())?.resultingDescriptor
+
+internal fun KtExpression.getArguments() = when (this) {
+ is KtBinaryExpression -> this.left to this.right
+ is KtDotQualifiedExpression -> this.receiverExpression to this.callExpression?.valueArguments?.singleOrNull()?.getArgumentExpression()
+ else -> null
+}
+
+class ReplaceUntilWithRangeToIntention : SelfTargetingIntention(KtExpression::class.java, "Replace with '..' operator") {
+ override fun isApplicableTo(element: KtExpression, caretOffset: Int): Boolean {
+ if (element !is KtBinaryExpression && element !is KtDotQualifiedExpression) return false
+ val fqName = element.getCallableDescriptor()?.fqNameUnsafe?.asString() ?: return false
+ return fqName == "kotlin.ranges.until"
+ }
+
+ override fun applyTo(element: KtExpression, editor: Editor?) {
+ val args = element.getArguments() ?: return
+ element.replace(KtPsiFactory(element).createExpressionByPattern("$0..$1 - 1", args.first ?: return, args.second ?: return))
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/inspections/replaceRangeToWithUntil/inspectionData/expected.xml b/idea/testData/inspections/replaceRangeToWithUntil/inspectionData/expected.xml
new file mode 100644
index 00000000000..68c2ba1ecb5
--- /dev/null
+++ b/idea/testData/inspections/replaceRangeToWithUntil/inspectionData/expected.xml
@@ -0,0 +1,18 @@
+
+
+ test.kt
+ 3
+ light_idea_test_case
+
+ 'rangeTo' or the '..' call can be replaced with 'until'
+ 'rangeTo' or the '..' call can be replaced with 'until'
+
+
+ test.kt
+ 8
+ light_idea_test_case
+
+ 'rangeTo' or the '..' call can be replaced with 'until'
+ 'rangeTo' or the '..' call can be replaced with 'until'
+
+
\ No newline at end of file
diff --git a/idea/testData/inspections/replaceRangeToWithUntil/inspectionData/inspections.test b/idea/testData/inspections/replaceRangeToWithUntil/inspectionData/inspections.test
new file mode 100644
index 00000000000..e8279b4910e
--- /dev/null
+++ b/idea/testData/inspections/replaceRangeToWithUntil/inspectionData/inspections.test
@@ -0,0 +1 @@
+// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.ReplaceRangeToWithUntilInspection
\ No newline at end of file
diff --git a/idea/testData/inspections/replaceRangeToWithUntil/test.kt b/idea/testData/inspections/replaceRangeToWithUntil/test.kt
new file mode 100644
index 00000000000..ea57308e6f7
--- /dev/null
+++ b/idea/testData/inspections/replaceRangeToWithUntil/test.kt
@@ -0,0 +1,9 @@
+fun foo() {
+ val n = 10
+ for (i in 0 .. n - 1) {}
+}
+
+fun bar() {
+ val n = 10
+ for (i in 0.rangeTo(n - 1)) {}
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/replaceRangeToWithUntil/.inspection b/idea/testData/inspectionsLocal/replaceRangeToWithUntil/.inspection
new file mode 100644
index 00000000000..52a2c60245e
--- /dev/null
+++ b/idea/testData/inspectionsLocal/replaceRangeToWithUntil/.inspection
@@ -0,0 +1 @@
+org.jetbrains.kotlin.idea.inspections.ReplaceRangeToWithUntilInspection
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceRangeToWithUntil/closedRange.kt b/idea/testData/inspectionsLocal/replaceRangeToWithUntil/closedRange.kt
similarity index 71%
rename from idea/testData/intentions/replaceRangeToWithUntil/closedRange.kt
rename to idea/testData/inspectionsLocal/replaceRangeToWithUntil/closedRange.kt
index 78702df65ff..7a2bd474ef2 100644
--- a/idea/testData/intentions/replaceRangeToWithUntil/closedRange.kt
+++ b/idea/testData/inspectionsLocal/replaceRangeToWithUntil/closedRange.kt
@@ -1,5 +1,5 @@
// WITH_RUNTIME
-// IS_APPLICABLE: false
+// PROBLEM: none
fun foo(a: Float) {
1f..a - 1
diff --git a/idea/testData/intentions/replaceRangeToWithUntil/minusTwo.kt b/idea/testData/inspectionsLocal/replaceRangeToWithUntil/minusTwo.kt
similarity index 76%
rename from idea/testData/intentions/replaceRangeToWithUntil/minusTwo.kt
rename to idea/testData/inspectionsLocal/replaceRangeToWithUntil/minusTwo.kt
index fb48d5920e5..226d78f084c 100644
--- a/idea/testData/intentions/replaceRangeToWithUntil/minusTwo.kt
+++ b/idea/testData/inspectionsLocal/replaceRangeToWithUntil/minusTwo.kt
@@ -1,5 +1,5 @@
// WITH_RUNTIME
-// IS_APPLICABLE: false
+// PROBLEM: none
fun foo(a: Int) {
for (i in 0..a - 2) {
diff --git a/idea/testData/intentions/replaceRangeToWithUntil/notMinusOne.kt b/idea/testData/inspectionsLocal/replaceRangeToWithUntil/notMinusOne.kt
similarity index 75%
rename from idea/testData/intentions/replaceRangeToWithUntil/notMinusOne.kt
rename to idea/testData/inspectionsLocal/replaceRangeToWithUntil/notMinusOne.kt
index 3ece06af44f..15e8913579a 100644
--- a/idea/testData/intentions/replaceRangeToWithUntil/notMinusOne.kt
+++ b/idea/testData/inspectionsLocal/replaceRangeToWithUntil/notMinusOne.kt
@@ -1,5 +1,5 @@
// WITH_RUNTIME
-// IS_APPLICABLE: false
+// PROBLEM: none
fun foo(a: Int) {
for (i in 0..a) {
diff --git a/idea/testData/intentions/replaceRangeToWithUntil/operator.kt b/idea/testData/inspectionsLocal/replaceRangeToWithUntil/operator.kt
similarity index 56%
rename from idea/testData/intentions/replaceRangeToWithUntil/operator.kt
rename to idea/testData/inspectionsLocal/replaceRangeToWithUntil/operator.kt
index fb00b189ad2..513f82b89b6 100644
--- a/idea/testData/intentions/replaceRangeToWithUntil/operator.kt
+++ b/idea/testData/inspectionsLocal/replaceRangeToWithUntil/operator.kt
@@ -1,7 +1,7 @@
// WITH_RUNTIME
fun foo(a: Int) {
- for (i in 0..a - 1) {
+ for (i in 0..a - 1) {
}
}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceRangeToWithUntil/operator.kt.after b/idea/testData/inspectionsLocal/replaceRangeToWithUntil/operator.kt.after
similarity index 55%
rename from idea/testData/intentions/replaceRangeToWithUntil/operator.kt.after
rename to idea/testData/inspectionsLocal/replaceRangeToWithUntil/operator.kt.after
index 6109f8b93bd..379f02114c5 100644
--- a/idea/testData/intentions/replaceRangeToWithUntil/operator.kt.after
+++ b/idea/testData/inspectionsLocal/replaceRangeToWithUntil/operator.kt.after
@@ -1,7 +1,7 @@
// WITH_RUNTIME
fun foo(a: Int) {
- for (i in 0 until a) {
+ for (i in 0 until a) {
}
}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceRangeToWithUntil/operatorLong.kt b/idea/testData/inspectionsLocal/replaceRangeToWithUntil/operatorLong.kt
similarity index 55%
rename from idea/testData/intentions/replaceRangeToWithUntil/operatorLong.kt
rename to idea/testData/inspectionsLocal/replaceRangeToWithUntil/operatorLong.kt
index 135db06bf6b..f51a0a4204f 100644
--- a/idea/testData/intentions/replaceRangeToWithUntil/operatorLong.kt
+++ b/idea/testData/inspectionsLocal/replaceRangeToWithUntil/operatorLong.kt
@@ -1,7 +1,7 @@
// WITH_RUNTIME
fun foo(a: Long) {
- for (i in 1L..a - 1L) {
+ for (i in 1L..a - 1L) {
}
}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceRangeToWithUntil/operatorLong.kt.after b/idea/testData/inspectionsLocal/replaceRangeToWithUntil/operatorLong.kt.after
similarity index 55%
rename from idea/testData/intentions/replaceRangeToWithUntil/operatorLong.kt.after
rename to idea/testData/inspectionsLocal/replaceRangeToWithUntil/operatorLong.kt.after
index 7faae7b6a3b..3288e711076 100644
--- a/idea/testData/intentions/replaceRangeToWithUntil/operatorLong.kt.after
+++ b/idea/testData/inspectionsLocal/replaceRangeToWithUntil/operatorLong.kt.after
@@ -1,7 +1,7 @@
// WITH_RUNTIME
fun foo(a: Long) {
- for (i in 1L until a) {
+ for (i in 1L until a) {
}
}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceRangeToWithUntil/plusOne.kt b/idea/testData/inspectionsLocal/replaceRangeToWithUntil/plusOne.kt
similarity index 76%
rename from idea/testData/intentions/replaceRangeToWithUntil/plusOne.kt
rename to idea/testData/inspectionsLocal/replaceRangeToWithUntil/plusOne.kt
index 814ac76fb49..f0e6aebab39 100644
--- a/idea/testData/intentions/replaceRangeToWithUntil/plusOne.kt
+++ b/idea/testData/inspectionsLocal/replaceRangeToWithUntil/plusOne.kt
@@ -1,5 +1,5 @@
// WITH_RUNTIME
-// IS_APPLICABLE: false
+// PROBLEM: none
fun foo(a: Int) {
for (i in 0..a + 1) {
diff --git a/idea/testData/intentions/replaceRangeToWithUntil/rangeTo.kt b/idea/testData/inspectionsLocal/replaceRangeToWithUntil/rangeTo.kt
similarity index 51%
rename from idea/testData/intentions/replaceRangeToWithUntil/rangeTo.kt
rename to idea/testData/inspectionsLocal/replaceRangeToWithUntil/rangeTo.kt
index 72fab0da864..c18f0074114 100644
--- a/idea/testData/intentions/replaceRangeToWithUntil/rangeTo.kt
+++ b/idea/testData/inspectionsLocal/replaceRangeToWithUntil/rangeTo.kt
@@ -1,7 +1,7 @@
// WITH_RUNTIME
fun foo(a: Int) {
- for (i in 0.rangeTo(a - 1)) {
+ for (i in 0.rangeTo(a - 1)) {
}
}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceRangeToWithUntil/rangeTo.kt.after b/idea/testData/inspectionsLocal/replaceRangeToWithUntil/rangeTo.kt.after
similarity index 55%
rename from idea/testData/intentions/replaceRangeToWithUntil/rangeTo.kt.after
rename to idea/testData/inspectionsLocal/replaceRangeToWithUntil/rangeTo.kt.after
index 6109f8b93bd..379f02114c5 100644
--- a/idea/testData/intentions/replaceRangeToWithUntil/rangeTo.kt.after
+++ b/idea/testData/inspectionsLocal/replaceRangeToWithUntil/rangeTo.kt.after
@@ -1,7 +1,7 @@
// WITH_RUNTIME
fun foo(a: Int) {
- for (i in 0 until a) {
+ for (i in 0 until a) {
}
}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceRangeToWithUntil/.intention b/idea/testData/intentions/replaceRangeToWithUntil/.intention
deleted file mode 100644
index 5faf679b8df..00000000000
--- a/idea/testData/intentions/replaceRangeToWithUntil/.intention
+++ /dev/null
@@ -1 +0,0 @@
-org.jetbrains.kotlin.idea.intentions.ReplaceRangeToWithUntilIntention
\ No newline at end of file
diff --git a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/InspectionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/InspectionTestGenerated.java
index 5fd09d9853a..4b239c2c9c5 100644
--- a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/InspectionTestGenerated.java
+++ b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/InspectionTestGenerated.java
@@ -299,6 +299,12 @@ public class InspectionTestGenerated extends AbstractInspectionTest {
doTest(fileName);
}
+ @TestMetadata("replaceRangeToWithUntil/inspectionData/inspections.test")
+ public void testReplaceRangeToWithUntil_inspectionData_Inspections_test() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspections/replaceRangeToWithUntil/inspectionData/inspections.test");
+ doTest(fileName);
+ }
+
@TestMetadata("spelling/inspectionData/inspections.test")
public void testSpelling_inspectionData_Inspections_test() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspections/spelling/inspectionData/inspections.test");
diff --git a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java
index 911dfc468dd..457a7d3f87e 100644
--- a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java
+++ b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java
@@ -209,4 +209,55 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
doTest(fileName);
}
}
+
+ @TestMetadata("idea/testData/inspectionsLocal/replaceRangeToWithUntil")
+ @TestDataPath("$PROJECT_ROOT")
+ @RunWith(JUnit3RunnerWithInners.class)
+ public static class ReplaceRangeToWithUntil extends AbstractLocalInspectionTest {
+ public void testAllFilesPresentInReplaceRangeToWithUntil() throws Exception {
+ KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/inspectionsLocal/replaceRangeToWithUntil"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
+ }
+
+ @TestMetadata("closedRange.kt")
+ public void testClosedRange() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/replaceRangeToWithUntil/closedRange.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("minusTwo.kt")
+ public void testMinusTwo() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/replaceRangeToWithUntil/minusTwo.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("notMinusOne.kt")
+ public void testNotMinusOne() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/replaceRangeToWithUntil/notMinusOne.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("operator.kt")
+ public void testOperator() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/replaceRangeToWithUntil/operator.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("operatorLong.kt")
+ public void testOperatorLong() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/replaceRangeToWithUntil/operatorLong.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("plusOne.kt")
+ public void testPlusOne() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/replaceRangeToWithUntil/plusOne.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("rangeTo.kt")
+ public void testRangeTo() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/replaceRangeToWithUntil/rangeTo.kt");
+ doTest(fileName);
+ }
+ }
}
diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java
index 576bd50735b..9da5982b3c3 100644
--- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java
+++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java
@@ -13512,57 +13512,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
}
}
- @TestMetadata("idea/testData/intentions/replaceRangeToWithUntil")
- @TestDataPath("$PROJECT_ROOT")
- @RunWith(JUnit3RunnerWithInners.class)
- public static class ReplaceRangeToWithUntil extends AbstractIntentionTest {
- public void testAllFilesPresentInReplaceRangeToWithUntil() throws Exception {
- KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/replaceRangeToWithUntil"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
- }
-
- @TestMetadata("closedRange.kt")
- public void testClosedRange() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceRangeToWithUntil/closedRange.kt");
- doTest(fileName);
- }
-
- @TestMetadata("minusTwo.kt")
- public void testMinusTwo() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceRangeToWithUntil/minusTwo.kt");
- doTest(fileName);
- }
-
- @TestMetadata("notMinusOne.kt")
- public void testNotMinusOne() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceRangeToWithUntil/notMinusOne.kt");
- doTest(fileName);
- }
-
- @TestMetadata("operator.kt")
- public void testOperator() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceRangeToWithUntil/operator.kt");
- doTest(fileName);
- }
-
- @TestMetadata("operatorLong.kt")
- public void testOperatorLong() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceRangeToWithUntil/operatorLong.kt");
- doTest(fileName);
- }
-
- @TestMetadata("plusOne.kt")
- public void testPlusOne() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceRangeToWithUntil/plusOne.kt");
- doTest(fileName);
- }
-
- @TestMetadata("rangeTo.kt")
- public void testRangeTo() throws Exception {
- String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceRangeToWithUntil/rangeTo.kt");
- doTest(fileName);
- }
- }
-
@TestMetadata("idea/testData/intentions/replaceSingleLineLetIntention")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)