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 =
|
override fun equals(other: Any?): Boolean =
|
||||||
other is KtLightFieldImpl<*> &&
|
this === other ||
|
||||||
this.name == other.name &&
|
(other is KtLightFieldImpl<*> &&
|
||||||
this.containingClass == other.containingClass
|
this.name == other.name &&
|
||||||
|
this.containingClass == other.containingClass)
|
||||||
|
|
||||||
override fun hashCode() = 31 * containingClass.hashCode() + name.hashCode()
|
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
|
for source elements index is unique to each member
|
||||||
*/
|
*/
|
||||||
override fun equals(other: Any?): Boolean =
|
override fun equals(other: Any?): Boolean =
|
||||||
other is KtLightMethodImpl &&
|
this === other ||
|
||||||
this.name == other.name &&
|
(other is KtLightMethodImpl &&
|
||||||
this.containingClass == other.containingClass &&
|
this.name == other.name &&
|
||||||
this.lightMemberOrigin == other.lightMemberOrigin &&
|
this.containingClass == other.containingClass &&
|
||||||
this._memberIndex == other._memberIndex
|
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)
|
override fun hashCode(): Int = ((getName().hashCode() * 31 + (lightMemberOrigin?.hashCode() ?: 0)) * 31 + containingClass.hashCode()) * 31 + (_memberIndex?.hashCode() ?: 0)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user