JVM IR: Avoid direct lambda invokes in inline tests
This commit is contained in:
committed by
Alexander Udalov
parent
f0760e0550
commit
2acfb3a41f
+1
-1
@@ -15,7 +15,7 @@ inline fun testNested(crossinline f: (String) -> Unit) {
|
||||
}
|
||||
|
||||
inline fun test(crossinline f: (String) -> Unit) {
|
||||
testNested { it -> { f(it) }()}
|
||||
testNested { it -> { f(it) }.let { it() } }
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
+3
-3
@@ -20,10 +20,10 @@ fun box(): String {
|
||||
{
|
||||
{
|
||||
result = param + c + a
|
||||
}()
|
||||
}()
|
||||
}.let { it() }
|
||||
}.let { it() }
|
||||
}
|
||||
}()
|
||||
}.let { it() }
|
||||
}
|
||||
|
||||
return if (result == "start12") "OK" else "fail: $result"
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@ package test
|
||||
inline fun <T> inlineFun(arg: T, crossinline f: (T) -> Unit) {
|
||||
{
|
||||
f(arg)
|
||||
}()
|
||||
}.let { it() }
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
@@ -19,7 +19,7 @@ fun box(): String {
|
||||
inlineFun("2") { a ->
|
||||
{
|
||||
result = param + a
|
||||
}()
|
||||
}.let { it() }
|
||||
}
|
||||
|
||||
|
||||
|
||||
+4
-4
@@ -5,7 +5,7 @@ package test
|
||||
inline fun <T> inlineFun(arg: T, crossinline f: (T) -> Unit) {
|
||||
{
|
||||
f(arg)
|
||||
}()
|
||||
}.let { it() }
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
@@ -21,10 +21,10 @@ fun box(): String {
|
||||
{
|
||||
{
|
||||
result = param + c + a
|
||||
}()
|
||||
}()
|
||||
}.let { it() }
|
||||
}.let { it() }
|
||||
}
|
||||
}()
|
||||
}.let { it() }
|
||||
}
|
||||
|
||||
return if (result == "start12") "OK" else "fail: $result"
|
||||
|
||||
+3
-3
@@ -5,7 +5,7 @@ package test
|
||||
inline fun <T> inlineFun(arg: T, crossinline f: (T) -> Unit) {
|
||||
{
|
||||
f(arg)
|
||||
}()
|
||||
}.let { it() }
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
@@ -20,9 +20,9 @@ fun box(): String {
|
||||
inlineFun("2") { a ->
|
||||
{
|
||||
result = param + c + a
|
||||
}()
|
||||
}.let { it() }
|
||||
}
|
||||
}()
|
||||
}.let { it() }
|
||||
}
|
||||
|
||||
return if (result == "start12") "OK" else "fail: $result"
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ inline fun testNested(crossinline f: (String) -> Unit) {
|
||||
}
|
||||
|
||||
fun test(f: (String) -> Unit) {
|
||||
testNested { it -> { f(it) }()}
|
||||
testNested { it -> { f(it) }.let { it() } }
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
Reference in New Issue
Block a user