[STDLIB] 1/2 Drop AllowDifferentMembersInActual from stdlib

^KT-62656 Fixed

I blindly converted all `@AllowDifferentMembersInActual` to suppresses.
But some suppresses in stdlib are redundant. I'm too lazy properly
annotate only the necessary places. All these suppresses will go away
after the bootstrap update anyway

I drop allowDifferentMembersInActual_class and
allowDifferentMembersInActual_typealias tests because their only purpose
was to check that `@AllowDifferentMembersInActual` works as expected

Note: some tests are failing in the compiler because of that. I will fix
them in the next commit
This commit is contained in:
Nikita Bobko
2023-10-18 10:56:37 +02:00
committed by Space Team
parent 8b03636b3b
commit 14029b0ebc
24 changed files with 91 additions and 77 deletions
@@ -10,7 +10,7 @@ package kotlin.collections
*
* @param E the type of elements contained in the collection. The collection is invariant in its element type.
*/
@AllowDifferentMembersInActual // New 'AbstractCollection` supertype is added compared to the expect declaration
@Suppress("ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER_WARNING", "ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_SUPERTYPES_AS_NON_FINAL_EXPECT_CLASSIFIER_WARNING") // Can be dropped after bootstrap update
public actual abstract class AbstractMutableCollection<E> protected actual constructor(): MutableCollection<E>, AbstractCollection<E>() {
// Bulk Modification Operations
@@ -17,7 +17,10 @@ package kotlin.collections
*
* @param E the type of elements contained in the list. The list is invariant in its element type.
*/
@AllowDifferentMembersInActual // New 'removeRange', 'modCount' members are added compared to the expect declaration
@Suppress(
"ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER_WARNING",
"ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_SUPERTYPES_AS_NON_FINAL_EXPECT_CLASSIFIER_WARNING"
) // Can be dropped after bootstrap update
public actual abstract class AbstractMutableList<E> protected actual constructor() : AbstractMutableCollection<E>(), MutableList<E> {
/**
* The number of times this list is structurally modified.
@@ -29,6 +32,7 @@ public actual abstract class AbstractMutableList<E> protected actual constructor
* to provide fail-fast behavoir when a concurrent modification is detected during iteration.
* [ConcurrentModificationException] will be thrown in this case.
*/
@Suppress("NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION_WARNING") // Can be dropped after bootstrap update
protected var modCount: Int = 0
abstract override fun add(index: Int, element: E): Unit
@@ -82,6 +86,7 @@ public actual abstract class AbstractMutableList<E> protected actual constructor
/**
* Removes the range of elements from this list starting from [fromIndex] and ending with but not including [toIndex].
*/
@Suppress("NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION_WARNING") // Can be dropped after bootstrap update
protected open fun removeRange(fromIndex: Int, toIndex: Int) {
val iterator = listIterator(fromIndex)
repeat(toIndex - fromIndex) {
@@ -8,7 +8,7 @@ package kotlin.collections
* @param K the type of map keys. The map is invariant in its key type.
* @param V the type of map values. The map is invariant in its value type.
*/
@AllowDifferentMembersInActual // New 'AbstractMap` supertype is added compared to the expect declaration
@Suppress("ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER_WARNING", "ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_SUPERTYPES_AS_NON_FINAL_EXPECT_CLASSIFIER_WARNING") // Can be dropped after bootstrap update
@SinceKotlin("1.1")
public actual abstract class AbstractMutableMap<K, V> protected actual constructor() : AbstractMap<K, V>(), MutableMap<K, V> {
/**
@@ -5,7 +5,7 @@ package kotlin.collections
*
* @param E the type of elements contained in the set. The set is invariant in its element type.
*/
@AllowDifferentMembersInActual // New 'AbstractMutableCollection` supertype is added compared to the expect declaration
@Suppress("ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER_WARNING", "ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_SUPERTYPES_AS_NON_FINAL_EXPECT_CLASSIFIER_WARNING") // Can be dropped after bootstrap update
@SinceKotlin("1.1")
public actual abstract class AbstractMutableSet<E> protected actual constructor() : AbstractMutableCollection<E>(), MutableSet<E> {
/**