Substitute captured types with type variables properly

^KT-44687 Fixed
This commit is contained in:
Victor Petukhov
2021-03-15 12:51:42 +03:00
parent d276d583ba
commit a2b1aa753b
6 changed files with 51 additions and 4 deletions
@@ -0,0 +1,12 @@
// !DIAGNOSTICS: -CAST_NEVER_SUCCEEDS -UNUSED_PARAMETER
class Foo<K>
fun <T> getFoo(value: T) = null as Foo<out Foo<T>>
fun <R> takeLambda(block: () -> R) {}
fun main(x: Int) {
takeLambda {
getFoo(x)
}
}
@@ -0,0 +1,12 @@
// !DIAGNOSTICS: -CAST_NEVER_SUCCEEDS -UNUSED_PARAMETER
class Foo<K>
fun <T> getFoo(value: T) = null as Foo<out Foo<T>>
fun <R> takeLambda(block: () -> R) {}
fun main(x: Int) {
takeLambda {
getFoo(x)
}
}
@@ -0,0 +1,12 @@
package
public fun </*0*/ T> getFoo(/*0*/ value: T): Foo<out Foo<T>>
public fun main(/*0*/ x: kotlin.Int): kotlin.Unit
public fun </*0*/ R> takeLambda(/*0*/ block: () -> R): kotlin.Unit
public final class Foo</*0*/ K> {
public constructor Foo</*0*/ K>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}