From 2329bd1fe7c8d39073b29f7c9c446ca56b667987 Mon Sep 17 00:00:00 2001 From: Dmitrii Gridin Date: Wed, 30 Nov 2022 11:13:58 +0100 Subject: [PATCH] [SLC] SymbolLightAccessorMethod: simplify equals for psi case ^KT-54051 --- .../methods/SymbolLightAccessorMethod.kt | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/analysis/symbol-light-classes/src/org/jetbrains/kotlin/light/classes/symbol/methods/SymbolLightAccessorMethod.kt b/analysis/symbol-light-classes/src/org/jetbrains/kotlin/light/classes/symbol/methods/SymbolLightAccessorMethod.kt index c48c32902c4..a922ee300a0 100644 --- a/analysis/symbol-light-classes/src/org/jetbrains/kotlin/light/classes/symbol/methods/SymbolLightAccessorMethod.kt +++ b/analysis/symbol-light-classes/src/org/jetbrains/kotlin/light/classes/symbol/methods/SymbolLightAccessorMethod.kt @@ -222,16 +222,25 @@ internal class SymbolLightAccessorMethod private constructor( override fun equals(other: Any?): Boolean { if (this === other) return true - if (other !is SymbolLightAccessorMethod || other.ktModule != ktModule || other.isGetter != isGetter) return false - if (propertyAccessorDeclaration != null) { + if (other !is SymbolLightAccessorMethod || + other.isGetter != isGetter || + other.isTopLevel != isTopLevel || + other.suppressStatic != suppressStatic || + other.ktModule != ktModule + ) return false + + if (propertyAccessorDeclaration != null || other.propertyAccessorDeclaration != null) { return propertyAccessorDeclaration == other.propertyAccessorDeclaration } - return other.propertyAccessorDeclaration == null && - compareSymbolPointers(ktModule, propertyAccessorSymbolPointer, other.propertyAccessorSymbolPointer) + if (containingPropertyDeclaration != null || other.containingPropertyDeclaration != null) { + return containingPropertyDeclaration == other.containingPropertyDeclaration + } + + return compareSymbolPointers(ktModule, propertyAccessorSymbolPointer, other.propertyAccessorSymbolPointer) } - override fun hashCode(): Int = propertyAccessorDeclaration.hashCode() + override fun hashCode(): Int = propertyAccessorDeclaration?.hashCode() ?: containingPropertyDeclaration.hashCode() private val _parametersList by lazyPub { val parameterPopulator: (LightParameterListBuilder) -> Unit = if (!isGetter) {