Merge ReplaceMathMaxWithCoerceAtLeastIntention & ReplaceMathMinWithCoerceAtMostIntention with ReplaceJavaStaticMethodWithKotlinAnalogInspection
Relates to #KT-31502
This commit is contained in:
@@ -1 +0,0 @@
|
||||
org.jetbrains.kotlin.idea.intentions.ReplaceMathMaxWithCoerceAtLeastIntention
|
||||
@@ -1,7 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import java.lang.Math.max
|
||||
|
||||
fun foo() {
|
||||
Pair(<caret>max(1, 3), max(2, 4)).let { println(it) }
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import java.lang.Math.max
|
||||
|
||||
fun foo() {
|
||||
Pair(<caret>1.coerceAtLeast(3), max(2, 4)).let { println(it) }
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo() {
|
||||
Pair(Math.max(1, 3)<caret>, Math.max(2, 4)).let { println(it) }
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo() {
|
||||
Pair(1.coerceAtLeast(3)<caret>, Math.max(2, 4)).let { println(it) }
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
fun foo() {
|
||||
Math.max(1, 2)<caret>
|
||||
}
|
||||
|
||||
object Math {
|
||||
fun max(a: Int, b: Int) = 0
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import java.lang.Math.max
|
||||
|
||||
fun foo() {
|
||||
max(1.1, 1.2)<caret>
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import java.lang.Math.max
|
||||
|
||||
fun foo() {
|
||||
1.1.coerceAtLeast(1.2)
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
import java.lang.Math.max
|
||||
|
||||
fun foo() {
|
||||
Math.max(max(1, 3)<caret>, max(2, 4))
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
import java.lang.Math.max
|
||||
|
||||
fun foo() {
|
||||
Math.max(1.coerceAtLeast(3), max(2, 4))
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: None of the following functions can be called with the arguments supplied: <br>public open fun max(a: Double, b: Double): Double defined in java.lang.Math<br>public open fun max(a: Float, b: Float): Float defined in java.lang.Math<br>public open fun max(a: Int, b: Int): Int defined in java.lang.Math<br>public open fun max(a: Long, b: Long): Long defined in java.lang.Math
|
||||
|
||||
import java.lang.Math.max
|
||||
|
||||
fun foo() {
|
||||
max(1.1, 1.2, 1.3)<caret>
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo() {
|
||||
Math.max(2, 1)<caret>
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo() {
|
||||
2.coerceAtLeast(1)
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: None of the following functions can be called with the arguments supplied: <br>public open fun max(a: Double, b: Double): Double defined in java.lang.Math<br>public open fun max(a: Float, b: Float): Float defined in java.lang.Math<br>public open fun max(a: Int, b: Int): Int defined in java.lang.Math<br>public open fun max(a: Long, b: Long): Long defined in java.lang.Math
|
||||
|
||||
import java.lang.Math.max
|
||||
|
||||
fun foo() {
|
||||
max(1.1)<caret>
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import java.lang.Math.max
|
||||
|
||||
fun foo() {
|
||||
max(1, 2)<caret>
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import java.lang.Math.max
|
||||
|
||||
fun foo() {
|
||||
1.coerceAtLeast(2)
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
org.jetbrains.kotlin.idea.intentions.ReplaceMathMinWithCoerceAtMostIntention
|
||||
@@ -1,7 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import java.lang.Math.min
|
||||
|
||||
fun foo() {
|
||||
Pair(<caret>min(1, 3), min(2, 4)).let { println(it) }
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import java.lang.Math.min
|
||||
|
||||
fun foo() {
|
||||
Pair(<caret>1.coerceAtMost(3), min(2, 4)).let { println(it) }
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo() {
|
||||
Pair(Math.min(1, 3)<caret>, Math.min(2, 4)).let { println(it) }
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo() {
|
||||
Pair(1.coerceAtMost(3)<caret>, Math.min(2, 4)).let { println(it) }
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
fun foo() {
|
||||
Math.min(1, 2)<caret>
|
||||
}
|
||||
|
||||
object Math {
|
||||
fun min(a: Int, b: Int) = 0
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import java.lang.Math.min
|
||||
|
||||
fun foo() {
|
||||
min(1.1, 1.2)<caret>
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import java.lang.Math.min
|
||||
|
||||
fun foo() {
|
||||
1.1.coerceAtMost(1.2)
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: None of the following functions can be called with the arguments supplied: <br>public open fun min(a: Double, b: Double): Double defined in java.lang.Math<br>public open fun min(a: Float, b: Float): Float defined in java.lang.Math<br>public open fun min(a: Int, b: Int): Int defined in java.lang.Math<br>public open fun min(a: Long, b: Long): Long defined in java.lang.Math
|
||||
|
||||
import java.lang.Math.min
|
||||
|
||||
fun foo() {
|
||||
min(1.1, 1.2, 1.3)<caret>
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo() {
|
||||
Math.min(2, 1)<caret>
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo() {
|
||||
2.coerceAtMost(1)
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: None of the following functions can be called with the arguments supplied: <br>public open fun min(a: Double, b: Double): Double defined in java.lang.Math<br>public open fun min(a: Float, b: Float): Float defined in java.lang.Math<br>public open fun min(a: Int, b: Int): Int defined in java.lang.Math<br>public open fun min(a: Long, b: Long): Long defined in java.lang.Math
|
||||
|
||||
import java.lang.Math.min
|
||||
|
||||
fun foo() {
|
||||
min(1.1)<caret>
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import java.lang.Math.min
|
||||
|
||||
fun foo() {
|
||||
min(1, 2)<caret>
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import java.lang.Math.min
|
||||
|
||||
fun foo() {
|
||||
1.coerceAtMost(2)
|
||||
}
|
||||
Reference in New Issue
Block a user