Files
kotlin-fork/compiler/testData/codegen/boxInline/anonymousObject/kt29595.kt
T
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00

39 lines
596 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// NO_CHECK_LAMBDA_INLINING
// WITH_STDLIB
// IGNORE_BACKEND: JVM
// IGNORE_BACKEND_MULTI_MODULE: JVM, JVM_MULTI_MODULE_OLD_AGAINST_IR
// FILE: 1.kt
package test
inline fun <reified T : Any> foo(crossinline function: () -> T) {
T::class.java.name
object {
fun bar() {
function()
}
init {
bar()
}
}
}
// FILE: 2.kt
import test.*
fun box(): String {
var result = "Fail"
foo {
object {
init {
result = "OK"
}
}
}
return result
}