Files
kotlin-fork/compiler/testData/codegen/boxInline/anonymousObject/kt16193.kt
T
Ilya Matveev a5e4e0284e Mute some box tests for native backend
This patch mutes the following test categories:
   * Tests with java dependencies (System class,
     java stdlib, jvm-oriented annotations etc).
   * Coroutines tests.
   * Reflection tests.
   * Tests with an inheritance from the standard
     collections.
2017-03-10 19:59:37 +03:00

30 lines
593 B
Kotlin
Vendored

// IGNORE_BACKEND: NATIVE
//WITH_RUNTIME
//FULL_JDK
// FILE: 1.kt
package test
inline fun crashMe(crossinline callback: () -> Unit): Function0<Unit> {
return object: Function0<Unit> {
override fun invoke() {
callback()
}
}
}
// FILE: 2.kt
import test.*
import java.lang.reflect.Modifier
var result = "fail"
fun box(): String {
val crashMe = crashMe { result = "OK" }
val modifiers = crashMe::class.java.getDeclaredConstructor().modifiers
if (!Modifier.isPublic(modifiers)) return "fail $modifiers"
crashMe.invoke()
return result
}