[Misc] Reformat DescriptorEquivalenceForOverrides.kt

This commit is contained in:
Denis Zharkov
2019-03-29 14:54:15 +03:00
committed by Dmitry Savvinov
parent 4e486e7738
commit edb9623556
@@ -47,7 +47,7 @@ object DescriptorEquivalenceForOverrides {
private fun areTypeParametersEquivalent( private fun areTypeParametersEquivalent(
a: TypeParameterDescriptor, a: TypeParameterDescriptor,
b: TypeParameterDescriptor, b: TypeParameterDescriptor,
equivalentCallables: (DeclarationDescriptor?, DeclarationDescriptor?) -> Boolean = { _, _ -> false} equivalentCallables: (DeclarationDescriptor?, DeclarationDescriptor?) -> Boolean = { _, _ -> false }
): Boolean { ): Boolean {
if (a == b) return true if (a == b) return true
if (a.containingDeclaration == b.containingDeclaration) return false if (a.containingDeclaration == b.containingDeclaration) return false
@@ -69,10 +69,9 @@ object DescriptorEquivalenceForOverrides {
// Distinct locals are not equivalent // Distinct locals are not equivalent
if (DescriptorUtils.isLocal(a) || DescriptorUtils.isLocal(b)) return false if (DescriptorUtils.isLocal(a) || DescriptorUtils.isLocal(b)) return false
if (!ownersEquivalent(a, b, { _, _ -> false})) return false if (!ownersEquivalent(a, b, { _, _ -> false })) return false
val overridingUtil = OverridingUtil.createWithEqualityAxioms eq@ { val overridingUtil = OverridingUtil.createWithEqualityAxioms eq@{ c1, c2 ->
c1, c2 ->
if (c1 == c2) return@eq true if (c1 == c2) return@eq true
val d1 = c1.declarationDescriptor val d1 = c1.declarationDescriptor
@@ -80,7 +79,7 @@ object DescriptorEquivalenceForOverrides {
if (d1 !is TypeParameterDescriptor || d2 !is TypeParameterDescriptor) return@eq false if (d1 !is TypeParameterDescriptor || d2 !is TypeParameterDescriptor) return@eq false
areTypeParametersEquivalent(d1, d2, {x, y -> x == a && y == b}) areTypeParametersEquivalent(d1, d2, { x, y -> x == a && y == b })
} }
return overridingUtil.isOverridableBy(a, b, null, !ignoreReturnType).result == OverrideCompatibilityInfo.Result.OVERRIDABLE return overridingUtil.isOverridableBy(a, b, null, !ignoreReturnType).result == OverrideCompatibilityInfo.Result.OVERRIDABLE
@@ -100,8 +99,7 @@ object DescriptorEquivalenceForOverrides {
// if the type parameter owners are, e.g., functions, we'll go into infinite recursion here // if the type parameter owners are, e.g., functions, we'll go into infinite recursion here
return if (aOwner is CallableMemberDescriptor || bOwner is CallableMemberDescriptor) { return if (aOwner is CallableMemberDescriptor || bOwner is CallableMemberDescriptor) {
equivalentCallables(aOwner, bOwner) equivalentCallables(aOwner, bOwner)
} } else {
else {
areEquivalent(aOwner, bOwner) areEquivalent(aOwner, bOwner)
} }
} }