From 6982fa18d7a86fda3a2f218e808fcff34a62b132 Mon Sep 17 00:00:00 2001 From: Nikita Bobko Date: Fri, 20 Oct 2023 11:57:58 +0200 Subject: [PATCH] [FE 1.0] 2/2 Drop AllowDifferentMembersInActual from compiler and testData The annotation was dropped in the previous commit --- ...DiagnosticsWithLightTreeTestGenerated.java | 12 -------- ...endMPPDiagnosticsWithPsiTestGenerated.java | 12 -------- ...embersAsNonFinalExpectClassifierChecker.kt | 6 ---- .../bothInExpectAndActual2.kt | 2 -- .../codegen/box/multiplatform/hmpp/simple.kt | 2 -- .../k2/basic/expectInterfaceInSupertypes.kt | 4 --- .../k2/basic/expectInterfaceInSupertypes2.kt | 6 ---- .../allowDifferentMembersInActual_class.kt | 21 -------------- ...allowDifferentMembersInActual_typealias.kt | 23 --------------- ...ovariantOverrideOfInjectedFromSuper.fir.kt | 2 -- ...al_covariantOverrideOfInjectedFromSuper.kt | 6 ++-- ..._transitiveSubstitutionFakeOverride.fir.kt | 2 -- ...uper_transitiveSubstitutionFakeOverride.kt | 6 ++-- ...upertypeIsExpectActual_injectMethod.fir.kt | 25 ++++++++++++++++ .../supertypeIsExpectActual_injectMethod.kt | 7 ++--- ..._transitiveSubstitutionFakeOverride.fir.kt | 27 +++++++++++++++++ ...thod_transitiveSubstitutionFakeOverride.kt | 7 ++--- ...rtypeIsActualTypealias_injectMethod.fir.kt | 27 +++++++++++++++++ ...supertypeIsActualTypealias_injectMethod.kt | 5 +--- ..._transitiveSubstitutionFakeOverride.fir.kt | 29 +++++++++++++++++++ ...thod_transitiveSubstitutionFakeOverride.kt | 5 +--- ...licitActualFakeOverride_AbstractMap.fir.kt | 2 -- .../implicitActualFakeOverride_AbstractMap.kt | 4 +-- .../test/runners/DiagnosticTestGenerated.java | 12 -------- .../hilt/error/sampleapp/Annotations.kt | 1 - 25 files changed, 119 insertions(+), 136 deletions(-) delete mode 100644 compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/allowDifferentMembersInActual_class.kt delete mode 100644 compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/allowDifferentMembersInActual_typealias.kt create mode 100644 compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_injectMethod.fir.kt create mode 100644 compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_injectMethod_transitiveSubstitutionFakeOverride.fir.kt create mode 100644 compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_supertypeIsActualTypealias_injectMethod.fir.kt create mode 100644 compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_supertypeIsActualTypealias_injectMethod_transitiveSubstitutionFakeOverride.fir.kt 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 c1ea9995d6088..ff8d00beb1ede 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 @@ -364,18 +364,6 @@ public void testAllFilesPresentInActualClassifierMustHasTheSameMembersAsNonFinal KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), TargetBackend.JVM_IR, true); } - @Test - @TestMetadata("allowDifferentMembersInActual_class.kt") - public void testAllowDifferentMembersInActual_class() throws Exception { - runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/allowDifferentMembersInActual_class.kt"); - } - - @Test - @TestMetadata("allowDifferentMembersInActual_typealias.kt") - public void testAllowDifferentMembersInActual_typealias() throws Exception { - runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/allowDifferentMembersInActual_typealias.kt"); - } - @Test @TestMetadata("changeClassTypeParameterNames.kt") public void testChangeClassTypeParameterNames() throws Exception { 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 285a609567eca..49dd461005cff 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 @@ -364,18 +364,6 @@ public void testAllFilesPresentInActualClassifierMustHasTheSameMembersAsNonFinal KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), TargetBackend.JVM_IR, true); } - @Test - @TestMetadata("allowDifferentMembersInActual_class.kt") - public void testAllowDifferentMembersInActual_class() throws Exception { - runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/allowDifferentMembersInActual_class.kt"); - } - - @Test - @TestMetadata("allowDifferentMembersInActual_typealias.kt") - public void testAllowDifferentMembersInActual_typealias() throws Exception { - runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/allowDifferentMembersInActual_typealias.kt"); - } - @Test @TestMetadata("changeClassTypeParameterNames.kt") public void testChangeClassTypeParameterNames() throws Exception { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ActualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ActualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker.kt index 7de60cc7cb53e..20a48d8ac17eb 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ActualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ActualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker.kt @@ -86,8 +86,6 @@ private fun checkExpectActualScopeDiff( } } -private val allowDifferentMembersInActualFqn = FqName("kotlin.AllowDifferentMembersInActual") - @OptIn(ExperimentalContracts::class) internal fun matchActualWithNonFinalExpect( declaration: KtDeclaration, @@ -110,10 +108,6 @@ internal fun matchActualWithNonFinalExpect( if (!descriptor.isActual) return null - with(OptInUsageChecker) { - if (declaration.isDeclarationAnnotatedWith(allowDifferentMembersInActualFqn, context.trace.bindingContext)) return null - } - val actual = when (descriptor) { is ClassDescriptor -> descriptor is TypeAliasDescriptor -> descriptor.classDescriptor diff --git a/compiler/testData/codegen/box/multiplatform/defaultArguments/bothInExpectAndActual2.kt b/compiler/testData/codegen/box/multiplatform/defaultArguments/bothInExpectAndActual2.kt index a601dedb47a14..e5712ac064846 100644 --- a/compiler/testData/codegen/box/multiplatform/defaultArguments/bothInExpectAndActual2.kt +++ b/compiler/testData/codegen/box/multiplatform/defaultArguments/bothInExpectAndActual2.kt @@ -21,8 +21,6 @@ actual interface I { actual fun test(source: String = "actual") } -@OptIn(ExperimentalMultiplatform::class) -@AllowDifferentMembersInActual actual interface J : I { override fun test(source: String) { if (source != "actual") throw AssertionError(source) diff --git a/compiler/testData/codegen/box/multiplatform/hmpp/simple.kt b/compiler/testData/codegen/box/multiplatform/hmpp/simple.kt index b3b6678e19b76..5c1d3fbab592f 100644 --- a/compiler/testData/codegen/box/multiplatform/hmpp/simple.kt +++ b/compiler/testData/codegen/box/multiplatform/hmpp/simple.kt @@ -26,8 +26,6 @@ fun getB(): B = B() // MODULE: main()()(intermediate) // FILE: main.kt -@OptIn(ExperimentalMultiplatform::class) -@AllowDifferentMembersInActual actual open class A actual constructor() { fun bar(): String = "K" } diff --git a/compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes.kt b/compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes.kt index 0503b686df756..afb39619dc75a 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes.kt @@ -18,16 +18,12 @@ class B : A() // MODULE: platform()()(common) // FILE: platform.kt -@OptIn(ExperimentalMultiplatform::class) -@AllowDifferentMembersInActual actual interface S1 { fun o(): S = "O" val p: Boolean get() = true } -@OptIn(ExperimentalMultiplatform::class) -@AllowDifferentMembersInActual actual interface S2 { fun k() = "K" } diff --git a/compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes2.kt b/compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes2.kt index 073ce8718604e..c1ba297ecc78a 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes2.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/basic/expectInterfaceInSupertypes2.kt @@ -18,8 +18,6 @@ class B : A() // MODULE: platform()()(common) // FILE: platform.kt -@OptIn(ExperimentalMultiplatform::class) -@AllowDifferentMembersInActual actual interface S1 { fun s1() = "O" } @@ -28,13 +26,9 @@ interface S20 { fun s2() = "K" } -@OptIn(ExperimentalMultiplatform::class) -@AllowDifferentMembersInActual actual interface S2 : S20 { } -@OptIn(ExperimentalMultiplatform::class) -@AllowDifferentMembersInActual actual interface S : S1, S2 { fun s3() = s1() + s2() } diff --git a/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/allowDifferentMembersInActual_class.kt b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/allowDifferentMembersInActual_class.kt deleted file mode 100644 index 06d84f70a9f28..0000000000000 --- a/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/allowDifferentMembersInActual_class.kt +++ /dev/null @@ -1,21 +0,0 @@ -// FIR_IDENTICAL -// WITH_STDLIB -// MODULE: m1-common -// FILE: common.kt - -expect open class Foo { - fun existingMethod() - val existingParam: Int -} - -// MODULE: m2-jvm()()(m1-common) -// FILE: jvm.kt - -@OptIn(kotlin.ExperimentalMultiplatform::class) -@kotlin.AllowDifferentMembersInActual -actual open class Foo { - actual fun existingMethod() {} - actual val existingParam: Int = 904 - - fun injectedMethod() {} // accidential override can happen with this injected fun. That's why it's prohibited -} diff --git a/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/allowDifferentMembersInActual_typealias.kt b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/allowDifferentMembersInActual_typealias.kt deleted file mode 100644 index 18556e5b066bc..0000000000000 --- a/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/allowDifferentMembersInActual_typealias.kt +++ /dev/null @@ -1,23 +0,0 @@ -// FIR_IDENTICAL -// WITH_STDLIB -// MODULE: m1-common -// FILE: common.kt - -expect open class Foo { - fun existingMethod() - val existingParam: Int -} - -// MODULE: m2-jvm()()(m1-common) -// FILE: jvm.kt - -@OptIn(kotlin.ExperimentalMultiplatform::class) -@kotlin.AllowDifferentMembersInActual -actual typealias Foo = FooImpl - -open class FooImpl { - fun existingMethod() {} - val existingParam: Int = 904 - - fun injectedMethod() {} // accidential override can happen with this injected fun. That's why it's prohibited -} diff --git a/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper.fir.kt index 45e50c148cadc..c58e10bdb389c 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper.fir.kt @@ -14,8 +14,6 @@ expect open class Foo : Base { // MODULE: m2-jvm()()(m1-common) // FILE: jvm.kt -@OptIn(ExperimentalMultiplatform::class) -@AllowDifferentMembersInActual actual open class Base { actual fun existingMethodInBase() {} open fun injected(): Any = "" diff --git a/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper.kt b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper.kt index 8fda9d42ccc77..c7df534494d0c 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper.kt @@ -14,11 +14,9 @@ expect open class Foo : Base { // MODULE: m2-jvm()()(m1-common) // FILE: jvm.kt -@OptIn(ExperimentalMultiplatform::class) -@AllowDifferentMembersInActual -actual open class Base { +actual open class Base { actual fun existingMethodInBase() {} - open fun injected(): Any = "" + open fun injected(): Any = "" } actual open class Foo : Base() { diff --git a/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper_transitiveSubstitutionFakeOverride.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper_transitiveSubstitutionFakeOverride.fir.kt index 4b78f6756d3e0..447dc735a1371 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper_transitiveSubstitutionFakeOverride.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper_transitiveSubstitutionFakeOverride.fir.kt @@ -16,8 +16,6 @@ expect open class Foo : Transitive { // MODULE: m2-jvm()()(m1-common) // FILE: jvm.kt -@OptIn(ExperimentalMultiplatform::class) -@AllowDifferentMembersInActual actual open class Base { actual fun existingMethodInBase(param: T) {} open fun injected(param: T): Any = "" diff --git a/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper_transitiveSubstitutionFakeOverride.kt b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper_transitiveSubstitutionFakeOverride.kt index 99a3ad807a72e..304e9825bc58b 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper_transitiveSubstitutionFakeOverride.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper_transitiveSubstitutionFakeOverride.kt @@ -16,11 +16,9 @@ expect open class Foo : Transitive { // MODULE: m2-jvm()()(m1-common) // FILE: jvm.kt -@OptIn(ExperimentalMultiplatform::class) -@AllowDifferentMembersInActual -actual open class Base { +actual open class Base { actual fun existingMethodInBase(param: T) {} - open fun injected(param: T): Any = "" + open fun injected(param: T): Any = "" } actual open class Foo : Transitive() { diff --git a/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_injectMethod.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_injectMethod.fir.kt new file mode 100644 index 0000000000000..7b466913082d5 --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_injectMethod.fir.kt @@ -0,0 +1,25 @@ +// WITH_STDLIB +// MODULE: m1-common +// FILE: common.kt + +expect open class Base { + fun existingMethodInBase() +} + +expect open class Foo : Base { + fun existingMethod() + val existingParam: Int +} + +// MODULE: m2-jvm()()(m1-common) +// FILE: jvm.kt + +actual open class Base { + actual fun existingMethodInBase() {} + fun injected() {} +} + +actual open class Foo : Base() { + actual fun existingMethod() {} + actual val existingParam: Int = 904 +} diff --git a/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_injectMethod.kt b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_injectMethod.kt index dae360bfcf62d..730fc8998699e 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_injectMethod.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_injectMethod.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL // WITH_STDLIB // MODULE: m1-common // FILE: common.kt @@ -15,11 +14,9 @@ expect open class Foo : Base { // MODULE: m2-jvm()()(m1-common) // FILE: jvm.kt -@OptIn(ExperimentalMultiplatform::class) -@AllowDifferentMembersInActual -actual open class Base { +actual open class Base { actual fun existingMethodInBase() {} - fun injected() {} + fun injected() {} } actual open class Foo : Base() { diff --git a/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_injectMethod_transitiveSubstitutionFakeOverride.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_injectMethod_transitiveSubstitutionFakeOverride.fir.kt new file mode 100644 index 0000000000000..701343403caab --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_injectMethod_transitiveSubstitutionFakeOverride.fir.kt @@ -0,0 +1,27 @@ +// WITH_STDLIB +// MODULE: m1-common +// FILE: common.kt + +expect open class Base() { + fun existingMethodInBase(param: T) +} + +open class Transitive : Base() + +expect open class Foo : Transitive { + fun existingMethod() + val existingParam: Int +} + +// MODULE: m2-jvm()()(m1-common) +// FILE: jvm.kt + +actual open class Base { + actual fun existingMethodInBase(param: T) {} + fun injected() {} +} + +actual open class Foo : Transitive() { + actual fun existingMethod() {} + actual val existingParam: Int = 904 +} diff --git a/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_injectMethod_transitiveSubstitutionFakeOverride.kt b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_injectMethod_transitiveSubstitutionFakeOverride.kt index f390b842e1042..635f3a13d5b61 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_injectMethod_transitiveSubstitutionFakeOverride.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_injectMethod_transitiveSubstitutionFakeOverride.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL // WITH_STDLIB // MODULE: m1-common // FILE: common.kt @@ -17,11 +16,9 @@ expect open class Foo : Transitive { // MODULE: m2-jvm()()(m1-common) // FILE: jvm.kt -@OptIn(ExperimentalMultiplatform::class) -@AllowDifferentMembersInActual -actual open class Base { +actual open class Base { actual fun existingMethodInBase(param: T) {} - fun injected() {} + fun injected() {} } actual open class Foo : Transitive() { diff --git a/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_supertypeIsActualTypealias_injectMethod.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_supertypeIsActualTypealias_injectMethod.fir.kt new file mode 100644 index 0000000000000..ff70207f546aa --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_supertypeIsActualTypealias_injectMethod.fir.kt @@ -0,0 +1,27 @@ +// WITH_STDLIB +// MODULE: m1-common +// FILE: common.kt + +expect open class Base() { + fun existingMethodInBase() +} + +expect open class Foo : Base { + fun existingMethod() + val existingParam: Int +} + +// MODULE: m2-jvm()()(m1-common) +// FILE: jvm.kt + +actual typealias Base = BaseImpl + +open class BaseImpl { + fun existingMethodInBase() {} + fun injected() {} +} + +actual open class Foo : Base() { + actual fun existingMethod() {} + actual val existingParam: Int = 904 +} diff --git a/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_supertypeIsActualTypealias_injectMethod.kt b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_supertypeIsActualTypealias_injectMethod.kt index 8115a7a88143a..dbcbdf43bed87 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_supertypeIsActualTypealias_injectMethod.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_supertypeIsActualTypealias_injectMethod.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL // WITH_STDLIB // MODULE: m1-common // FILE: common.kt @@ -15,9 +14,7 @@ expect open class Foo : Base { // MODULE: m2-jvm()()(m1-common) // FILE: jvm.kt -@OptIn(ExperimentalMultiplatform::class) -@AllowDifferentMembersInActual -actual typealias Base = BaseImpl +actual typealias Base = BaseImpl open class BaseImpl { fun existingMethodInBase() {} diff --git a/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_supertypeIsActualTypealias_injectMethod_transitiveSubstitutionFakeOverride.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_supertypeIsActualTypealias_injectMethod_transitiveSubstitutionFakeOverride.fir.kt new file mode 100644 index 0000000000000..c11b3f25caa75 --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_supertypeIsActualTypealias_injectMethod_transitiveSubstitutionFakeOverride.fir.kt @@ -0,0 +1,29 @@ +// WITH_STDLIB +// MODULE: m1-common +// FILE: common.kt + +expect open class Base() { + fun existingMethodInBase(param: T) +} + +open class Transitive : Base() + +expect open class Foo : Transitive { + fun existingMethod() + val existingParam: Int +} + +// MODULE: m2-jvm()()(m1-common) +// FILE: jvm.kt + +actual typealias Base = BaseImpl + +open class BaseImpl { + fun existingMethodInBase(param: T) {} + fun injected() {} +} + +actual open class Foo : Transitive() { + actual fun existingMethod() {} + actual val existingParam: Int = 904 +} diff --git a/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_supertypeIsActualTypealias_injectMethod_transitiveSubstitutionFakeOverride.kt b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_supertypeIsActualTypealias_injectMethod_transitiveSubstitutionFakeOverride.kt index 31cc41e9bc8fd..ca4db3ac761ff 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_supertypeIsActualTypealias_injectMethod_transitiveSubstitutionFakeOverride.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_supertypeIsActualTypealias_injectMethod_transitiveSubstitutionFakeOverride.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL // WITH_STDLIB // MODULE: m1-common // FILE: common.kt @@ -17,9 +16,7 @@ expect open class Foo : Transitive { // MODULE: m2-jvm()()(m1-common) // FILE: jvm.kt -@OptIn(ExperimentalMultiplatform::class) -@AllowDifferentMembersInActual -actual typealias Base = BaseImpl +actual typealias Base = BaseImpl open class BaseImpl { fun existingMethodInBase(param: T) {} diff --git a/compiler/testData/diagnostics/tests/multiplatform/implicitActualFakeOverride_AbstractMap.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/implicitActualFakeOverride_AbstractMap.fir.kt index f36558acf076e..f977beda2ff03 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/implicitActualFakeOverride_AbstractMap.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/implicitActualFakeOverride_AbstractMap.fir.kt @@ -12,6 +12,4 @@ import java.util.AbstractMap -@OptIn(kotlin.ExperimentalMultiplatform::class) -@kotlin.AllowDifferentMembersInActual public actual abstract class AbstractMutableMap() : MutableMap, AbstractMap() diff --git a/compiler/testData/diagnostics/tests/multiplatform/implicitActualFakeOverride_AbstractMap.kt b/compiler/testData/diagnostics/tests/multiplatform/implicitActualFakeOverride_AbstractMap.kt index 860c3d790264e..472ae1e4cb70b 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/implicitActualFakeOverride_AbstractMap.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/implicitActualFakeOverride_AbstractMap.kt @@ -12,6 +12,4 @@ public expect abstract class AbstractMutableMap : MutableMap { import java.util.AbstractMap -@OptIn(kotlin.ExperimentalMultiplatform::class) -@kotlin.AllowDifferentMembersInActual -public actual abstract class AbstractMutableMap() : MutableMap, AbstractMap() +public actual abstract class AbstractMutableMap() : MutableMap, AbstractMap() 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 22c0f41e0c7aa..c0eb1941b7c48 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 @@ -23097,18 +23097,6 @@ public void testAllFilesPresentInActualClassifierMustHasTheSameMembersAsNonFinal KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true); } - @Test - @TestMetadata("allowDifferentMembersInActual_class.kt") - public void testAllowDifferentMembersInActual_class() throws Exception { - runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/allowDifferentMembersInActual_class.kt"); - } - - @Test - @TestMetadata("allowDifferentMembersInActual_typealias.kt") - public void testAllowDifferentMembersInActual_typealias() throws Exception { - runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/allowDifferentMembersInActual_typealias.kt"); - } - @Test @TestMetadata("changeClassTypeParameterNames.kt") public void testChangeClassTypeParameterNames() throws Exception { diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kapt2/mpp-android-kapt/shared/src/androidMain/kotlin/hilt/error/sampleapp/Annotations.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kapt2/mpp-android-kapt/shared/src/androidMain/kotlin/hilt/error/sampleapp/Annotations.kt index 30d191598b6d0..278615867f737 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kapt2/mpp-android-kapt/shared/src/androidMain/kotlin/hilt/error/sampleapp/Annotations.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kapt2/mpp-android-kapt/shared/src/androidMain/kotlin/hilt/error/sampleapp/Annotations.kt @@ -7,7 +7,6 @@ package hilt.error.sampleapp */ actual typealias HiltViewModel = dagger.hilt.android.lifecycle.HiltViewModel -@AllowDifferentMembersInActual actual typealias ViewModel = androidx.lifecycle.ViewModel actual typealias Inject = javax.inject.Inject