Do not mix expect/non-expect overloads of minOf/maxOf
Workaround for KT-22520
This commit is contained in:
@@ -13,6 +13,15 @@ import kotlin.*
|
||||
import kotlin.text.*
|
||||
import kotlin.comparisons.*
|
||||
|
||||
/**
|
||||
* Returns the greater of two values.
|
||||
* If values are equal, returns the first one.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public actual fun <T: Comparable<T>> maxOf(a: T, b: T): T {
|
||||
return if (a >= b) a else b
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the greater of two values.
|
||||
*/
|
||||
@@ -67,6 +76,14 @@ public actual inline fun maxOf(a: Double, b: Double): Double {
|
||||
return Math.max(a, b)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the greater of three values.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public actual fun <T: Comparable<T>> maxOf(a: T, b: T, c: T): T {
|
||||
return maxOf(a, maxOf(b, c))
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the greater of three values.
|
||||
*/
|
||||
@@ -94,6 +111,15 @@ public actual inline fun maxOf(a: Int, b: Int, c: Int): Int {
|
||||
return Math.max(a, b, c)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the greater of three values.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun maxOf(a: Long, b: Long, c: Long): Long {
|
||||
return maxOf(a, maxOf(b, c))
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the greater of three values.
|
||||
*/
|
||||
@@ -112,6 +138,15 @@ public actual inline fun maxOf(a: Double, b: Double, c: Double): Double {
|
||||
return Math.max(a, b, c)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the smaller of two values.
|
||||
* If values are equal, returns the first one.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public actual fun <T: Comparable<T>> minOf(a: T, b: T): T {
|
||||
return if (a <= b) a else b
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the smaller of two values.
|
||||
*/
|
||||
@@ -166,6 +201,14 @@ public actual inline fun minOf(a: Double, b: Double): Double {
|
||||
return Math.min(a, b)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the smaller of three values.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public actual fun <T: Comparable<T>> minOf(a: T, b: T, c: T): T {
|
||||
return minOf(a, minOf(b, c))
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the smaller of three values.
|
||||
*/
|
||||
@@ -193,6 +236,15 @@ public actual inline fun minOf(a: Int, b: Int, c: Int): Int {
|
||||
return Math.min(a, b, c)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the smaller of three values.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun minOf(a: Long, b: Long, c: Long): Long {
|
||||
return minOf(a, minOf(b, c))
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the smaller of three values.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user