Files
kotlin-fork/compiler/testData/codegen/boxInline/anonymousObject/anonymousObjectInDefault.kt
T
Alexander Udalov 24aee1cce3 JVM IR: unmute tests on anonymous objects in inline lambdas
All tests on anonymous objects should use the NO_CHECK_LAMBDA_INLINING
directive, since the test framework can't tell an anonymous object from
a lambda and checking that anonymous objects are "inlined" makes no
sense.
2020-09-02 16:46:04 +02:00

33 lines
483 B
Kotlin
Vendored

// IGNORE_BACKEND: JVM
// IGNORE_BACKEND_MULTI_MODULE: JVM
// NO_CHECK_LAMBDA_INLINING
// FILE: 1.kt
package test
inline fun <T> myRun(block: () -> T) = block()
// FILE: 2.kt
import test.*
interface IFoo {
fun foo(): String
}
class A(val x: String, f: () -> IFoo = {
val y = "K"
myRun {
val o = object: IFoo {
override fun foo() = x + y
}
o
}
}) {
val foo: IFoo = f()
}
fun box(): String {
return A("O").foo.foo()
}