Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/factoryPattern/independentResolutionInLambda.kt
T
2020-05-31 18:13:17 +03:00

41 lines
879 B
Kotlin
Vendored

// !LANGUAGE: +NewInference +OverloadResolutionByLambdaReturnType
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_EXPRESSION
// ISSUE: KT-11265
// FILE: OverloadResolutionByLambdaReturnType.kt
package kotlin
annotation class OverloadResolutionByLambdaReturnType
// FILE: main.kt
import kotlin.OverloadResolutionByLambdaReturnType
@kotlin.jvm.JvmName("myFlatMapIterable")
@OverloadResolutionByLambdaReturnType
fun <T, R> Sequence<T>.myFlatMap(transform: (T) -> Iterable<R>): Sequence<R> {
TODO()
}
fun <T, R> Sequence<T>.myFlatMap(transform: (T) -> Sequence<R>): Sequence<R> {
TODO()
}
interface A {
val supertypes: Collection<B>
}
interface B {
val descriptors: Sequence<C>?
}
interface C
fun <K : Any> elvis(x: K?, y: K): K = y
fun test(a: A) {
a.supertypes.asSequence().myFlatMap {
elvis(it.descriptors, sequenceOf())
}
}