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.reflect
*
* @param R return type of the callable.
*/
@AllowDifferentMembersInActual // New 'KAnnotatedElement` supertype is added compared to the expect declaration
public actual interface KCallable<out R> : KAnnotatedElement {
/**
* The name of this callable as it was declared in the source code.
@@ -13,6 +13,7 @@ package kotlin.reflect
*
* @param T the type of the class.
*/
@AllowDifferentMembersInActual // New 'KDeclarationContainer', 'KAnnotatedElement` supertypes are added compared to the expect declaration
public actual interface KClass<T : Any> : KDeclarationContainer, KAnnotatedElement, KClassifier {
/**
* The simple name of the class as it was declared in the source code,
@@ -43,7 +44,7 @@ public actual interface KClass<T : Any> : KDeclarationContainer, KAnnotatedEleme
* For example, on JVM, [KClass] instances for a primitive type (`int`) and the corresponding wrapper type (`java.lang.Integer`)
* are considered equal, because they have the same fully qualified name "kotlin.Int".
*/
override fun equals(other: Any?): Boolean
actual override fun equals(other: Any?): Boolean // KT-24971
override fun hashCode(): Int
actual override fun hashCode(): Int // KT-24971
}