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

30 lines
488 B
Kotlin
Vendored

// NO_CHECK_LAMBDA_INLINING
// FILE: 1.kt
package test
interface Foo {
fun compute(): Int
}
inline fun foo(x: Int, block: (Int) -> Foo) = block(x)
// FILE: 2.kt
import test.*
fun bar(): Int {
return foo(21) { x ->
val o = object : Foo {
override fun compute(): Int {
return call { x * 2 }
}
private fun call(f: () -> Int) = f()
}
o
}.compute()
}
fun box() = if (bar() == 42) "OK" else "fail"