K1: Implement a checker that disallows to have different member scopes for expect open and its actual

^KT-22841 Fixed
Review: https://jetbrains.team/p/kt/reviews/11603/timeline

The commit also introduces `@AllowDifferentMembersInActual` annotation in
stdlib which allows to suppress the diagnostic
This commit is contained in:
Nikita Bobko
2023-07-11 18:00:53 +02:00
committed by Space Team
parent 797ca34a34
commit 25c082f02b
155 changed files with 3875 additions and 40 deletions
@@ -10,6 +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
public actual abstract class AbstractMutableCollection<E> protected actual constructor(): MutableCollection<E>, AbstractCollection<E>() {
// Bulk Modification Operations
@@ -17,6 +17,7 @@ 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
public actual abstract class AbstractMutableList<E> protected actual constructor() : AbstractMutableCollection<E>(), MutableList<E> {
/**
* The number of times this list is structurally modified.
@@ -8,6 +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
@SinceKotlin("1.1")
public actual abstract class AbstractMutableMap<K, V> protected actual constructor() : AbstractMap<K, V>(), MutableMap<K, V> {
/**
@@ -5,6 +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
@SinceKotlin("1.1")
public actual abstract class AbstractMutableSet<E> protected actual constructor() : AbstractMutableCollection<E>(), MutableSet<E> {
/**