Files
kotlin-fork/compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/resultAny.kt
T
Ilmir Usmanov 952576e98f JVM_IR: Do not unbox Result parameter if it not only one inline class
parameter, since in this case, the compiler generates a bridge, where
the result is unboxed.
2021-01-20 18:30:00 +01:00

16 lines
386 B
Kotlin
Vendored

// !LANGUAGE: +InlineClasses
// WITH_RUNTIME
inline class IC(val value: Any)
fun <T> foo(a: Result<T>, ic: IC): Pair<T, Any> = bar(a, ic) { a, ic ->
a.getOrThrow() to ic.value
}
fun <T1, T2, R> bar(t1: T1, t2: T2, f: (T1, T2) -> R): R {
return f(t1, t2)
}
fun Pair<Any, Any>.join(): String = "$first$second"
fun box(): String = foo<Any>(Result.success("O"), IC("K")).join()