Files
kotlin-fork/compiler/testData/codegen/box/boxingOptimization/maxMinByOrNull.kt
T
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00

20 lines
582 B
Kotlin
Vendored

// WITH_STDLIB
fun box(): String {
val intList = listOf(1, 2, 3)
val longList = listOf(1L, 2L, 3L)
val intListMin = intList.minByOrNull { it }
if (intListMin != 1) return "Fail intListMin=$intListMin"
val intListMax = intList.maxByOrNull { it }
if (intListMax != 3) return "Fail intListMax=$intListMax"
val longListMin = longList.minByOrNull { it }
if (longListMin != 1L) return "Fail longListMin=$longListMin"
val longListMax = longList.maxByOrNull { it }
if (longListMax != 3L) return "Fail longListMax=$longListMax"
return "OK"
}