diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/innerClassHierarchy.kt b/compiler/fir/analysis-tests/testData/resolve/problems/innerClassHierarchy.kt new file mode 100644 index 00000000000..ed1ff5ce405 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolve/problems/innerClassHierarchy.kt @@ -0,0 +1,25 @@ +open class Base { + open inner class Inner +} + +class Derived : Base() { + inner class InnerDerived : Inner() { + inner class VeryInner : Inner() { + inner class VeryVeryInner : Inner() + } + } +} + +open class A(val s: String) { + open inner class B(s: String): A(s) + + open inner class C(s: String, additional: Double): B(s) + + open inner class D(other: Int, another: Long, s: String) : C(s, another.toDouble()) + + open inner class E : D(0, 42L, "OK") + + inner class F : E() +} + +fun box(): String = A("Fail").F().s \ No newline at end of file diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/innerClassHierarchy.txt b/compiler/fir/analysis-tests/testData/resolve/problems/innerClassHierarchy.txt new file mode 100644 index 00000000000..08b3b0affe3 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolve/problems/innerClassHierarchy.txt @@ -0,0 +1,88 @@ +FILE: innerClassHierarchy.kt + public open class Base : R|kotlin/Any| { + public constructor(): R|Base| { + super() + } + + public open inner class Inner : R|kotlin/Any| { + public constructor(): R|Base.Inner| { + super() + } + + } + + } + public final class Derived : R|Base| { + public constructor(): R|Derived| { + super() + } + + public final inner class InnerDerived : R|Base.Inner| { + public constructor(): R|Derived.InnerDerived| { + this@R|/Derived|.super() + } + + public final inner class VeryInner : R|Base.Inner| { + public constructor(): R|Derived.InnerDerived.VeryInner| { + super() + } + + public final inner class VeryVeryInner : R|Base.Inner| { + public constructor(): R|Derived.InnerDerived.VeryInner.VeryVeryInner| { + super() + } + + } + + } + + } + + } + public open class A : R|kotlin/Any| { + public constructor(s: R|kotlin/String|): R|A| { + super() + } + + public final val s: R|kotlin/String| = R|/s| + public get(): R|kotlin/String| + + public open inner class B : R|A| { + public constructor(s: R|kotlin/String|): R|A.B| { + super(R|/s|) + } + + } + + public open inner class C : R|A.B| { + public constructor(s: R|kotlin/String|, additional: R|kotlin/Double|): R|A.C| { + this@R|/A|.super(R|/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| { + this@R|/A|.super(R|/s|, R|/another|.R|kotlin/Long.toDouble|()) + } + + } + + public open inner class E : R|A.D| { + public constructor(): R|A.E| { + this@R|/A|.super(Int(0), Long(42), String(OK)) + } + + } + + public final inner class F : R|A.E| { + public constructor(): R|A.F| { + this@R|/A|.super() + } + + } + + } + public final fun box(): R|kotlin/String| { + ^box R|/A.A|(String(Fail)).R|/A.F.F|().R|/A.s| + } diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java index 26fdb2382da..b293dc81461 100644 --- a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java @@ -1644,6 +1644,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest { runTest("compiler/fir/analysis-tests/testData/resolve/problems/flexibleTypeVarAgainstNull.kt"); } + @TestMetadata("innerClassHierarchy.kt") + public void testInnerClassHierarchy() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/problems/innerClassHierarchy.kt"); + } + @TestMetadata("javaAccessorConversion.kt") public void testJavaAccessorConversion() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolve/problems/javaAccessorConversion.kt"); diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java index c40bb7fb609..720f12bbaf3 100644 --- a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java @@ -1644,6 +1644,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos runTest("compiler/fir/analysis-tests/testData/resolve/problems/flexibleTypeVarAgainstNull.kt"); } + @TestMetadata("innerClassHierarchy.kt") + public void testInnerClassHierarchy() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/problems/innerClassHierarchy.kt"); + } + @TestMetadata("javaAccessorConversion.kt") public void testJavaAccessorConversion() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolve/problems/javaAccessorConversion.kt");