715a73c8fb
The idea is that we should not fix (i.e. choose any of the fork branches) on the stage of candidate processing before completion, but it's enough just to check that current state can be converged to success. And when completion starts, and we add expected type to the system, we've got more information to choose the correct fork branch. NB: The old `processForkConstraints` is being called just at the beginning of the completion phase. ^KT-43296 In Progress
42 lines
883 B
Kotlin
Vendored
42 lines
883 B
Kotlin
Vendored
// SKIP_TXT
|
|
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
|
|
|
interface OutBase<out E>
|
|
interface OutDerived<out F> : OutBase<F>
|
|
|
|
fun <X> OutBase<X>.myLast(): X = TODO()
|
|
|
|
fun <T> foo(x: OutBase<T>) {
|
|
if (x is OutDerived<*>) {
|
|
val l: T = x.myLast() // required T, found Cap(*). Only in NI
|
|
}
|
|
}
|
|
|
|
interface InvBase<E>
|
|
interface InvDerived<F> : InvBase<F>
|
|
|
|
fun <X> InvBase<X>.myLastInv(): X = TODO()
|
|
|
|
fun <T> fooInv(x: InvBase<T>) {
|
|
if (x is InvDerived<*>) {
|
|
val l: T = x.myLastInv() // required T, found Cap(*). Only in NI
|
|
}
|
|
}
|
|
|
|
interface Base<E>
|
|
|
|
fun <Q> Base<Q>.foo(): Q = TODO()
|
|
fun <Q : CharSequence> Base<Q>.baz(): Q = TODO()
|
|
|
|
interface Derived<F : CharSequence> : Base<F>
|
|
|
|
fun Number.num() {}
|
|
|
|
fun main(b: Base<out Number>) {
|
|
b.foo().num()
|
|
if (b is Derived<*>) {
|
|
b.foo().<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>num<!>()
|
|
b.baz().length
|
|
}
|
|
}
|