[NI] Don't fail on captured type that contains type variable
This commit is contained in:
compiler/testData/diagnostics/tests/inference/capturedTypes/capturedTypeWithTypeVariableSubtyping.kt
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
fun takeCovArray(a: Array<out Number>) {}
|
||||
fun takeInArray(a: Array<in Number>) {}
|
||||
|
||||
fun <T> foo(): Array<out T> = TODO()
|
||||
fun <T> bar(): Array<in T> = TODO()
|
||||
|
||||
fun <X> id(x: X): X = x
|
||||
fun <Z> arrayInId(z: Array<in Z>): Array<in Z> = z
|
||||
fun <Z> arrayOutId(z: Array<out Z>): Array<out Z> = z
|
||||
|
||||
fun test() {
|
||||
takeCovArray(foo())
|
||||
takeInArray(bar())
|
||||
|
||||
takeCovArray(id(foo()))
|
||||
takeInArray(id(bar()))
|
||||
|
||||
takeCovArray(arrayOutId(foo()))
|
||||
takeInArray(arrayInId(bar()))
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ Z> arrayInId(/*0*/ z: kotlin.Array<in Z>): kotlin.Array<in Z>
|
||||
public fun </*0*/ Z> arrayOutId(/*0*/ z: kotlin.Array<out Z>): kotlin.Array<out Z>
|
||||
public fun </*0*/ T> bar(): kotlin.Array<in T>
|
||||
public fun </*0*/ T> foo(): kotlin.Array<out T>
|
||||
public fun </*0*/ X> id(/*0*/ x: X): X
|
||||
public fun takeCovArray(/*0*/ a: kotlin.Array<out kotlin.Number>): kotlin.Unit
|
||||
public fun takeInArray(/*0*/ a: kotlin.Array<in kotlin.Number>): kotlin.Unit
|
||||
public fun test(): kotlin.Unit
|
||||
@@ -18,7 +18,7 @@ fun test1(int: Int, any: Any) {
|
||||
|
||||
val a2 : MyList<out Any> = getMyList(int)
|
||||
|
||||
val a3 : MyList<out Any> = <!NI;TYPE_MISMATCH!>getMyListToReadFrom(int)<!>
|
||||
val a3 : MyList<out Any> = getMyListToReadFrom(int)
|
||||
|
||||
val a4 : MyList<in Int> = getMyList(any)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user