K2: Fix deserialization of flexible type based on type parameter

It's anyway safe to use avoidComprehensiveCheck = true because
during deserialization we're sure that we need DNN type because
it's been serialized as such.
This commit is contained in:
Denis.Zharkov
2022-11-23 17:35:23 +01:00
committed by Space Team
parent ff340505ec
commit f7d8fd54ca
7 changed files with 55 additions and 2 deletions
@@ -0,0 +1,24 @@
// TARGET_BACKEND: JVM
// WITH_STDLIB
// MODULE: lib
// FILE: JavaInterface.java
public interface JavaInterface {
<K extends Comparable<K>> K foo();
}
// FILE: A.kt
class A(j: JavaInterface) : JavaInterface by j
// MODULE: main(lib)
// FILE: main.kt
fun box(): String {
val t = object : JavaInterface {
override fun <K : Comparable<K>> foo(): K = "OK" as K
}
return A(t).foo<String>()
}