[box-tests] Added test

This commit is contained in:
Igor Chevdar
2020-07-15 18:41:18 +05:00
parent 8bbbee8ffd
commit 3c4f0d3c9e
8 changed files with 66 additions and 0 deletions
@@ -0,0 +1,31 @@
// IGNORE_BACKEND: JVM
// IGNORE_BACKEND_MULTI_MODULE: JVM, JVM_IR
// 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"