4dd794c2d2
This ensures correct generation of generic signatures in the resulting byte code, but it _is_ a work in progress: the actual type *arguments* passed for these parameters during compilation are dummy `Any?` types. Sites that need more work are indicated with TODO's. - copy type parameters of interfaces to methods moved to DefaultImpls - implement type parameter renaming scheme from JVM, with proper renaming and substitution. - adjust call sites in bridges in classes->DefaultImpls - adjust call sites in bridges from DefaultImpls->Interface - adjust call sites in bridges from DefaultImpls->DefaultImpls - adjust super calls ->DefaultImpls - adjust calls in code of Interfaces->DefaultImpls
30 lines
861 B
Kotlin
Vendored
30 lines
861 B
Kotlin
Vendored
// IGNORE_BACKEND_FIR: JVM_IR
|
|
// TARGET_BACKEND: JVM
|
|
|
|
// WITH_REFLECT
|
|
package test
|
|
|
|
class B<M>
|
|
|
|
interface A<T, Y : B<T>> {
|
|
|
|
fun <T, L> p(p: T): T {
|
|
return p
|
|
}
|
|
|
|
val <T> T.z : T?
|
|
get() = null
|
|
}
|
|
|
|
|
|
fun box(): String {
|
|
val defaultImpls = Class.forName("test.A\$DefaultImpls")
|
|
val declaredMethod = defaultImpls.getDeclaredMethod("p", A::class.java, Any::class.java)
|
|
if (declaredMethod.toGenericString() != "public static <T_I1,Y,T,L> T test.A\$DefaultImpls.p(test.A<T_I1, Y>,T)") return "fail 1: ${declaredMethod.toGenericString()}"
|
|
|
|
val declaredProperty = defaultImpls.getDeclaredMethod("getZ", A::class.java, Any::class.java)
|
|
if (declaredProperty.toGenericString() != "public static <T_I1,Y,T> T test.A\$DefaultImpls.getZ(test.A<T_I1, Y>,T)") return "fail 2: ${declaredProperty.toGenericString()}"
|
|
|
|
return "OK"
|
|
}
|