diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java index 6432cb9e107..4284141bfa3 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java @@ -21380,6 +21380,18 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia runTest("compiler/testData/diagnostics/tests/inner/annotationInInnerClass.kt"); } + @Test + @TestMetadata("callingOuterGenericClassConstructorWithSelfTypes.kt") + public void testCallingOuterGenericClassConstructorWithSelfTypes() throws Exception { + runTest("compiler/testData/diagnostics/tests/inner/callingOuterGenericClassConstructorWithSelfTypes.kt"); + } + + @Test + @TestMetadata("callingOuterGenericClassConstructorWithSelfTypesInitial.kt") + public void testCallingOuterGenericClassConstructorWithSelfTypesInitial() throws Exception { + runTest("compiler/testData/diagnostics/tests/inner/callingOuterGenericClassConstructorWithSelfTypesInitial.kt"); + } + @Test @TestMetadata("classesInClassObjectHeader.kt") public void testClassesInClassObjectHeader() throws Exception { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java index c795ae06f25..f74cfec76a6 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java @@ -21380,6 +21380,18 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated runTest("compiler/testData/diagnostics/tests/inner/annotationInInnerClass.kt"); } + @Test + @TestMetadata("callingOuterGenericClassConstructorWithSelfTypes.kt") + public void testCallingOuterGenericClassConstructorWithSelfTypes() throws Exception { + runTest("compiler/testData/diagnostics/tests/inner/callingOuterGenericClassConstructorWithSelfTypes.kt"); + } + + @Test + @TestMetadata("callingOuterGenericClassConstructorWithSelfTypesInitial.kt") + public void testCallingOuterGenericClassConstructorWithSelfTypesInitial() throws Exception { + runTest("compiler/testData/diagnostics/tests/inner/callingOuterGenericClassConstructorWithSelfTypesInitial.kt"); + } + @Test @TestMetadata("classesInClassObjectHeader.kt") public void testClassesInClassObjectHeader() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java index dbe579eba1e..2fbe6d6e981 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java @@ -21374,6 +21374,18 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir runTest("compiler/testData/diagnostics/tests/inner/annotationInInnerClass.kt"); } + @Test + @TestMetadata("callingOuterGenericClassConstructorWithSelfTypes.kt") + public void testCallingOuterGenericClassConstructorWithSelfTypes() throws Exception { + runTest("compiler/testData/diagnostics/tests/inner/callingOuterGenericClassConstructorWithSelfTypes.kt"); + } + + @Test + @TestMetadata("callingOuterGenericClassConstructorWithSelfTypesInitial.kt") + public void testCallingOuterGenericClassConstructorWithSelfTypesInitial() throws Exception { + runTest("compiler/testData/diagnostics/tests/inner/callingOuterGenericClassConstructorWithSelfTypesInitial.kt"); + } + @Test @TestMetadata("classesInClassObjectHeader.kt") public void testClassesInClassObjectHeader() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java index 1821a6fdc0f..9a142d19d4a 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java @@ -21380,6 +21380,18 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia runTest("compiler/testData/diagnostics/tests/inner/annotationInInnerClass.kt"); } + @Test + @TestMetadata("callingOuterGenericClassConstructorWithSelfTypes.kt") + public void testCallingOuterGenericClassConstructorWithSelfTypes() throws Exception { + runTest("compiler/testData/diagnostics/tests/inner/callingOuterGenericClassConstructorWithSelfTypes.kt"); + } + + @Test + @TestMetadata("callingOuterGenericClassConstructorWithSelfTypesInitial.kt") + public void testCallingOuterGenericClassConstructorWithSelfTypesInitial() throws Exception { + runTest("compiler/testData/diagnostics/tests/inner/callingOuterGenericClassConstructorWithSelfTypesInitial.kt"); + } + @Test @TestMetadata("classesInClassObjectHeader.kt") public void testClassesInClassObjectHeader() throws Exception { diff --git a/compiler/testData/diagnostics/tests/inner/callingOuterGenericClassConstructorWithSelfTypes.fir.kt b/compiler/testData/diagnostics/tests/inner/callingOuterGenericClassConstructorWithSelfTypes.fir.kt new file mode 100644 index 00000000000..86d8886771e --- /dev/null +++ b/compiler/testData/diagnostics/tests/inner/callingOuterGenericClassConstructorWithSelfTypes.fir.kt @@ -0,0 +1,21 @@ +// ISSUE: KT-64841 + +open class A>(a: Any?) { + // Constraints while resolving super constructor call + // + // The signature of constructor comes substituted + // constructor>|>(a: R|kotlin/Any?|): R|A>| + // + // Xv <: A.B> (from type parameter bounds, actually it's the incorrect place) + // + // Xv := A.B (from explicit type argument of constructor call) + // A.B> <: A.B> + // A.B> <: A.B> + // Xv := X + // X != A.B -> FAIL + inner class B : A("") { + fun foo() { + A("") + } + } +} diff --git a/compiler/testData/diagnostics/tests/inner/callingOuterGenericClassConstructorWithSelfTypes.kt b/compiler/testData/diagnostics/tests/inner/callingOuterGenericClassConstructorWithSelfTypes.kt new file mode 100644 index 00000000000..d5589237fe0 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inner/callingOuterGenericClassConstructorWithSelfTypes.kt @@ -0,0 +1,21 @@ +// ISSUE: KT-64841 + +open class A>(a: Any?) { + // Constraints while resolving super constructor call + // + // The signature of constructor comes substituted + // constructor>|>(a: R|kotlin/Any?|): R|A>| + // + // Xv <: A.B> (from type parameter bounds, actually it's the incorrect place) + // + // Xv := A.B (from explicit type argument of constructor call) + // A.B> <: A.B> + // A.B> <: A.B> + // Xv := X + // X != A.B -> FAIL + inner class B : A("") { + fun foo() { + A("") + } + } +} diff --git a/compiler/testData/diagnostics/tests/inner/callingOuterGenericClassConstructorWithSelfTypesInitial.fir.kt b/compiler/testData/diagnostics/tests/inner/callingOuterGenericClassConstructorWithSelfTypesInitial.fir.kt new file mode 100644 index 00000000000..426a6b0c392 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inner/callingOuterGenericClassConstructorWithSelfTypesInitial.fir.kt @@ -0,0 +1,6 @@ +// ISSUE: KT-64841 +abstract class A> + +abstract class B>(delegate: A) : A() { + inner class C : B>(this) +} diff --git a/compiler/testData/diagnostics/tests/inner/callingOuterGenericClassConstructorWithSelfTypesInitial.kt b/compiler/testData/diagnostics/tests/inner/callingOuterGenericClassConstructorWithSelfTypesInitial.kt new file mode 100644 index 00000000000..0e022bf61d0 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inner/callingOuterGenericClassConstructorWithSelfTypesInitial.kt @@ -0,0 +1,6 @@ +// ISSUE: KT-64841 +abstract class A> + +abstract class B>(delegate: A) : A() { + inner class C : B>(this) +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index 3e86d289508..f758128f8f1 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -21380,6 +21380,18 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/inner/annotationInInnerClass.kt"); } + @Test + @TestMetadata("callingOuterGenericClassConstructorWithSelfTypes.kt") + public void testCallingOuterGenericClassConstructorWithSelfTypes() throws Exception { + runTest("compiler/testData/diagnostics/tests/inner/callingOuterGenericClassConstructorWithSelfTypes.kt"); + } + + @Test + @TestMetadata("callingOuterGenericClassConstructorWithSelfTypesInitial.kt") + public void testCallingOuterGenericClassConstructorWithSelfTypesInitial() throws Exception { + runTest("compiler/testData/diagnostics/tests/inner/callingOuterGenericClassConstructorWithSelfTypesInitial.kt"); + } + @Test @TestMetadata("classesInClassObjectHeader.kt") public void testClassesInClassObjectHeader() throws Exception {