[FE] Check visibilities of expected and actual property setters are compatible
^KT-30905 Fixed
This commit is contained in:
committed by
Space Team
parent
9044dfe394
commit
c718c77c43
+10
@@ -370,10 +370,20 @@ object ExpectedActualResolver {
|
||||
!equalBy(expected, actual) { p -> p.isVar } -> Incompatible.PropertyKind
|
||||
!equalBy(expected, actual) { p -> p.isLateInit } -> Incompatible.PropertyLateinitModifier
|
||||
expected.isConst && !actual.isConst -> Incompatible.PropertyConstModifier
|
||||
!arePropertySettersWithCompatibleVisibilities(expected, actual) -> Incompatible.PropertySetterVisibility
|
||||
else -> Compatible
|
||||
}
|
||||
}
|
||||
|
||||
private fun arePropertySettersWithCompatibleVisibilities(expected: PropertyDescriptor, actual: PropertyDescriptor): Boolean {
|
||||
val expectedSetter = expected.setter
|
||||
val actualSetter = actual.setter
|
||||
if (expectedSetter == null || actualSetter == null) {
|
||||
return true
|
||||
}
|
||||
return areDeclarationsWithCompatibleVisibilities(expectedSetter, actualSetter)
|
||||
}
|
||||
|
||||
private fun areCompatibleClassifiers(a: ClassDescriptor, other: ClassifierDescriptor): ExpectActualCompatibility<MemberDescriptor> {
|
||||
// Can't check FQ names here because nested expected class may be implemented via actual typealias's expansion with the other FQ name
|
||||
assert(a.name == other.name) { "This function should be invoked only for declarations with the same name: $a, $other" }
|
||||
|
||||
Reference in New Issue
Block a user