I just noticed a weird issue when trying to copy code between two projects.
In Kotlin 1.3, it was possible to call flatMap
on a Sequence, i.e.
val xx = (1 .. 10)
.asSequence()
.flatMap { sequenceOf(it.toFloat()) }
Was valid in 1.3, but in 1.4 produces this error:
Cannot choose among the following candidates without completing type inference:
public fun <T, R> Sequence<Int>.flatMap(transform: (Int) → Iterable<???>): Sequence<???> defined in kotlin.sequences
public fun <T, R> Sequence<Int>.flatMap(transform: (Int) → Sequence<???>): Sequence<???> defined in kotlin.sequences
It looks like the closest equivalent is now
val xx = (1 .. 10)
.asSequence()
.map { sequenceOf(it.toFloat()) }
.flatten()