Files
kotlin-fork/compiler/testData/codegen/box/inference/builderInference/kt42139.kt
T
2021-10-12 08:42:00 +03:00

27 lines
712 B
Kotlin
Vendored

// !LANGUAGE: +UnrestrictedBuilderInference
// WITH_RUNTIME
// IGNORE_BACKEND_FIR: JVM_IR
fun <R> select(vararg x: R) = x[0]
fun <K> myEmptyList(): List<K> = emptyList()
fun f1(): Sequence<List<Int>> = sequence {
yield(myEmptyList())
}
fun f2(): Sequence<List<Int>> = sequence {
select(yield(myEmptyList()), yield(myEmptyList()))
}
fun f3(): Sequence<List<Int>> = sequence {
if (true) yield(myEmptyList()) // [NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER] Not enough information to infer type variable T
else yield(myEmptyList()) // [NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER] Not enough information to infer type variable T
}
fun box(): String {
f1()
f2()
f3()
return "OK"
}