Merge boxWithStdlib testData into box, delete BoxWithStdlib test

This commit is contained in:
Alexander Udalov
2016-03-07 13:36:14 +03:00
committed by Alexander Udalov
parent 22bfc9786a
commit 06a67e6602
535 changed files with 3520 additions and 3871 deletions
+12
View File
@@ -0,0 +1,12 @@
// WITH_RUNTIME
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 = Letters::class.java
val r = 1.toByte().toEnum(clazz)
return if (r == Letters.B) "OK" else "Fail: $r"
}