[FIR] Fix translation of invokes & add return expressions for lambdas
* fixed NoSuchMethod caused by mismatched signatures of the "invoke" method generated for lambda arguments * added test cases in invoke.kt for KFunction and anonymous functions * added a transformer to wrap the last expression in the bodies of lambdas with return
This commit is contained in:
committed by
Mikhail Glukhikh
parent
5eedba3903
commit
7249d2f889
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun zap(s: String): String? = s
|
||||
|
||||
inline fun tryZap(s: String, fn: (String) -> String): String {
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
inline fun catchAll(x: String, block: () -> Unit): String {
|
||||
try {
|
||||
block()
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
inline fun <T> tryOrElse(f1: () -> T, f2: () -> T): T {
|
||||
try {
|
||||
return f1()
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
inline fun <T> tryOrElse(f1: () -> T, f2: () -> T): T =
|
||||
try { f1() } catch (e: Exception) { f2() }
|
||||
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
inline fun <T> tryAndThen(f1: () -> Unit, f2: () -> Unit, f3: () -> T): T {
|
||||
try {
|
||||
f1()
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun zap(s: String) = s
|
||||
|
||||
inline fun tryZap(string: String, fn: (String) -> String) =
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun zap(s: String) = s
|
||||
|
||||
inline fun tryZap(s1: String, s2: String, fn: (String, String) -> String) =
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun zap(s: String) = s
|
||||
|
||||
inline fun tryZap(string: String, fn: (String) -> String) =
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun zap(s: String) = s
|
||||
|
||||
inline fun tryZap(string: String, fn: (String) -> String) =
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun zap(s: String) = s
|
||||
|
||||
inline fun tryZap1(string: String, fn: (String) -> String) =
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
inline fun test(s: () -> Int): Int =
|
||||
try {
|
||||
val i = s()
|
||||
|
||||
Reference in New Issue
Block a user