Use Intrinsics#compare when specializing compareTo for ints

This commit is contained in:
Dmitry Petrov
2017-05-19 16:00:13 +03:00
parent a1ae40a617
commit 39aa97eebf
3 changed files with 19 additions and 13 deletions

View File

@@ -0,0 +1,11 @@
fun box(): String {
val a: Any = 1
val b: Any = 42
val test = (a as Comparable<Any>).compareTo(b)
if (test != -1) return "Fail: $test"
return "OK"
}
// 0 compareTo
// 1 Intrinsics.compare