Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/when/kt10807.kt
T
Denis.Zharkov 8f8ea8c57f K2: Optimize one-branch when-expr case only for independent context
Using independent one where `when` is nested doesn't look correct
2023-02-15 08:13:43 +00:00

19 lines
438 B
Kotlin
Vendored

// FIR_IDENTICAL
import java.util.*
import kotlin.comparisons.compareBy
import kotlin.comparisons.nullsLast
class Foo(val a: String, val b: Int)
fun getComp(): Comparator<Foo?> =
when {
else -> nullsLast(compareBy({ it.a }, { it.b }))
}
fun getCompInverted(): Comparator<Foo?> =
nullsLast(
when {
else -> compareBy({ it.a }, { it.b })
}
)