[LC] Fix for light classes equivalence

This commit is contained in:
Igor Yakovlev
2020-12-14 23:53:19 +03:00
parent 45112a3c11
commit 010a290132
3 changed files with 13 additions and 12 deletions
@@ -190,9 +190,9 @@ open class KtLightClassForFacade constructor(
override fun getNavigationElement() = firstFileInFacade
override fun isEquivalentTo(another: PsiElement?): Boolean {
return another is KtLightClassForFacade && Comparing.equal(another.qualifiedName, qualifiedName)
}
override fun isEquivalentTo(another: PsiElement?): Boolean =
equals(another) ||
(another is KtLightClassForFacade && another.facadeClassFqName == facadeClassFqName)
override fun getElementIcon(flags: Int): Icon? = throw UnsupportedOperationException("This should be done by JetIconProvider")
@@ -123,9 +123,11 @@ open class KtLightClassForScript(val script: KtScript) : KtLazyLightClass(script
override fun getNavigationElement() = script
override fun isEquivalentTo(another: PsiElement?): Boolean =
another is PsiClass && Comparing.equal(another.qualifiedName, qualifiedName)
equals(another) ||
(another is KtLightClassForScript && fqName == another.fqName)
override fun getElementIcon(flags: Int): Icon? = throw UnsupportedOperationException("This should be done by JetIconProvider")
override fun getElementIcon(flags: Int): Icon? =
throw UnsupportedOperationException("This should be done by JetIconProvider")
override val originKind: LightClassOriginKind get() = LightClassOriginKind.SOURCE
@@ -174,7 +176,7 @@ open class KtLightClassForScript(val script: KtScript) : KtLazyLightClass(script
return false
}
val lightClass = other as KtLightClassForScript
val lightClass = other as? KtLightClassForScript ?: return false
if (this === other) return true
if (this.hashCode != lightClass.hashCode) return false
@@ -152,14 +152,13 @@ abstract class KtLightClassForSourceDeclaration(
override fun getNavigationElement(): PsiElement = classOrObject
override fun isEquivalentTo(another: PsiElement?): Boolean {
return kotlinOrigin.isEquivalentTo(another) ||
another is KtLightClassForSourceDeclaration && Comparing.equal(another.qualifiedName, qualifiedName)
}
override fun isEquivalentTo(another: PsiElement?): Boolean =
kotlinOrigin.isEquivalentTo(another) ||
equals(another) ||
(qualifiedName != null && another is KtLightClassForSourceDeclaration && qualifiedName == another.qualifiedName)
override fun getElementIcon(flags: Int): Icon? {
override fun getElementIcon(flags: Int): Icon? =
throw UnsupportedOperationException("This should be done by JetIconProvider")
}
override fun equals(other: Any?): Boolean {
if (this === other) return true