KT-53783 Prohibit "expect data object" syntax

This commit is contained in:
Pavel Mikhailovskii
2022-09-07 12:13:53 +02:00
committed by teamcity
parent a6d1f30e89
commit 85ab8b4ce1
8 changed files with 59 additions and 0 deletions
@@ -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 {
@@ -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 {
@@ -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 {
@@ -63,6 +63,7 @@ private fun buildCompatibilityMap(): Map<Pair<KtKeywordToken, KtKeywordToken>, 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
@@ -0,0 +1,8 @@
// LANGUAGE: +DataObjects
// MODULE: m1-common
// FILE: common.kt
<!INCOMPATIBLE_MODIFIERS!>expect<!> <!INCOMPATIBLE_MODIFIERS!>data<!> object DataObject
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
actual data object DataObject
@@ -0,0 +1,8 @@
// LANGUAGE: +DataObjects
// MODULE: m1-common
// FILE: common.kt
<!INCOMPATIBLE_MODIFIERS, INCOMPATIBLE_MODIFIERS{JVM}!>expect<!> <!INCOMPATIBLE_MODIFIERS, INCOMPATIBLE_MODIFIERS{JVM}!>data<!> object DataObject
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
actual data object DataObject
@@ -0,0 +1,18 @@
// -- Module: <m1-common> --
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: <m1-jvm> --
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
}
@@ -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 {