Migrate boxInline tests to new multi-file framework

This commit is contained in:
Alexander Udalov
2016-02-24 13:29:32 +03:00
committed by Alexander Udalov
parent fa1f7d988e
commit cc84aabdcf
586 changed files with 6946 additions and 5639 deletions
@@ -0,0 +1,47 @@
// FILE: 1.kt
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 != "TransformedConstructorWithNestedInline_1Kt\$box$\$inlined\$test$1") return "fail 1: ${enclosingConstructor?.name}"
val enclosingClass = z.javaClass.enclosingClass
if (enclosingClass?.name != "TransformedConstructorWithNestedInline_1Kt\$box$\$inlined\$test$1") return "fail 2: ${enclosingClass?.name}"
return res.a()
}