[MPP] Permit const actual properties for non-const expects
It's safe as not having const is more restrictive, therefore can be allowed in common. Otherwise, it's not possible to declare an expect declaration for a platform property with `const` modifier in common KT-18856
This commit is contained in:
committed by
TeamCityServer
parent
8ad06ef725
commit
b4c854429f
+10
-5
@@ -360,11 +360,16 @@ object ExpectedActualResolver {
|
||||
return Compatible
|
||||
}
|
||||
|
||||
private fun areCompatibleProperties(a: PropertyDescriptor, b: PropertyDescriptor): ExpectActualCompatibility<MemberDescriptor> {
|
||||
if (!equalBy(a, b) { p -> p.isVar }) return Incompatible.PropertyKind
|
||||
if (!equalBy(a, b) { p -> listOf(p.isConst, p.isLateInit) }) return Incompatible.PropertyModifiers
|
||||
|
||||
return Compatible
|
||||
private fun areCompatibleProperties(
|
||||
expected: PropertyDescriptor,
|
||||
actual: PropertyDescriptor,
|
||||
): ExpectActualCompatibility<MemberDescriptor> {
|
||||
return when {
|
||||
!equalBy(expected, actual) { p -> p.isVar } -> Incompatible.PropertyKind
|
||||
!equalBy(expected, actual) { p -> p.isLateInit } -> Incompatible.PropertyLateinitModifier
|
||||
expected.isConst && !actual.isConst -> Incompatible.PropertyConstModifier
|
||||
else -> Compatible
|
||||
}
|
||||
}
|
||||
|
||||
private fun areCompatibleClassifiers(a: ClassDescriptor, other: ClassifierDescriptor): ExpectActualCompatibility<MemberDescriptor> {
|
||||
|
||||
Reference in New Issue
Block a user