[FIR] Fix dispatch receivers on inner classes' constructors

1. Inner class constructor should have its outer class as a dispatch
receiver, since it is necessary for the call. Before it was null
2. Substituted inner class constructor should have its original dispatch
 receiver type with the proper substitution. Before it was set to the
 class itself (since the class was usually passed as a new dispatch
 receiver)

Also, modify FIR renderer, so it properly renders the dispatch receiver
of the constructors
This commit is contained in:
Roman Golyshev
2021-09-28 16:40:18 +03:00
committed by Space
parent 8673819260
commit 9b9c51bc8d
65 changed files with 169 additions and 129 deletions
@@ -5,7 +5,7 @@ FILE: innerClassHierarchy.kt
}
public open inner class Inner : R|kotlin/Any| {
public constructor(): R|Base.Inner| {
public Base.constructor(): R|Base.Inner| {
super<R|kotlin/Any|>()
}
@@ -18,17 +18,17 @@ FILE: innerClassHierarchy.kt
}
public final inner class InnerDerived : R|Base.Inner| {
public constructor(): R|Derived.InnerDerived| {
public Derived.constructor(): R|Derived.InnerDerived| {
this@R|/Derived|.super<R|Base.Inner|>()
}
public final inner class VeryInner : R|Base.Inner| {
public constructor(): R|Derived.InnerDerived.VeryInner| {
public Derived.InnerDerived.constructor(): R|Derived.InnerDerived.VeryInner| {
this@R|/Derived|.super<R|Base.Inner|>()
}
public final inner class VeryVeryInner : R|Base.Inner| {
public constructor(): R|Derived.InnerDerived.VeryInner.VeryVeryInner| {
public Derived.InnerDerived.VeryInner.constructor(): R|Derived.InnerDerived.VeryInner.VeryVeryInner| {
this@R|/Derived|.super<R|Base.Inner|>()
}
@@ -48,35 +48,35 @@ FILE: innerClassHierarchy.kt
public get(): R|kotlin/String|
public open inner class B : R|A| {
public constructor(s: R|kotlin/String|): R|A.B| {
public A.constructor(s: R|kotlin/String|): R|A.B| {
super<R|A|>(R|<local>/s|)
}
}
public open inner class C : R|A.B| {
public constructor(s: R|kotlin/String|, additional: R|kotlin/Double|): R|A.C| {
public A.constructor(s: R|kotlin/String|, additional: R|kotlin/Double|): R|A.C| {
this@R|/A|.super<R|A.B|>(R|<local>/s|)
}
}
public open inner class D : R|A.C| {
public constructor(other: R|kotlin/Int|, another: R|kotlin/Long|, s: R|kotlin/String|): R|A.D| {
public A.constructor(other: R|kotlin/Int|, another: R|kotlin/Long|, s: R|kotlin/String|): R|A.D| {
this@R|/A|.super<R|A.C|>(R|<local>/s|, R|<local>/another|.R|kotlin/Long.toDouble|())
}
}
public open inner class E : R|A.D| {
public constructor(): R|A.E| {
public A.constructor(): R|A.E| {
this@R|/A|.super<R|A.D|>(Int(0), Long(42), String(OK))
}
}
public final inner class F : R|A.E| {
public constructor(): R|A.F| {
public A.constructor(): R|A.F| {
this@R|/A|.super<R|A.E|>()
}
@@ -5,7 +5,7 @@ FILE: objectDerivedFromInnerClass.kt
}
public final inner class Inner : R|kotlin/Any| {
public constructor(): R|Outer.Inner| {
public Outer.constructor(): R|Outer.Inner| {
super<R|kotlin/Any|>()
}