Files
kotlin-fork/compiler/testData/codegen/boxInline/enclosingInfo/transformedConstructorWithNestedInline.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

49 lines
972 B
Kotlin
Vendored

// IGNORE_BACKEND: NATIVE
// FILE: 1.kt
// WITH_REFLECT
package test
interface Z {
fun a() : String
}
inline fun test(crossinline z: () -> String) =
object : Z {
val p = z()
override fun a() = p
}
inline fun<T> call(crossinline z: () -> T) = z()
// FILE: 2.kt
import test.*
fun box(): String {
/*This captured parameter would be added to object constructor*/
val captured = "OK";
var z: Any = "fail"
val res = test {
call {
z = {
captured
}
}
(z as Function0<String>)()
}
val enclosingConstructor = z.javaClass.enclosingConstructor
if (enclosingConstructor?.name != "_2Kt\$box$\$inlined\$test$1") return "fail 1: ${enclosingConstructor?.name}"
val enclosingClass = z.javaClass.enclosingClass
if (enclosingClass?.name != "_2Kt\$box$\$inlined\$test$1") return "fail 2: ${enclosingClass?.name}"
return res.a()
}