517688e163
Before fix only one level of type arguments was used to determine variance of type variable to find out direction requirements. This incorrect in general case, because outer variance affects subtyping deductions, for example: Inv<Out<A>> <: Inv<Out<B>> => A <: B; B <: A, despite A and B are in covariant position if only one level is considered ^KT-36233 Fixed
14 lines
313 B
Kotlin
Vendored
14 lines
313 B
Kotlin
Vendored
// !LANGUAGE: +NewInference
|
|
// !CHECK_TYPE
|
|
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNREACHABLE_CODE
|
|
|
|
class Inv<T>
|
|
class Out<out T>
|
|
|
|
fun <K> invOut(y: K?): Inv<Out<K>> = TODO()
|
|
fun <R> test(x: Inv<Out<R>>): R = TODO()
|
|
|
|
fun testNothing() {
|
|
test(invOut(null)) checkType { <!UNRESOLVED_REFERENCE!>_<!><Nothing>() }
|
|
}
|