Files
kotlin-fork/compiler/testData/diagnostics/tests/duplicateParameterName.kt
T
Nikolay Lunyak 3db7df6898 [FIR] Fix FirDuplicateParameterNameInFunctionTypeChecker
It was supposed to check only function types...

Also note that it's probably impossible
to write a simpler test right now,
because we have a massive problem that
we ignore `FirTypeRef`s with `null`
sources despite having a dedicated
family of checkers for them
specifically. This will be fixed
separately as KT-65647.

^KT-65584 Fixed
^KT-65647
2024-02-12 09:00:15 +00:00

43 lines
1.0 KiB
Kotlin
Vendored

// FIR_IDENTICAL
// ISSUE: KT-65584
// WITH_STDLIB
fun interface Flow<out T> {
suspend fun collect(collector: FlowCollector<T>)
}
fun interface FlowCollector<in T> {
suspend fun emit(value: T)
}
inline fun <T, R> Flow<T>.flatMapLatest(crossinline transform: suspend (value: T) -> Flow<R>) = Flow { collector ->
collect { it1 -> transform(it1).collect { it2 -> collector.emit(it2) } }
}
fun <T> flowOf(value: T): Flow<T> = Flow { collector -> collector.emit(value) }
inline fun <T, R> Flow<T>.map(crossinline transform: suspend (value: T) -> R): Flow<R> = Flow { collector ->
collect { collector.emit(transform(it)) }
}
// ------
class StationId
class Playable
class Entity(val stationId: StationId)
class State(val playbackEntity: Entity)
internal suspend fun init(
queueState: State,
state: Flow<Playable>
) {
state
.flatMapLatest { playable ->
flowOf(playable).map { Triple(it, playable, queueState.playbackEntity.stationId) }
}
.collect { (likeState, playable, stationId) ->
}
}