Allow open callable members in expect interfaces
#KT-42094 fixed
This commit is contained in:
committed by
Sebastian Sellmair
parent
bf0156f7c6
commit
06cb64bb51
-3
@@ -23,9 +23,6 @@ interface CirFunctionOrProperty :
|
||||
val returnType: CirType
|
||||
val kind: CallableMemberDescriptor.Kind
|
||||
|
||||
fun isNonAbstractMemberInInterface(): Boolean =
|
||||
modality != Modality.ABSTRACT && containingClassDetails?.kind == ClassKind.INTERFACE
|
||||
|
||||
fun isVirtual(): Boolean =
|
||||
visibility != DescriptorVisibilities.PRIVATE
|
||||
&& modality != Modality.FINAL
|
||||
|
||||
+1
-2
@@ -29,8 +29,7 @@ abstract class AbstractFunctionOrPropertyCommonizer<T : CirFunctionOrProperty>(
|
||||
}
|
||||
|
||||
override fun doCommonizeWith(next: T): Boolean =
|
||||
!next.isNonAbstractMemberInInterface() // non-abstract callable members declared in interface can't be commonized
|
||||
&& next.kind != DELEGATION // delegated members should not be commonized
|
||||
next.kind != DELEGATION // delegated members should not be commonized
|
||||
&& (next.kind != SYNTHESIZED || next.containingClassDetails?.isData != true) // synthesized members of data classes should not be commonized
|
||||
&& kind == next.kind
|
||||
&& modality.commonizeWith(next.modality)
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
expect interface Interface {
|
||||
open fun openFun()
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
actual interface Interface {
|
||||
actual fun openFun() = Unit
|
||||
fun openFunWithOtherParams(param: Int) = Unit
|
||||
fun openInJs_abstractInJvm() = Unit
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
actual interface Interface {
|
||||
actual fun openFun() = Unit
|
||||
fun openFunWithOtherParams(param: Double) = Unit
|
||||
fun openInJs_abstractInJvm()
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
interface Interface {
|
||||
fun openFun() = Unit
|
||||
fun openFunWithOtherParams(param: Int) = Unit
|
||||
fun openInJs_abstractInJvm() = Unit
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
interface Interface {
|
||||
fun openFun() = Unit
|
||||
fun openFunWithOtherParams(param: Double) = Unit
|
||||
fun openInJs_abstractInJvm()
|
||||
}
|
||||
+2
@@ -15,4 +15,6 @@ class CallableMemberCommonizationFromSourcesTest : AbstractCommonizationFromSour
|
||||
fun testReturnTypes() = doTestSuccessfulCommonization()
|
||||
|
||||
fun testExtensionReceivers() = doTestSuccessfulCommonization()
|
||||
|
||||
fun testOpenCallableMemberInInterface() = doTestSuccessfulCommonization()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user