Use generic coerceIn for nullable primitives, provide specialization for non-nullable ones.

Fix docs for coerceAtMost.
This commit is contained in:
Ilya Gorbunov
2016-01-23 05:30:38 +03:00
parent 7981e5aa3a
commit a78b08d9c7
3 changed files with 45 additions and 74 deletions
@@ -89,7 +89,6 @@ class CoercionTest {
}
@Test
@Suppress("DEPRECATION_ERROR")
fun coercionsComparable() {
val v = (0..10).map { ComparableNumber(it) }
@@ -118,7 +117,7 @@ class CoercionTest {
}
}
private class ComparableNumber(public val value: Int) : Comparable<ComparableNumber> {
private class ComparableNumber(val value: Int) : Comparable<ComparableNumber> {
override fun compareTo(other: ComparableNumber): Int = this.value - other.value
override fun toString(): String = "CV$value"
}