JVM_IR KT-47449 handle star projection arguments in default lambda types

This commit is contained in:
Dmitry Petrov
2021-06-25 13:12:18 +03:00
committed by teamcityserver
parent 5486fec0f9
commit 1298ba431b
10 changed files with 104 additions and 15 deletions
+33
View File
@@ -0,0 +1,33 @@
// IGNORE_BACKEND: JS
// IGNORE_BACKEND: WASM
typealias EmptyFunctionResult<T> = () -> T
typealias LoggingFunctionType<T> = (tag: String, message: String, throwable: Throwable?) -> T
fun box(): String {
tryAndLog {
throw RuntimeException()
}
return "OK"
}
inline fun <T> tryAndLog(
title: String = "",
message: String = "",
logger: LoggingFunctionType<*> = L::error,
throwableAction: EmptyFunctionResult<T>
): T? {
return try {
throwableAction()
} catch (e: Throwable) {
logger(title, message, e)
return null
}
}
open class LLogger {
fun error(tag: String, message: String, exception: Throwable?): Unit {}
}
object L : LLogger()