[FIR2IR] Unwrap call-site substitution overrides

Generating IR declarations for use-site substitution overrides leads
to IR that is different from K1 as well as problems in signature
generation which relies on mangling. Use-site substitutions can contain
references to type parameters from the call-site which aren't handled
in mangling.

#KT-57022 Fixed
This commit is contained in:
Kirill Rakhman
2023-06-07 16:16:36 +02:00
committed by Space Team
parent bcdd85758e
commit 86836e69e9
10 changed files with 248 additions and 121 deletions
@@ -1,6 +1,6 @@
class Test<T : Any?> : J<T> {
class Inv<T : Any?> {
constructor(x: T) /* primary */ {
super/*J*/<T>()
super/*Any*/()
/* <init>() */
}
@@ -9,8 +9,38 @@ class Test<T : Any?> : J<T> {
field = x
get
fun test(b: B<T>) {
}
class Test_1<TT : Any?> : JavaClass1<TT> {
constructor(x: TT) /* primary */ {
super/*JavaClass1*/<TT>()
/* <init>() */
}
val x: TT
field = x
get
fun test(b: B<TT>) {
b.output(x = <this>.<get-x>())
}
}
class Test_2<TT : Any?> : JavaClass2<TT, Inv<TT>> {
constructor() /* primary */ {
super/*JavaClass2*/<TT, Inv<TT>>()
/* <init>() */
}
fun process(b: B<TT, Inv<TT>>) {
b.output(output = Inv<TT>(x = b.element()))
}
}
fun <R : Any?> test_3(jb: B<R>, r: R) {
jb.output(x = r)
}