mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
The problem was that when obtaining char from the wrapper, codegen used int as expected type that led to a ClassCastException: java.lang.Character cannot be cast to java.lang.Number The solution is using coercion to chars, it's still correct, because of implicit widening coercion in JVM from C to I #KT-15105 Fixed
17 lines
372 B
Kotlin
Vendored
17 lines
372 B
Kotlin
Vendored
fun <T> id(x: T) = x
|
|
|
|
fun box(): String {
|
|
if (id('a') > id('b')) return "fail 1"
|
|
if (id('a') >= id('b')) return "fail 2"
|
|
if (id('b') < id('a')) return "fail 3"
|
|
if (id('b') <= id('a')) return "fail 4"
|
|
|
|
val x = id('a').compareTo('b')
|
|
if (x != -1) return "fail 5"
|
|
|
|
val y = id('b').compareTo('a')
|
|
if (y != 1) return "fail 6"
|
|
|
|
return "OK"
|
|
}
|