JVM IR: Avoid direct invokes in callable reference tests
Due to the direct invoke optimization, most callable reference tests were not generating callable references/lambdas.
This commit is contained in:
committed by
Alexander Udalov
parent
f0238766df
commit
7d59c7689c
+1
-1
@@ -3,5 +3,5 @@ fun box(): String {
|
||||
val result = "OK"
|
||||
}
|
||||
|
||||
return (::A)().result
|
||||
return (::A).let { it() }.result
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -6,5 +6,5 @@ fun box(): String {
|
||||
}
|
||||
}
|
||||
|
||||
return (::A)().result
|
||||
return (::A).let { it() }.result
|
||||
}
|
||||
|
||||
+1
-1
@@ -2,5 +2,5 @@ class A
|
||||
|
||||
fun box(): String {
|
||||
fun A.foo() = "OK"
|
||||
return (A::foo)(A())
|
||||
return (A::foo).let { it(A()) }
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fun box(): String {
|
||||
class A
|
||||
fun A.foo() = "OK"
|
||||
return (A::foo)((::A)())
|
||||
return (A::foo).let { c -> c((::A).let { it() }) }
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
fun box(): String {
|
||||
fun Int.is42With(that: Int) = this + 2 * that == 42
|
||||
return if ((Int::is42With)(16, 13)) "OK" else "Fail"
|
||||
return if ((Int::is42With).let { it(16, 13) }) "OK" else "Fail"
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
fun foo(until: Int): String {
|
||||
fun bar(x: Int): String =
|
||||
if (x == until) "OK" else bar(x + 1)
|
||||
return (::bar)(0)
|
||||
return (::bar).let { it(0) }
|
||||
}
|
||||
|
||||
fun box() = foo(10)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
fun box(): String {
|
||||
fun foo() = "OK"
|
||||
return (::foo)()
|
||||
return (::foo).let { it() }
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,5 +3,5 @@ fun box(): String {
|
||||
|
||||
fun foo() = result
|
||||
|
||||
return (::foo)()
|
||||
return (::foo).let { it() }
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
fun box(): String {
|
||||
fun foo(s: String) = s
|
||||
return (::foo)("OK")
|
||||
return (::foo).let { it("OK") }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user