Supported reification for anonymous objects and lambdas

This commit is contained in:
Denis Zharkov
2014-10-13 19:01:41 +04:00
committed by Andrey Breslav
parent a689f6d243
commit 21699e1753
20 changed files with 476 additions and 82 deletions
@@ -0,0 +1,14 @@
import kotlin.test.assertEquals
inline fun foo(x: String, block: (String) -> String) = block(x)
fun box(): String {
val res = foo("abc") {
fun bar(y: String) = y + "cde"
bar(it)
}
assertEquals("abccde", res)
return "OK"
}
@@ -0,0 +1,14 @@
import kotlin.test.assertEquals
inline fun foo(x: String, block: (String) -> String) = block(x)
fun box(): String {
val res = foo("abc") {
fun bar(y: String) = y + "cde"
foo(it) { bar(it) }
}
assertEquals("abccde", res)
return "OK"
}
@@ -0,0 +1,15 @@
import kotlin.test.assertEquals
inline fun foo(x: String, block: (String) -> String) = block(x)
fun noInlineFoo(x: String, block: (String) -> String) = block(x)
fun box(): String {
val res = foo("abc") {
fun bar(y: String) = y + "cde"
noInlineFoo(it) { bar(it) }
}
assertEquals("abccde", res)
return "OK"
}
@@ -0,0 +1,13 @@
import kotlin.test.assertEquals
inline fun foo(x: String, block: (String) -> String) = block(x)
fun box(): String {
fun bar(y: String) = y + "cde"
val res = foo("abc") { bar(it) }
assertEquals("abccde", res)
return "OK"
}