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 8b4690b87e1..369d5f7d020 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 @@ -20830,6 +20830,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } + @Test + @TestMetadata("expectDataObject.kt") + public void testExpectDataObject() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/expectDataObject.kt"); + } + @Test @TestMetadata("expectInterfaceApplicability.kt") public void testExpectInterfaceApplicability() 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 87972d881e6..de2906dd9f3 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 @@ -20830,6 +20830,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } + @Test + @TestMetadata("expectDataObject.kt") + public void testExpectDataObject() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/expectDataObject.kt"); + } + @Test @TestMetadata("expectInterfaceApplicability.kt") public void testExpectInterfaceApplicability() 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 499d38de77c..f9b8ae5237c 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 @@ -20830,6 +20830,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } + @Test + @TestMetadata("expectDataObject.kt") + public void testExpectDataObject() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/expectDataObject.kt"); + } + @Test @TestMetadata("expectInterfaceApplicability.kt") public void testExpectInterfaceApplicability() throws Exception { diff --git a/compiler/psi/src/org/jetbrains/kotlin/resolve/ModifierCheckerHelpers.kt b/compiler/psi/src/org/jetbrains/kotlin/resolve/ModifierCheckerHelpers.kt index 13ef31f428c..449db5e1286 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/resolve/ModifierCheckerHelpers.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/resolve/ModifierCheckerHelpers.kt @@ -63,6 +63,7 @@ private fun buildCompatibilityMap(): Map, C result += incompatibilityRegister(DATA_KEYWORD, SEALED_KEYWORD) result += incompatibilityRegister(DATA_KEYWORD, INLINE_KEYWORD) result += incompatibilityRegister(DATA_KEYWORD, VALUE_KEYWORD) + result += incompatibilityRegister(DATA_KEYWORD, OBJECT_KEYWORD, EXPECT_KEYWORD) // open is redundant to abstract & override result += redundantRegister(ABSTRACT_KEYWORD, OPEN_KEYWORD) // abstract is redundant to sealed diff --git a/compiler/testData/diagnostics/tests/multiplatform/expectDataObject.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/expectDataObject.fir.kt new file mode 100644 index 00000000000..9a4dea1fa84 --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/expectDataObject.fir.kt @@ -0,0 +1,8 @@ +// LANGUAGE: +DataObjects +// MODULE: m1-common +// FILE: common.kt +expect data object DataObject + +// MODULE: m1-jvm()()(m1-common) +// FILE: jvm.kt +actual data object DataObject diff --git a/compiler/testData/diagnostics/tests/multiplatform/expectDataObject.kt b/compiler/testData/diagnostics/tests/multiplatform/expectDataObject.kt new file mode 100644 index 00000000000..34148d7c843 --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/expectDataObject.kt @@ -0,0 +1,8 @@ +// LANGUAGE: +DataObjects +// MODULE: m1-common +// FILE: common.kt +expect data object DataObject + +// MODULE: m1-jvm()()(m1-common) +// FILE: jvm.kt +actual data object DataObject diff --git a/compiler/testData/diagnostics/tests/multiplatform/expectDataObject.txt b/compiler/testData/diagnostics/tests/multiplatform/expectDataObject.txt new file mode 100644 index 00000000000..487c56c70bd --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/expectDataObject.txt @@ -0,0 +1,18 @@ +// -- Module: -- +package + +public expect data object DataObject { + 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 +} + +// -- Module: -- +package + +public actual data object DataObject { + private constructor DataObject() + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String +} 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 9a68f88f3a5..0c4c47902c1 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 @@ -20836,6 +20836,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } + @Test + @TestMetadata("expectDataObject.kt") + public void testExpectDataObject() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/expectDataObject.kt"); + } + @Test @TestMetadata("expectInterfaceApplicability.kt") public void testExpectInterfaceApplicability() throws Exception {