Add reference equality shortcut for equals() in light members
This commit is contained in:
@@ -60,9 +60,10 @@ sealed class KtLightFieldImpl<D : PsiField>(
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean =
|
||||
other is KtLightFieldImpl<*> &&
|
||||
this.name == other.name &&
|
||||
this.containingClass == other.containingClass
|
||||
this === other ||
|
||||
(other is KtLightFieldImpl<*> &&
|
||||
this.name == other.name &&
|
||||
this.containingClass == other.containingClass)
|
||||
|
||||
override fun hashCode() = 31 * containingClass.hashCode() + name.hashCode()
|
||||
|
||||
|
||||
+6
-5
@@ -147,11 +147,12 @@ class KtLightMethodImpl private constructor(
|
||||
for source elements index is unique to each member
|
||||
*/
|
||||
override fun equals(other: Any?): Boolean =
|
||||
other is KtLightMethodImpl &&
|
||||
this.name == other.name &&
|
||||
this.containingClass == other.containingClass &&
|
||||
this.lightMemberOrigin == other.lightMemberOrigin &&
|
||||
this._memberIndex == other._memberIndex
|
||||
this === other ||
|
||||
(other is KtLightMethodImpl &&
|
||||
this.name == other.name &&
|
||||
this.containingClass == other.containingClass &&
|
||||
this.lightMemberOrigin == other.lightMemberOrigin &&
|
||||
this._memberIndex == other._memberIndex)
|
||||
|
||||
override fun hashCode(): Int = ((getName().hashCode() * 31 + (lightMemberOrigin?.hashCode() ?: 0)) * 31 + containingClass.hashCode()) * 31 + (_memberIndex?.hashCode() ?: 0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user