(LightClasses) while looking for accessors we expect them to be taken from single class

This commit is contained in:
Vladimir Ilmov
2020-06-05 01:16:35 +02:00
parent c0144d2161
commit 991f12bd73
@@ -128,10 +128,18 @@ object LightClassUtil {
return getPsiMethodWrappers(declaration).firstOrNull() return getPsiMethodWrappers(declaration).firstOrNull()
} }
private fun getPsiMethodWrappers(declaration: KtDeclaration): Sequence<KtLightMethod> = private fun getPsiMethodWrappers(declaration: KtDeclaration): Sequence<KtLightMethod> {
getWrappingClasses(declaration).flatMap { it.methods.asSequence() } val classes = getWrappingClasses(declaration)
.filterIsInstance<KtLightMethod>() for (clazz in classes) {
.filter { it.kotlinOrigin === declaration } // the first class with methods found should contain all methods with kotlinOrigin, so no need to look after
val methods = clazz.methods
.filterIsInstance<KtLightMethod>()
.filter { it.kotlinOrigin === declaration }
if (methods.isNotEmpty())
return methods.asSequence()
}
return emptySequence()
}
private fun getWrappingClass(declaration: KtDeclaration): PsiClass? { private fun getWrappingClass(declaration: KtDeclaration): PsiClass? {
if (declaration is KtParameter) { if (declaration is KtParameter) {