Files
kotlin-fork/compiler/testData/diagnostics/tests/inference/builderInference/kt47986_4.kt
T
Victor Petukhov 848075192c [FE 1.0] Don't use BuilderInferenceSubstitutionConstraintPosition for declared upper bound constraint with no substituted upper bound
It leads to further infer type variable into those upper bounds which is forbidden

Substituted upper bounds is ok because specific substituted types came from constraints of other proper positions, or if specific substituted type is from declared upper bound too, then there should be another declared upper bound with no substitution

^KT-51464 Fixed
^KT-47986 Fixed
2022-05-31 14:13:28 +00:00

15 lines
274 B
Kotlin
Vendored

// FIR_IDENTICAL
class Foo<K>
fun <K> buildFoo(builderAction: Foo<K>.() -> Unit): Foo<K> = Foo()
class Bar<K>
fun <K: Bar<N>, N: Bar<K>> Foo<K>.bar(x: Int = 1) {}
fun main() {
val x = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>buildFoo<!> {
bar()
}
}