[FE 1.0] 2/2 Drop AllowDifferentMembersInActual from compiler and testData

The annotation was dropped in the previous commit
This commit is contained in:
Nikita Bobko
2023-10-20 11:57:58 +02:00
committed by Space Team
parent 14029b0ebc
commit 0f82baf841
25 changed files with 119 additions and 136 deletions
@@ -382,18 +382,6 @@ public class FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated extends Abst
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 {
@@ -382,18 +382,6 @@ public class FirOldFrontendMPPDiagnosticsWithPsiTestGenerated extends AbstractFi
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 {
@@ -88,8 +88,6 @@ private fun checkExpectActualScopeDiff(
}
}
private val allowDifferentMembersInActualFqn = FqName("kotlin.AllowDifferentMembersInActual")
@OptIn(ExperimentalContracts::class)
internal fun matchActualWithNonFinalExpect(
declaration: KtDeclaration,
@@ -114,10 +112,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
@@ -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)
@@ -25,8 +25,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"
}
@@ -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"
}
@@ -19,8 +19,6 @@ class B : A()
// MODULE: platform()()(common)
// FILE: platform.kt
@OptIn(ExperimentalMultiplatform::class)
@AllowDifferentMembersInActual
actual interface S1 {
fun s1() = "O"
}
@@ -29,13 +27,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()
}
@@ -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
}
@@ -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
}
@@ -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 = ""
@@ -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 <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER_WARNING!>class Base<!> {
actual fun existingMethodInBase() {}
open fun injected(): Any = ""
open fun <!NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION_WARNING!>injected<!>(): Any = ""
}
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER_WARNING!>class Foo<!> : Base() {
@@ -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<T> {
actual fun existingMethodInBase(param: T) {}
open fun injected(param: T): Any = ""
@@ -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<T> {
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER_WARNING!>class Base<!><T> {
actual fun existingMethodInBase(param: T) {}
open fun injected(param: T): Any = ""
open fun <!NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION_WARNING!>injected<!>(param: T): Any = ""
}
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER_WARNING!>class Foo<!> : Transitive() {
@@ -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
}
@@ -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 <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER_WARNING!>class Base<!> {
actual fun existingMethodInBase() {}
fun injected() {}
fun <!NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION_WARNING!>injected<!>() {}
}
actual open class Foo : Base() {
@@ -0,0 +1,27 @@
// WITH_STDLIB
// MODULE: m1-common
// FILE: common.kt
expect open class Base<T>() {
fun existingMethodInBase(param: T)
}
open class Transitive : Base<String>()
expect open class Foo : Transitive {
fun existingMethod()
val existingParam: Int
}
// MODULE: m2-jvm()()(m1-common)
// FILE: jvm.kt
actual open class Base<T> {
actual fun existingMethodInBase(param: T) {}
fun injected() {}
}
actual open class Foo : Transitive() {
actual fun existingMethod() {}
actual val existingParam: Int = 904
}
@@ -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<T> {
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER_WARNING!>class Base<!><T> {
actual fun existingMethodInBase(param: T) {}
fun injected() {}
fun <!NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION_WARNING!>injected<!>() {}
}
actual open class Foo : Transitive() {
@@ -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
}
@@ -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 <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER_WARNING!>Base<!> = BaseImpl
open class BaseImpl {
fun existingMethodInBase() {}
@@ -0,0 +1,29 @@
// WITH_STDLIB
// MODULE: m1-common
// FILE: common.kt
expect open class Base<T>() {
fun existingMethodInBase(param: T)
}
open class Transitive : Base<String>()
expect open class Foo : Transitive {
fun existingMethod()
val existingParam: Int
}
// MODULE: m2-jvm()()(m1-common)
// FILE: jvm.kt
actual typealias Base<T> = BaseImpl<T>
open class BaseImpl<T> {
fun existingMethodInBase(param: T) {}
fun injected() {}
}
actual open class Foo : Transitive() {
actual fun existingMethod() {}
actual val existingParam: Int = 904
}
@@ -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<T> = BaseImpl<T>
actual typealias <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER_WARNING!>Base<!><T> = BaseImpl<T>
open class BaseImpl<T> {
fun existingMethodInBase(param: T) {}
@@ -12,6 +12,4 @@
import java.util.AbstractMap
@OptIn(kotlin.ExperimentalMultiplatform::class)
@kotlin.AllowDifferentMembersInActual
public actual abstract class AbstractMutableMap<K, V>() : MutableMap<K, V>, AbstractMap<K, V>()
@@ -12,6 +12,4 @@ public expect abstract class AbstractMutableMap<K, V> : MutableMap<K, V> {
import java.util.AbstractMap
@OptIn(kotlin.ExperimentalMultiplatform::class)
@kotlin.AllowDifferentMembersInActual
public actual abstract class AbstractMutableMap<K, V>() : MutableMap<K, V>, AbstractMap<K, V>()
public actual abstract <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_SUPERTYPES_AS_NON_FINAL_EXPECT_CLASSIFIER_WARNING!>class AbstractMutableMap<!><K, V>() : MutableMap<K, V>, AbstractMap<K, V>()
@@ -23629,18 +23629,6 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
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 {
@@ -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