4612f26bfb
Mostly, that should help for existing flatMap usages ^KT-43129 Submitted
11 lines
275 B
Kotlin
Vendored
11 lines
275 B
Kotlin
Vendored
// FIR_IDENTICAL
|
|
// !LANGUAGE: +NewInference
|
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
|
// WITH_RUNTIME
|
|
|
|
|
|
fun <T> List<Option<T>>.flatten(): List<T> = flatMap { it.fold(::emptyList, ::listOf) }
|
|
|
|
class Option<out T> {
|
|
fun <R> fold(ifEmpty: () -> R, ifSome: (T) -> R): R = TODO()
|
|
} |