Supported reification for anonymous objects and lambdas
This commit is contained in:
committed by
Andrey Breslav
parent
a689f6d243
commit
21699e1753
@@ -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"
|
||||
}
|
||||
+14
@@ -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"
|
||||
}
|
||||
+15
@@ -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"
|
||||
}
|
||||
Reference in New Issue
Block a user