Skip to content

Commit

Permalink
[FE 1.0] 2/2 Drop AllowDifferentMembersInActual from compiler and tes…
Browse files Browse the repository at this point in the history
…tData

The annotation was dropped in the previous commit
  • Loading branch information
nikitabobko authored and qodana-bot committed Oct 20, 2023
1 parent 882f468 commit 6982fa1
Show file tree
Hide file tree
Showing 25 changed files with 119 additions and 136 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ private fun checkExpectActualScopeDiff(
}
}

private val allowDifferentMembersInActualFqn = FqName("kotlin.AllowDifferentMembersInActual")

@OptIn(ExperimentalContracts::class)
internal fun matchActualWithNonFinalExpect(
declaration: KtDeclaration,
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions compiler/testData/codegen/box/multiplatform/hmpp/simple.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ class B : A()
// MODULE: platform()()(common)
// FILE: platform.kt

@OptIn(ExperimentalMultiplatform::class)
@AllowDifferentMembersInActual
actual interface S1 {
fun s1() = "O"
}
Expand All @@ -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()
}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// FIR_IDENTICAL
// WITH_STDLIB
// MODULE: m1-common
// FILE: common.kt
Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// FIR_IDENTICAL
// WITH_STDLIB
// MODULE: m1-common
// FILE: common.kt
Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// FIR_IDENTICAL
// WITH_STDLIB
// MODULE: m1-common
// FILE: common.kt
Expand All @@ -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() {}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// FIR_IDENTICAL
// WITH_STDLIB
// MODULE: m1-common
// FILE: common.kt
Expand All @@ -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) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>()
Loading

0 comments on commit 6982fa1

Please sign in to comment.