Unwrap both parts of light element in KtLightElementBase.isEquivalentTo
Even if origins are same, wrapped light elements are not equivalent. Revealed by running bunch of JavaAgainstKotlinBinariesCheckerTestGenerated tests. com.intellij.testFramework.LoggedErrorProcessor$TestLoggerAssertionError: Non-idempotent computation: it returns different results when invoked multiple times or on different threads: KtLightMethodForDecompiledDeclaration of KtLightClassForDecompiledDeclaration of PsiFile:A.class != KtLightMethodForDecompiledDeclaration of KtLightClassForDecompiledDeclaration of PsiFile:A.class
This commit is contained in:
committed by
TeamCityServer
parent
c8a81911c0
commit
66683d2952
+9
-2
@@ -44,6 +44,13 @@ abstract class KtLightElementBase(private var parent: PsiElement) : LightElement
|
||||
override fun getPresentation() = (kotlinOrigin ?: this).let { ItemPresentationProviders.getItemPresentation(it) }
|
||||
override fun isValid() = parent.isValid && (kotlinOrigin?.isValid != false)
|
||||
override fun findElementAt(offset: Int) = kotlinOrigin?.findElementAt(offset)
|
||||
override fun isEquivalentTo(another: PsiElement?): Boolean =
|
||||
super.isEquivalentTo(another) || kotlinOrigin?.isEquivalentTo(another) == true
|
||||
override fun isEquivalentTo(another: PsiElement?): Boolean {
|
||||
if (super.isEquivalentTo(another)) {
|
||||
return true
|
||||
}
|
||||
|
||||
val origin = kotlinOrigin ?: return false
|
||||
return origin.isEquivalentTo(another) ||
|
||||
(another is KtLightElementBase && origin.isEquivalentTo(another.kotlinOrigin))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user