diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java index 8d7a5b22f4d..d8279553742 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java @@ -21356,6 +21356,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag runTest("compiler/testData/diagnostics/tests/multiplatform/implFakeOverride.kt"); } + @Test + @TestMetadata("incDecOperatorsInExpectClass.kt") + public void testIncDecOperatorsInExpectClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/incDecOperatorsInExpectClass.kt"); + } + @Test @TestMetadata("incompatibles.kt") public void testIncompatibles() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java index 36f89435ace..403c4e5d884 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java @@ -21362,6 +21362,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti runTest("compiler/testData/diagnostics/tests/multiplatform/implFakeOverride.kt"); } + @Test + @TestMetadata("incDecOperatorsInExpectClass.kt") + public void testIncDecOperatorsInExpectClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/incDecOperatorsInExpectClass.kt"); + } + @Test @TestMetadata("incompatibles.kt") public void testIncompatibles() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java index 05d6e5f6748..90bc1154bae 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java @@ -21356,6 +21356,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac runTest("compiler/testData/diagnostics/tests/multiplatform/implFakeOverride.kt"); } + @Test + @TestMetadata("incDecOperatorsInExpectClass.kt") + public void testIncDecOperatorsInExpectClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/incDecOperatorsInExpectClass.kt"); + } + @Test @TestMetadata("incompatibles.kt") public void testIncompatibles() throws Exception { diff --git a/compiler/testData/diagnostics/tests/IncDecOperatorsInExpectClass.fir.kt b/compiler/testData/diagnostics/tests/IncDecOperatorsInExpectClass.fir.kt new file mode 100644 index 00000000000..b5b055f8731 --- /dev/null +++ b/compiler/testData/diagnostics/tests/IncDecOperatorsInExpectClass.fir.kt @@ -0,0 +1,13 @@ +// In FIR, declaring the same `expect` and `actual` classes in one compiler module is not possible (see KT-55177). Hence the `.fir.kt` test +// expects a diagnostic here. The multi-module test corresponding to this test is called: `multiplatform/incDecOperatorsInExpectClass.kt`. + +// !LANGUAGE: +MultiPlatformProjects +// SKIP_TXT +// Issue: KT-49714 + +expect class Counter { + operator fun inc(): Counter + operator fun dec(): Counter +} + +actual typealias Counter = Int diff --git a/compiler/testData/diagnostics/tests/IncDecOperatorsInExpectClass.kt b/compiler/testData/diagnostics/tests/IncDecOperatorsInExpectClass.kt index cb90b5e2b99..581eb66e89d 100644 --- a/compiler/testData/diagnostics/tests/IncDecOperatorsInExpectClass.kt +++ b/compiler/testData/diagnostics/tests/IncDecOperatorsInExpectClass.kt @@ -1,4 +1,6 @@ -// FIR_IDENTICAL +// In FIR, declaring the same `expect` and `actual` classes in one compiler module is not possible (see KT-55177). Hence the `.fir.kt` test +// expects a diagnostic here. The multi-module test corresponding to this test is called: `multiplatform/incDecOperatorsInExpectClass.kt`. + // !LANGUAGE: +MultiPlatformProjects // SKIP_TXT // Issue: KT-49714 diff --git a/compiler/testData/diagnostics/tests/multiplatform/incDecOperatorsInExpectClass.kt b/compiler/testData/diagnostics/tests/multiplatform/incDecOperatorsInExpectClass.kt new file mode 100644 index 00000000000..cce27b4ee51 --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/incDecOperatorsInExpectClass.kt @@ -0,0 +1,12 @@ +// FIR_IDENTICAL +// Issue: KT-49714 + +// MODULE: common +// TARGET_PLATFORM: Common +expect class Counter { + operator fun inc(): Counter + operator fun dec(): Counter +} + +// MODULE: main()()(common) +actual typealias Counter = Int diff --git a/compiler/testData/diagnostics/tests/multiplatform/incDecOperatorsInExpectClass.txt b/compiler/testData/diagnostics/tests/multiplatform/incDecOperatorsInExpectClass.txt new file mode 100644 index 00000000000..43f6f0dc15e --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/incDecOperatorsInExpectClass.txt @@ -0,0 +1,15 @@ +// -- Module: -- +package + +public final expect class Counter { + public final expect operator fun dec(): Counter + 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 final expect operator fun inc(): Counter + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +// -- Module:
-- +package + +public actual typealias Counter = kotlin.Int 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 7a535aa9bd5..a4ed83c7306 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 @@ -21362,6 +21362,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/multiplatform/implFakeOverride.kt"); } + @Test + @TestMetadata("incDecOperatorsInExpectClass.kt") + public void testIncDecOperatorsInExpectClass() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/incDecOperatorsInExpectClass.kt"); + } + @Test @TestMetadata("incompatibles.kt") public void testIncompatibles() throws Exception {