Do not mix expect/non-expect overloads of minOf/maxOf
Workaround for KT-22520
This commit is contained in:
@@ -17,9 +17,7 @@ import kotlin.comparisons.*
|
||||
* If values are equal, returns the first one.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun <T: Comparable<T>> maxOf(a: T, b: T): T {
|
||||
return if (a >= b) a else b
|
||||
}
|
||||
public expect fun <T: Comparable<T>> maxOf(a: T, b: T): T
|
||||
|
||||
/**
|
||||
* Returns the greater of two values.
|
||||
@@ -67,9 +65,7 @@ public expect inline fun maxOf(a: Double, b: Double): Double
|
||||
* Returns the greater of three values.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun <T: Comparable<T>> maxOf(a: T, b: T, c: T): T {
|
||||
return maxOf(a, maxOf(b, c))
|
||||
}
|
||||
public expect fun <T: Comparable<T>> maxOf(a: T, b: T, c: T): T
|
||||
|
||||
/**
|
||||
* Returns the greater of three values.
|
||||
@@ -97,9 +93,7 @@ public expect inline fun maxOf(a: Int, b: Int, c: Int): Int
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun maxOf(a: Long, b: Long, c: Long): Long {
|
||||
return maxOf(a, maxOf(b, c))
|
||||
}
|
||||
public expect inline fun maxOf(a: Long, b: Long, c: Long): Long
|
||||
|
||||
/**
|
||||
* Returns the greater of three values.
|
||||
@@ -137,9 +131,7 @@ public fun <T> maxOf(a: T, b: T, comparator: Comparator<in T>): T {
|
||||
* If values are equal, returns the first one.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun <T: Comparable<T>> minOf(a: T, b: T): T {
|
||||
return if (a <= b) a else b
|
||||
}
|
||||
public expect fun <T: Comparable<T>> minOf(a: T, b: T): T
|
||||
|
||||
/**
|
||||
* Returns the smaller of two values.
|
||||
@@ -187,9 +179,7 @@ public expect inline fun minOf(a: Double, b: Double): Double
|
||||
* Returns the smaller of three values.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun <T: Comparable<T>> minOf(a: T, b: T, c: T): T {
|
||||
return minOf(a, minOf(b, c))
|
||||
}
|
||||
public expect fun <T: Comparable<T>> minOf(a: T, b: T, c: T): T
|
||||
|
||||
/**
|
||||
* Returns the smaller of three values.
|
||||
@@ -217,9 +207,7 @@ public expect inline fun minOf(a: Int, b: Int, c: Int): Int
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun minOf(a: Long, b: Long, c: Long): Long {
|
||||
return minOf(a, minOf(b, c))
|
||||
}
|
||||
public expect inline fun minOf(a: Long, b: Long, c: Long): Long
|
||||
|
||||
/**
|
||||
* Returns the smaller of three values.
|
||||
|
||||
Reference in New Issue
Block a user