mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 00:21:26 +00:00
Use Intrinsics#compare when specializing compareTo for ints
This commit is contained in:
11
compiler/testData/codegen/bytecodeText/boxingOptimization/intCompareTo.kt
vendored
Normal file
11
compiler/testData/codegen/bytecodeText/boxingOptimization/intCompareTo.kt
vendored
Normal 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
|
||||
Reference in New Issue
Block a user