Fix JVM type mapping of arrays of type variables
#KT-4262 Fixed #KT-5056 Fixed
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
fun <E : Enum<E>> Byte.toEnum(clazz : Class<E>) : E =
|
||||
(clazz.getMethod("values").invoke(null) as Array<E>)[this.toInt()]
|
||||
|
||||
enum class Letters { A B C }
|
||||
|
||||
fun box(): String {
|
||||
val clazz = javaClass<Letters>()
|
||||
val r = 1.toByte().toEnum(clazz)
|
||||
return if (r == Letters.B) "OK" else "Fail: $r"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
fun box(): String {
|
||||
val list = array("a", "c", "b").toSortedList()
|
||||
return if (list.toString() == "[a, b, c]") "OK" else "Fail: $list"
|
||||
}
|
||||
Reference in New Issue
Block a user