diff --git a/idea/resources/intentionDescriptions/ConvertRangeCheckToTwoComparisonsIntention/after.kt.template b/idea/resources/intentionDescriptions/ConvertRangeCheckToTwoComparisonsIntention/after.kt.template
new file mode 100644
index 00000000000..7ea8a8ae6f9
--- /dev/null
+++ b/idea/resources/intentionDescriptions/ConvertRangeCheckToTwoComparisonsIntention/after.kt.template
@@ -0,0 +1 @@
+fun foo(arg: Int) = 1 <= arg && arg <= 4
\ No newline at end of file
diff --git a/idea/resources/intentionDescriptions/ConvertRangeCheckToTwoComparisonsIntention/before.kt.template b/idea/resources/intentionDescriptions/ConvertRangeCheckToTwoComparisonsIntention/before.kt.template
new file mode 100644
index 00000000000..df1685e967e
--- /dev/null
+++ b/idea/resources/intentionDescriptions/ConvertRangeCheckToTwoComparisonsIntention/before.kt.template
@@ -0,0 +1 @@
+fun foo(arg: Int) = arg in 1..4
\ No newline at end of file
diff --git a/idea/resources/intentionDescriptions/ConvertRangeCheckToTwoComparisonsIntention/description.html b/idea/resources/intentionDescriptions/ConvertRangeCheckToTwoComparisonsIntention/description.html
new file mode 100644
index 00000000000..607909f3d25
--- /dev/null
+++ b/idea/resources/intentionDescriptions/ConvertRangeCheckToTwoComparisonsIntention/description.html
@@ -0,0 +1,5 @@
+
+
+This intention converts range check (in) to two consecutive comparisons
+
+
\ No newline at end of file
diff --git a/idea/resources/intentionDescriptions/ConvertTwoComparisonsToRangeCheckIntention/after.kt.template b/idea/resources/intentionDescriptions/ConvertTwoComparisonsToRangeCheckIntention/after.kt.template
new file mode 100644
index 00000000000..df1685e967e
--- /dev/null
+++ b/idea/resources/intentionDescriptions/ConvertTwoComparisonsToRangeCheckIntention/after.kt.template
@@ -0,0 +1 @@
+fun foo(arg: Int) = arg in 1..4
\ No newline at end of file
diff --git a/idea/resources/intentionDescriptions/ConvertTwoComparisonsToRangeCheckIntention/before.kt.template b/idea/resources/intentionDescriptions/ConvertTwoComparisonsToRangeCheckIntention/before.kt.template
new file mode 100644
index 00000000000..7ea8a8ae6f9
--- /dev/null
+++ b/idea/resources/intentionDescriptions/ConvertTwoComparisonsToRangeCheckIntention/before.kt.template
@@ -0,0 +1 @@
+fun foo(arg: Int) = 1 <= arg && arg <= 4
\ No newline at end of file
diff --git a/idea/resources/intentionDescriptions/ConvertTwoComparisonsToRangeCheckIntention/description.html b/idea/resources/intentionDescriptions/ConvertTwoComparisonsToRangeCheckIntention/description.html
new file mode 100644
index 00000000000..01d889b674f
--- /dev/null
+++ b/idea/resources/intentionDescriptions/ConvertTwoComparisonsToRangeCheckIntention/description.html
@@ -0,0 +1,5 @@
+
+
+This intention converts two consecutive comparisons to range check (in)
+
+
\ No newline at end of file
diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml
index e11d744e16a..6014ccea7fd 100644
--- a/idea/src/META-INF/plugin.xml
+++ b/idea/src/META-INF/plugin.xml
@@ -1469,6 +1469,16 @@
Kotlin
+
+ org.jetbrains.kotlin.idea.intentions.ConvertTwoComparisonsToRangeCheckIntention
+ Kotlin
+
+
+
+ org.jetbrains.kotlin.idea.intentions.ConvertRangeCheckToTwoComparisonsIntention
+ Kotlin
+
+
(
+ KtBinaryExpression::class.java,
+ "Convert to comparisons"
+) {
+ private fun KtExpression?.isSimple() = this is KtConstantExpression || this is KtNameReferenceExpression
+
+ override fun applyTo(element: KtBinaryExpression, editor: Editor?) {
+ if (element.operationToken != KtTokens.IN_KEYWORD) return
+ val rangeExpression = element.right as? KtBinaryExpression ?: return
+ val min = rangeExpression.left ?: return
+ val arg = element.left ?: return
+ val max = rangeExpression.right ?: return
+ val comparisonsExpression = KtPsiFactory(element).createExpressionByPattern("$0 <= $1 && $1 <= $2", min, arg, max)
+ element.replace(comparisonsExpression)
+ }
+
+ override fun isApplicableTo(element: KtBinaryExpression): Boolean {
+ if (element.operationToken != KtTokens.IN_KEYWORD) return false
+
+ // ignore for-loop. for(x in 1..2) should not be convert to for(1<=x && x<=2)
+ if (element.parent is KtForExpression) return false
+
+ val rangeExpression = element.right as? KtBinaryExpression ?: return false
+ if (rangeExpression.operationToken != KtTokens.RANGE) return false
+
+ return element.left.isSimple() && rangeExpression.left.isSimple() && rangeExpression.right.isSimple()
+ }
+}
\ No newline at end of file
diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertTwoComparisonsToRangeCheckIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertTwoComparisonsToRangeCheckIntention.kt
new file mode 100644
index 00000000000..d3a52a0274c
--- /dev/null
+++ b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertTwoComparisonsToRangeCheckIntention.kt
@@ -0,0 +1,139 @@
+/*
+ * 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 com.intellij.psi.tree.IElementType
+import org.jetbrains.kotlin.builtins.KotlinBuiltIns
+import org.jetbrains.kotlin.idea.caches.resolve.analyze
+import org.jetbrains.kotlin.idea.intentions.branchedTransformations.evaluatesTo
+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.types.KotlinType
+
+class ConvertTwoComparisonsToRangeCheckIntention : SelfTargetingOffsetIndependentIntention(
+ KtBinaryExpression::class.java,
+ "Convert to range check"
+) {
+
+ private data class RangeExpressionData(val value: KtExpression, val min: String, val max: String)
+
+ override fun isApplicableTo(element: KtBinaryExpression) = generateRangeExpressionData(element) != null
+
+ override fun applyTo(element: KtBinaryExpression, editor: Editor?) {
+ val rangeData = generateRangeExpressionData(element) ?: return
+ val factory = KtPsiFactory(element)
+ element.replace(factory.createExpressionByPattern("$0 in $1..$2", rangeData.value,
+ factory.createExpression(rangeData.min),
+ factory.createExpression(rangeData.max)))
+ }
+
+ private fun generateRangeExpressionData(condition: KtBinaryExpression): RangeExpressionData? {
+ if (condition.operationToken != KtTokens.ANDAND) return null
+ val firstCondition = condition.left as? KtBinaryExpression ?: return null
+ val secondCondition = condition.right as? KtBinaryExpression ?: return null
+ val firstOpToken = firstCondition.operationToken
+ val secondOpToken = secondCondition.operationToken
+ val firstLeft = firstCondition.left ?: return null
+ val firstRight = firstCondition.right ?: return null
+ val secondLeft = secondCondition.left ?: return null
+ val secondRight = secondCondition.right ?: return null
+
+ fun IElementType.isStrictComparison() = this == KtTokens.GT || this == KtTokens.LT
+
+ val firstStrict = firstOpToken.isStrictComparison()
+ val secondStrict = secondOpToken.isStrictComparison()
+
+ fun IElementType.orderLessAndGreater(left: KtExpression, right: KtExpression): Pair? = when (this) {
+ KtTokens.GTEQ, KtTokens.GT -> right to left
+ KtTokens.LTEQ, KtTokens.LT -> left to right
+ else -> null
+ }
+
+ val (firstLess, firstGreater) = firstOpToken.orderLessAndGreater(firstLeft, firstRight) ?: return null
+ val (secondLess, secondGreater) = secondOpToken.orderLessAndGreater(secondLeft, secondRight) ?: return null
+
+ return generateRangeExpressionData(firstLess, firstGreater, firstStrict, secondLess, secondGreater, secondStrict)
+ }
+
+ private fun KtExpression.isSimple() = this is KtConstantExpression || this is KtNameReferenceExpression
+
+ private fun generateRangeExpressionData(
+ firstLess: KtExpression, firstGreater: KtExpression, firstStrict: Boolean,
+ secondLess: KtExpression, secondGreater: KtExpression, secondStrict: Boolean
+ ) = when {
+ firstGreater !is KtConstantExpression && firstGreater.evaluatesTo(secondLess) ->
+ generateRangeExpressionData(firstGreater,
+ min = firstLess,
+ max = secondGreater,
+ incrementMinByOne = firstStrict,
+ decrementMaxByOne = secondStrict)
+ firstLess !is KtConstantExpression && firstLess.evaluatesTo(secondGreater) ->
+ generateRangeExpressionData(firstLess,
+ min = secondLess,
+ max = firstGreater,
+ incrementMinByOne = secondStrict,
+ decrementMaxByOne = firstStrict)
+ else ->
+ null
+ }
+
+ private fun generateRangeExpressionData(
+ value: KtExpression, min: KtExpression, max: KtExpression, incrementMinByOne: Boolean, decrementMaxByOne: Boolean
+ ): RangeExpressionData? {
+ fun KtExpression.getChangeBy(number: Int): String? {
+ val context = analyze()
+ val type = getType(context) ?: return null
+ if (!type.isValidTypeForIncrementDecrementByOne()) return null
+
+ when (this) {
+ is KtConstantExpression -> {
+ val constantValue = ConstantExpressionEvaluator.getConstant(this, context)?.getValue(type) ?: return null
+ return when {
+ KotlinBuiltIns.isInt(type) -> (constantValue as Int + number).toString()
+ KotlinBuiltIns.isLong(type) -> (constantValue as Long + number).toString()
+ KotlinBuiltIns.isChar(type) -> "'${constantValue as Char + number}'"
+ else -> return null
+ }
+ }
+ else -> return if (number >= 0) "($text + $number)" else "($text - ${-number})"
+ }
+ }
+
+ // To avoid possible side effects
+ if (!min.isSimple() || !max.isSimple()) return null
+
+ if (incrementMinByOne || decrementMaxByOne) {
+ if (!value.getType(value.analyze()).isValidTypeForIncrementDecrementByOne()) return null
+ }
+
+ val minText = if (incrementMinByOne) min.getChangeBy(1) else min.text
+ val maxText = if (decrementMaxByOne) max.getChangeBy(-1) else max.text
+ return RangeExpressionData(value, minText ?: return null, maxText ?: return null)
+ }
+
+ private fun KotlinType?.isValidTypeForIncrementDecrementByOne(): Boolean {
+ this ?: return false
+ return KotlinBuiltIns.isInt(this) ||
+ KotlinBuiltIns.isLong(this) ||
+ KotlinBuiltIns.isShort(this) ||
+ KotlinBuiltIns.isByte(this) ||
+ KotlinBuiltIns.isChar(this)
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertRangeCheckToTwoComparisons/.intention b/idea/testData/intentions/convertRangeCheckToTwoComparisons/.intention
new file mode 100644
index 00000000000..7153dd74e41
--- /dev/null
+++ b/idea/testData/intentions/convertRangeCheckToTwoComparisons/.intention
@@ -0,0 +1 @@
+org.jetbrains.kotlin.idea.intentions.ConvertRangeCheckToTwoComparisonsIntention
\ No newline at end of file
diff --git a/idea/testData/intentions/convertRangeCheckToTwoComparisons/double.kt b/idea/testData/intentions/convertRangeCheckToTwoComparisons/double.kt
new file mode 100644
index 00000000000..7c11765d5ef
--- /dev/null
+++ b/idea/testData/intentions/convertRangeCheckToTwoComparisons/double.kt
@@ -0,0 +1,4 @@
+// WITH_RUNTIME
+fun foo(bar: Double) {
+ bar in 1.0..10.0
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertRangeCheckToTwoComparisons/double.kt.after b/idea/testData/intentions/convertRangeCheckToTwoComparisons/double.kt.after
new file mode 100644
index 00000000000..273a5ad180f
--- /dev/null
+++ b/idea/testData/intentions/convertRangeCheckToTwoComparisons/double.kt.after
@@ -0,0 +1,4 @@
+// WITH_RUNTIME
+fun foo(bar: Double) {
+ 1.0 <= bar && bar <= 10.0
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertRangeCheckToTwoComparisons/forLoop.kt b/idea/testData/intentions/convertRangeCheckToTwoComparisons/forLoop.kt
new file mode 100644
index 00000000000..2d48cbd466b
--- /dev/null
+++ b/idea/testData/intentions/convertRangeCheckToTwoComparisons/forLoop.kt
@@ -0,0 +1,5 @@
+// IS_APPLICABLE: false
+fun foo(bar: Int) {
+ for (bar in 1..2) {
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertRangeCheckToTwoComparisons/insideForLoop.kt b/idea/testData/intentions/convertRangeCheckToTwoComparisons/insideForLoop.kt
new file mode 100644
index 00000000000..0b6328f7d47
--- /dev/null
+++ b/idea/testData/intentions/convertRangeCheckToTwoComparisons/insideForLoop.kt
@@ -0,0 +1,5 @@
+fun foo(bar: Int) {
+ for (bar in 1..10) {
+ bar in 1..10
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertRangeCheckToTwoComparisons/insideForLoop.kt.after b/idea/testData/intentions/convertRangeCheckToTwoComparisons/insideForLoop.kt.after
new file mode 100644
index 00000000000..a633032f551
--- /dev/null
+++ b/idea/testData/intentions/convertRangeCheckToTwoComparisons/insideForLoop.kt.after
@@ -0,0 +1,5 @@
+fun foo(bar: Int) {
+ for (bar in 1..10) {
+ 1 <= bar && bar <= 10
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertRangeCheckToTwoComparisons/insideForLoop2.kt b/idea/testData/intentions/convertRangeCheckToTwoComparisons/insideForLoop2.kt
new file mode 100644
index 00000000000..3e82ba1ea8d
--- /dev/null
+++ b/idea/testData/intentions/convertRangeCheckToTwoComparisons/insideForLoop2.kt
@@ -0,0 +1,7 @@
+fun foo(bar: Int) {
+ for (bar in 1..10) {
+ if (bar in 1..10) {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertRangeCheckToTwoComparisons/insideForLoop2.kt.after b/idea/testData/intentions/convertRangeCheckToTwoComparisons/insideForLoop2.kt.after
new file mode 100644
index 00000000000..4f98df1522f
--- /dev/null
+++ b/idea/testData/intentions/convertRangeCheckToTwoComparisons/insideForLoop2.kt.after
@@ -0,0 +1,7 @@
+fun foo(bar: Int) {
+ for (bar in 1..10) {
+ if (1 <= bar && bar <= 10) {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertRangeCheckToTwoComparisons/int.kt b/idea/testData/intentions/convertRangeCheckToTwoComparisons/int.kt
new file mode 100644
index 00000000000..43f4067f41a
--- /dev/null
+++ b/idea/testData/intentions/convertRangeCheckToTwoComparisons/int.kt
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ bar in 1..10
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertRangeCheckToTwoComparisons/int.kt.after b/idea/testData/intentions/convertRangeCheckToTwoComparisons/int.kt.after
new file mode 100644
index 00000000000..bed820a8371
--- /dev/null
+++ b/idea/testData/intentions/convertRangeCheckToTwoComparisons/int.kt.after
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ 1 <= bar && bar <= 10
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertRangeCheckToTwoComparisons/nonConstants.kt b/idea/testData/intentions/convertRangeCheckToTwoComparisons/nonConstants.kt
new file mode 100644
index 00000000000..253204fa5cf
--- /dev/null
+++ b/idea/testData/intentions/convertRangeCheckToTwoComparisons/nonConstants.kt
@@ -0,0 +1,3 @@
+fun foo(bar: Int, min: Int, max: Int) {
+ bar in min..max
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertRangeCheckToTwoComparisons/nonConstants.kt.after b/idea/testData/intentions/convertRangeCheckToTwoComparisons/nonConstants.kt.after
new file mode 100644
index 00000000000..05aea6b0b37
--- /dev/null
+++ b/idea/testData/intentions/convertRangeCheckToTwoComparisons/nonConstants.kt.after
@@ -0,0 +1,3 @@
+fun foo(bar: Int, min: Int, max: Int) {
+ min <= bar && bar <= max
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertRangeCheckToTwoComparisons/otherOp.kt b/idea/testData/intentions/convertRangeCheckToTwoComparisons/otherOp.kt
new file mode 100644
index 00000000000..15eff28f5dd
--- /dev/null
+++ b/idea/testData/intentions/convertRangeCheckToTwoComparisons/otherOp.kt
@@ -0,0 +1,6 @@
+// IS_APPLICABLE: false
+// WITH_RUNTIME
+fun foo(bar: Int) {
+ if (bar in arrayOf(1, 2, 3)) {
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertRangeCheckToTwoComparisons/withSideEffects.kt b/idea/testData/intentions/convertRangeCheckToTwoComparisons/withSideEffects.kt
new file mode 100644
index 00000000000..ad580a25681
--- /dev/null
+++ b/idea/testData/intentions/convertRangeCheckToTwoComparisons/withSideEffects.kt
@@ -0,0 +1,6 @@
+// IS_APPLICABLE: false
+
+var x = 5
+var y = 10
+
+fun foo() = ++x in --x..y++
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/.intention b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/.intention
new file mode 100644
index 00000000000..38e9bef8e40
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/.intention
@@ -0,0 +1 @@
+org.jetbrains.kotlin.idea.intentions.ConvertTwoComparisonsToRangeCheckIntention
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/char.kt b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/char.kt
new file mode 100644
index 00000000000..b63685f12eb
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/char.kt
@@ -0,0 +1,3 @@
+fun foo(bar: Char) {
+ bar >= 'a' && 'z' >= bar
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/char.kt.after b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/char.kt.after
new file mode 100644
index 00000000000..f38e7ef93b6
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/char.kt.after
@@ -0,0 +1,3 @@
+fun foo(bar: Char) {
+ bar in 'a'..'z'
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/charInclusive.kt b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/charInclusive.kt
new file mode 100644
index 00000000000..154f219030e
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/charInclusive.kt
@@ -0,0 +1,3 @@
+fun foo(bar: Char) {
+ bar > 'a' && 'z' > bar
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/charInclusive.kt.after b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/charInclusive.kt.after
new file mode 100644
index 00000000000..81258881a8e
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/charInclusive.kt.after
@@ -0,0 +1,3 @@
+fun foo(bar: Char) {
+ bar in 'b'..'y'
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/double.kt b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/double.kt
new file mode 100644
index 00000000000..b5c27b418a9
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/double.kt
@@ -0,0 +1,4 @@
+// WITH_RUNTIME
+fun foo(bar: Int) {
+ bar >= 0.0 && 10.0 >= bar
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/double.kt.after b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/double.kt.after
new file mode 100644
index 00000000000..a1215d16d6e
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/double.kt.after
@@ -0,0 +1,4 @@
+// WITH_RUNTIME
+fun foo(bar: Int) {
+ bar in 0.0..10.0
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/flipped.kt b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/flipped.kt
new file mode 100644
index 00000000000..6d09a98d8b8
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/flipped.kt
@@ -0,0 +1 @@
+fun foo(arg: Int) = 6 > arg && arg >= 1
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/flipped.kt.after b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/flipped.kt.after
new file mode 100644
index 00000000000..a8cb4197294
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/flipped.kt.after
@@ -0,0 +1 @@
+fun foo(arg: Int) = arg in 1..5
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/flippedSideEffect.kt b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/flippedSideEffect.kt
new file mode 100644
index 00000000000..ed487c2ac6f
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/flippedSideEffect.kt
@@ -0,0 +1,6 @@
+// IS_APPLICABLE: false
+
+var x = 42
+
+// Should be converted into arg in --x..++x (41..42) but initial check is arg <= ++x (43) && --x (42) <= arg
+fun foo(arg: Int) = arg <= ++x && --x <= arg
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtDouble.kt b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtDouble.kt
new file mode 100644
index 00000000000..0dbff9e98a8
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtDouble.kt
@@ -0,0 +1,5 @@
+// IS_APPLICABLE: false
+// WITH_RUNTIME
+fun foo(bar: Int) {
+ bar > 0.0 && 10.0 >= bar
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtDouble2.kt b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtDouble2.kt
new file mode 100644
index 00000000000..2b260f3fb3d
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtDouble2.kt
@@ -0,0 +1,5 @@
+// IS_APPLICABLE: false
+// WITH_RUNTIME
+fun foo(bar: Double) {
+ bar > 0 && 10 >= bar
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqgt.kt b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqgt.kt
new file mode 100644
index 00000000000..25f2a829bbe
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqgt.kt
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ bar >= 0 && 10 > bar
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqgt.kt.after b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqgt.kt.after
new file mode 100644
index 00000000000..a744b18b02a
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqgt.kt.after
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ bar in 0..9
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqgteq.kt b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqgteq.kt
new file mode 100644
index 00000000000..450c758e9b2
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqgteq.kt
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ bar >= 0 && 10 >= bar
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqgteq.kt.after b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqgteq.kt.after
new file mode 100644
index 00000000000..ca38e3bee7f
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqgteq.kt.after
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ bar in 0..10
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqlt.kt b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqlt.kt
new file mode 100644
index 00000000000..9435d171e21
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqlt.kt
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ bar >= 0 && bar < 10
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqlt.kt.after b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqlt.kt.after
new file mode 100644
index 00000000000..a744b18b02a
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqlt.kt.after
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ bar in 0..9
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqlteq.kt b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqlteq.kt
new file mode 100644
index 00000000000..dcdfd6f9c5a
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqlteq.kt
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ bar >= 0 && bar <= 10
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqlteq.kt.after b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqlteq.kt.after
new file mode 100644
index 00000000000..ca38e3bee7f
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqlteq.kt.after
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ bar in 0..10
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtgt.kt b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtgt.kt
new file mode 100644
index 00000000000..ec10132cbea
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtgt.kt
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ bar > 0 && 10 > bar
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtgt.kt.after b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtgt.kt.after
new file mode 100644
index 00000000000..c1ae472cc8b
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtgt.kt.after
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ bar in 1..9
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtgteq.kt b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtgteq.kt
new file mode 100644
index 00000000000..2b4e9192efa
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtgteq.kt
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ bar > 0 && 10 >= bar
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtgteq.kt.after b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtgteq.kt.after
new file mode 100644
index 00000000000..09253cd469f
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtgteq.kt.after
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ bar in 1..10
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtlt.kt b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtlt.kt
new file mode 100644
index 00000000000..f1e05ed58db
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtlt.kt
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ bar > 0 && bar < 10
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtlt.kt.after b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtlt.kt.after
new file mode 100644
index 00000000000..c1ae472cc8b
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtlt.kt.after
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ bar in 1..9
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtlteq.kt b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtlteq.kt
new file mode 100644
index 00000000000..8386c0f667a
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtlteq.kt
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ bar > 0 && bar <= 10
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtlteq.kt.after b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtlteq.kt.after
new file mode 100644
index 00000000000..09253cd469f
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtlteq.kt.after
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ bar in 1..10
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqgt.kt b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqgt.kt
new file mode 100644
index 00000000000..7e66acbe5f2
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqgt.kt
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ 0 <= bar && 10 > bar
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqgt.kt.after b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqgt.kt.after
new file mode 100644
index 00000000000..a744b18b02a
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqgt.kt.after
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ bar in 0..9
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqgteq.kt b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqgteq.kt
new file mode 100644
index 00000000000..df25e1fb553
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqgteq.kt
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ 0 <= bar && 10 >= bar
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqgteq.kt.after b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqgteq.kt.after
new file mode 100644
index 00000000000..ca38e3bee7f
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqgteq.kt.after
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ bar in 0..10
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqlt.kt b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqlt.kt
new file mode 100644
index 00000000000..5375a53e5ab
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqlt.kt
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ 0 <= bar && bar < 10
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqlt.kt.after b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqlt.kt.after
new file mode 100644
index 00000000000..a744b18b02a
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqlt.kt.after
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ bar in 0..9
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqlteq.kt b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqlteq.kt
new file mode 100644
index 00000000000..d4946adc438
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqlteq.kt
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ 0 <= bar && bar <= 10
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqlteq.kt.after b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqlteq.kt.after
new file mode 100644
index 00000000000..ca38e3bee7f
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqlteq.kt.after
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ bar in 0..10
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltgt.kt b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltgt.kt
new file mode 100644
index 00000000000..76afc85eb67
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltgt.kt
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ 0 < bar && 10 > bar
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltgt.kt.after b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltgt.kt.after
new file mode 100644
index 00000000000..c1ae472cc8b
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltgt.kt.after
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ bar in 1..9
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltgteq.kt b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltgteq.kt
new file mode 100644
index 00000000000..3922a70af80
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltgteq.kt
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ 0 < bar && 10 >= bar
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltgteq.kt.after b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltgteq.kt.after
new file mode 100644
index 00000000000..09253cd469f
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltgteq.kt.after
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ bar in 1..10
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltlt.kt b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltlt.kt
new file mode 100644
index 00000000000..ae4f0a7d2aa
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltlt.kt
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ 0 < bar && bar < 10
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltlt.kt.after b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltlt.kt.after
new file mode 100644
index 00000000000..c1ae472cc8b
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltlt.kt.after
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ bar in 1..9
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltlteq.kt b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltlteq.kt
new file mode 100644
index 00000000000..f69b87e3ec6
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltlteq.kt
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ 0 < bar && bar <= 10
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltlteq.kt.after b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltlteq.kt.after
new file mode 100644
index 00000000000..09253cd469f
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltlteq.kt.after
@@ -0,0 +1,3 @@
+fun foo(bar: Int) {
+ bar in 1..10
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/nonConstants.kt b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/nonConstants.kt
new file mode 100644
index 00000000000..76942efde28
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/nonConstants.kt
@@ -0,0 +1,3 @@
+fun foo(bar: Int, min: Int, max: Int) {
+ min < bar && bar < max
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertTwoComparisonsToRangeCheck/nonConstants.kt.after b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/nonConstants.kt.after
new file mode 100644
index 00000000000..a71fa6a0f50
--- /dev/null
+++ b/idea/testData/intentions/convertTwoComparisonsToRangeCheck/nonConstants.kt.after
@@ -0,0 +1,3 @@
+fun foo(bar: Int, min: Int, max: Int) {
+ bar in (min + 1)..(max - 1)
+}
\ No newline at end of file
diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java
index a4e8cee69ba..fc4ba7d01ab 100644
--- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java
+++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java
@@ -5052,6 +5052,63 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
}
}
+ @TestMetadata("idea/testData/intentions/convertRangeCheckToTwoComparisons")
+ @TestDataPath("$PROJECT_ROOT")
+ @RunWith(JUnit3RunnerWithInners.class)
+ public static class ConvertRangeCheckToTwoComparisons extends AbstractIntentionTest {
+ public void testAllFilesPresentInConvertRangeCheckToTwoComparisons() throws Exception {
+ KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/convertRangeCheckToTwoComparisons"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
+ }
+
+ @TestMetadata("double.kt")
+ public void testDouble() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertRangeCheckToTwoComparisons/double.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("forLoop.kt")
+ public void testForLoop() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertRangeCheckToTwoComparisons/forLoop.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("insideForLoop.kt")
+ public void testInsideForLoop() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertRangeCheckToTwoComparisons/insideForLoop.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("insideForLoop2.kt")
+ public void testInsideForLoop2() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertRangeCheckToTwoComparisons/insideForLoop2.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("int.kt")
+ public void testInt() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertRangeCheckToTwoComparisons/int.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("nonConstants.kt")
+ public void testNonConstants() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertRangeCheckToTwoComparisons/nonConstants.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("otherOp.kt")
+ public void testOtherOp() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertRangeCheckToTwoComparisons/otherOp.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("withSideEffects.kt")
+ public void testWithSideEffects() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertRangeCheckToTwoComparisons/withSideEffects.kt");
+ doTest(fileName);
+ }
+ }
+
@TestMetadata("idea/testData/intentions/convertReceiverToParameter")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -6442,6 +6499,159 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
}
}
+ @TestMetadata("idea/testData/intentions/convertTwoComparisonsToRangeCheck")
+ @TestDataPath("$PROJECT_ROOT")
+ @RunWith(JUnit3RunnerWithInners.class)
+ public static class ConvertTwoComparisonsToRangeCheck extends AbstractIntentionTest {
+ public void testAllFilesPresentInConvertTwoComparisonsToRangeCheck() throws Exception {
+ KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/convertTwoComparisonsToRangeCheck"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
+ }
+
+ @TestMetadata("char.kt")
+ public void testChar() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertTwoComparisonsToRangeCheck/char.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("charInclusive.kt")
+ public void testCharInclusive() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertTwoComparisonsToRangeCheck/charInclusive.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("double.kt")
+ public void testDouble() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertTwoComparisonsToRangeCheck/double.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("flipped.kt")
+ public void testFlipped() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertTwoComparisonsToRangeCheck/flipped.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("flippedSideEffect.kt")
+ public void testFlippedSideEffect() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertTwoComparisonsToRangeCheck/flippedSideEffect.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("gtDouble.kt")
+ public void testGtDouble() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtDouble.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("gtDouble2.kt")
+ public void testGtDouble2() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtDouble2.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("gteqgt.kt")
+ public void testGteqgt() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqgt.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("gteqgteq.kt")
+ public void testGteqgteq() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqgteq.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("gteqlt.kt")
+ public void testGteqlt() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqlt.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("gteqlteq.kt")
+ public void testGteqlteq() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertTwoComparisonsToRangeCheck/gteqlteq.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("gtgt.kt")
+ public void testGtgt() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtgt.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("gtgteq.kt")
+ public void testGtgteq() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtgteq.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("gtlt.kt")
+ public void testGtlt() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtlt.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("gtlteq.kt")
+ public void testGtlteq() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertTwoComparisonsToRangeCheck/gtlteq.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("lteqgt.kt")
+ public void testLteqgt() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqgt.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("lteqgteq.kt")
+ public void testLteqgteq() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqgteq.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("lteqlt.kt")
+ public void testLteqlt() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqlt.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("lteqlteq.kt")
+ public void testLteqlteq() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertTwoComparisonsToRangeCheck/lteqlteq.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("ltgt.kt")
+ public void testLtgt() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltgt.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("ltgteq.kt")
+ public void testLtgteq() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltgteq.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("ltlt.kt")
+ public void testLtlt() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltlt.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("ltlteq.kt")
+ public void testLtlteq() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertTwoComparisonsToRangeCheck/ltlteq.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("nonConstants.kt")
+ public void testNonConstants() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertTwoComparisonsToRangeCheck/nonConstants.kt");
+ doTest(fileName);
+ }
+ }
+
@TestMetadata("idea/testData/intentions/copyConcatenatedStringToClipboard")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)