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 1ff0fdf1ee2..a5899973393 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 @@ -26632,12 +26632,30 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/intermediateWithActualAndExpect.kt"); } + @Test + @TestMetadata("sealedInheritorsCorrectExpect.kt") + public void testSealedInheritorsCorrectExpect() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsCorrectExpect.kt"); + } + @Test @TestMetadata("sealedInheritorsInComplexModuleStructure.kt") public void testSealedInheritorsInComplexModuleStructure() throws Exception { runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsInComplexModuleStructure.kt"); } + @Test + @TestMetadata("sealedInheritorsIncorrectExpect.kt") + public void testSealedInheritorsIncorrectExpect() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsIncorrectExpect.kt"); + } + + @Test + @TestMetadata("sealedInheritorsIncorrectNonExpect.kt") + public void testSealedInheritorsIncorrectNonExpect() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsIncorrectNonExpect.kt"); + } + @Nested @TestMetadata("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/annotationMatching") @TestDataPath("$PROJECT_ROOT") 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 bad83777ecc..ec4b65a34e3 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 @@ -26632,12 +26632,30 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/intermediateWithActualAndExpect.kt"); } + @Test + @TestMetadata("sealedInheritorsCorrectExpect.kt") + public void testSealedInheritorsCorrectExpect() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsCorrectExpect.kt"); + } + @Test @TestMetadata("sealedInheritorsInComplexModuleStructure.kt") public void testSealedInheritorsInComplexModuleStructure() throws Exception { runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsInComplexModuleStructure.kt"); } + @Test + @TestMetadata("sealedInheritorsIncorrectExpect.kt") + public void testSealedInheritorsIncorrectExpect() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsIncorrectExpect.kt"); + } + + @Test + @TestMetadata("sealedInheritorsIncorrectNonExpect.kt") + public void testSealedInheritorsIncorrectNonExpect() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsIncorrectNonExpect.kt"); + } + @Nested @TestMetadata("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/annotationMatching") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated.java index f2d1640806d..5cb4db0ad70 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated.java @@ -1791,12 +1791,30 @@ public class FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated extends Abst runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/intermediateWithActualAndExpect.kt"); } + @Test + @TestMetadata("sealedInheritorsCorrectExpect.kt") + public void testSealedInheritorsCorrectExpect() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsCorrectExpect.kt"); + } + @Test @TestMetadata("sealedInheritorsInComplexModuleStructure.kt") public void testSealedInheritorsInComplexModuleStructure() throws Exception { runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsInComplexModuleStructure.kt"); } + @Test + @TestMetadata("sealedInheritorsIncorrectExpect.kt") + public void testSealedInheritorsIncorrectExpect() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsIncorrectExpect.kt"); + } + + @Test + @TestMetadata("sealedInheritorsIncorrectNonExpect.kt") + public void testSealedInheritorsIncorrectNonExpect() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsIncorrectNonExpect.kt"); + } + @Nested @TestMetadata("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/annotationMatching") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithPsiTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithPsiTestGenerated.java index 1bdd7465dc4..39e06abf839 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithPsiTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithPsiTestGenerated.java @@ -1791,12 +1791,30 @@ public class FirOldFrontendMPPDiagnosticsWithPsiTestGenerated extends AbstractFi runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/intermediateWithActualAndExpect.kt"); } + @Test + @TestMetadata("sealedInheritorsCorrectExpect.kt") + public void testSealedInheritorsCorrectExpect() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsCorrectExpect.kt"); + } + @Test @TestMetadata("sealedInheritorsInComplexModuleStructure.kt") public void testSealedInheritorsInComplexModuleStructure() throws Exception { runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsInComplexModuleStructure.kt"); } + @Test + @TestMetadata("sealedInheritorsIncorrectExpect.kt") + public void testSealedInheritorsIncorrectExpect() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsIncorrectExpect.kt"); + } + + @Test + @TestMetadata("sealedInheritorsIncorrectNonExpect.kt") + public void testSealedInheritorsIncorrectNonExpect() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsIncorrectNonExpect.kt"); + } + @Nested @TestMetadata("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/annotationMatching") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsCorrectExpect.kt b/compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsCorrectExpect.kt new file mode 100644 index 00000000000..1a364553b58 --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsCorrectExpect.kt @@ -0,0 +1,33 @@ +// FIR_IDENTICAL +// MODULE: common +// TARGET_PLATFORM: Common + +package test + +expect sealed class Sealed +expect class Sealed1 : Sealed + +expect sealed interface SealedIface +expect class SealedImpl1 : SealedIface + +// MODULE: intermediate()()(common) +// TARGET_PLATFORM: Common + +package test + +expect class Sealed2 : Sealed + +expect class SealedImpl2 : SealedIface + +// MODULE: main()()(intermediate) +// TARGET_PLATFORM: JVM + +package test + +actual sealed class Sealed(val v: Int) +actual class Sealed1() : Sealed(1) +actual class Sealed2() : Sealed(2) + +actual sealed interface SealedIface +actual class SealedImpl1() : SealedIface +actual class SealedImpl2() : SealedIface diff --git a/compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsInComplexModuleStructure.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsInComplexModuleStructure.fir.kt deleted file mode 100644 index 85dcf1cdc33..00000000000 --- a/compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsInComplexModuleStructure.fir.kt +++ /dev/null @@ -1,21 +0,0 @@ - -// MODULE: common -// TARGET_PLATFORM: Common - -package foo - -expect sealed class SealedWithSharedActual() -expect sealed class SealedWithPlatformActuals : SealedWithSharedActual - -// MODULE: intermediate()()(common) -// TARGET_PLATFORM: Common -package foo - -actual sealed class SealedWithSharedActual -class SimpleShared : SealedWithPlatformActuals() - -// MODULE: main()()(intermediate) -// TARGET_PLATFORM: JVM -package foo - -actual sealed class SealedWithPlatformActuals actual constructor(): SealedWithSharedActual() diff --git a/compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsInComplexModuleStructure.kt b/compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsInComplexModuleStructure.kt index f05c19b42b3..650a4ae8886 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsInComplexModuleStructure.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsInComplexModuleStructure.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // MODULE: common // TARGET_PLATFORM: Common @@ -5,17 +6,17 @@ package foo expect sealed class SealedWithSharedActual() -expect sealed class SealedWithPlatformActuals : SealedWithSharedActual +expect sealed class SealedWithPlatformActuals() : SealedWithSharedActual // MODULE: intermediate()()(common) // TARGET_PLATFORM: Common package foo actual sealed class SealedWithSharedActual -class SimpleShared : SealedWithPlatformActuals() +class SimpleShared : SealedWithPlatformActuals() // MODULE: main()()(intermediate) // TARGET_PLATFORM: JVM package foo -actual sealed class SealedWithPlatformActuals actual constructor(): SealedWithSharedActual() +actual sealed class SealedWithPlatformActuals actual constructor(): SealedWithSharedActual() diff --git a/compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsInComplexModuleStructure.txt b/compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsInComplexModuleStructure.txt index 8a86c2cc7f1..38f3bec5d34 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsInComplexModuleStructure.txt +++ b/compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsInComplexModuleStructure.txt @@ -4,6 +4,7 @@ package package foo { public sealed expect class SealedWithPlatformActuals : foo.SealedWithSharedActual { + protected constructor SealedWithPlatformActuals() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String diff --git a/compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsIncorrectExpect.kt b/compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsIncorrectExpect.kt new file mode 100644 index 00000000000..7598a0c0d5e --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsIncorrectExpect.kt @@ -0,0 +1,32 @@ +// FIR_IDENTICAL +// MODULE: common +// TARGET_PLATFORM: Common + +package test + +expect sealed class Sealed +expect class Sealed1 : Sealed + +expect sealed interface SealedIface +expect class SealedImpl1 : SealedIface + +// MODULE: intermediate()()(common) +// TARGET_PLATFORM: Common + +package test + +actual sealed class Sealed(val v: Int) +actual class Sealed1() : Sealed(1) +expect class Sealed2 : Sealed + +actual sealed interface SealedIface +actual class SealedImpl1() : SealedIface +expect class SealedImpl2 : SealedIface + +// MODULE: main()()(intermediate) +// TARGET_PLATFORM: JVM + +package test + +actual class Sealed2() : Sealed(2) +actual class SealedImpl2() : SealedIface diff --git a/compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsIncorrectNonExpect.kt b/compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsIncorrectNonExpect.kt new file mode 100644 index 00000000000..677877b2ad2 --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsIncorrectNonExpect.kt @@ -0,0 +1,24 @@ +// FIR_IDENTICAL +// MODULE: common +// TARGET_PLATFORM: Common + +package test + +sealed class SealedExpectActual(val v: Int) +class SealedExpectActual1() : SealedExpectActual(1) + +// MODULE: intermediate()()(common) +// TARGET_PLATFORM: Common + +package test + +/* sealed inheritors are allowed in dependsOn source sets only for expect delclations */ +class SealedExpectActual2() : SealedExpectActual(2) + +// MODULE: main()()(intermediate) +// TARGET_PLATFORM: JVM + +package test + +/* sealed inheritors are allowed in dependsOn source sets only for expect delclations */ +class SealedExpectActual3() : SealedExpectActual(3) 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 d2b902f41d9..31f5573bbd4 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 @@ -26632,12 +26632,30 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/intermediateWithActualAndExpect.kt"); } + @Test + @TestMetadata("sealedInheritorsCorrectExpect.kt") + public void testSealedInheritorsCorrectExpect() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsCorrectExpect.kt"); + } + @Test @TestMetadata("sealedInheritorsInComplexModuleStructure.kt") public void testSealedInheritorsInComplexModuleStructure() throws Exception { runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsInComplexModuleStructure.kt"); } + @Test + @TestMetadata("sealedInheritorsIncorrectExpect.kt") + public void testSealedInheritorsIncorrectExpect() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsIncorrectExpect.kt"); + } + + @Test + @TestMetadata("sealedInheritorsIncorrectNonExpect.kt") + public void testSealedInheritorsIncorrectNonExpect() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsIncorrectNonExpect.kt"); + } + @Nested @TestMetadata("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/annotationMatching") @TestDataPath("$PROJECT_ROOT")