[LC] light methods should provide type parameters for on the fly resolve

References inside LC apis are build over `ClsJavaCodeReferenceElement`,
which simplifies resolve by providing precalculated data.
When refactorings or quick fixes do on the fly resolve,
giving only text and LC context,
such precalculated data is not available and normal resolve starts.
In order for this resolve to work correctly,
LC should provide available declarations

Corresponding test in monorepo: `KotlinSymbolOnAirResolveTest`

^ KT-62440 fixed
This commit is contained in:
Anna Kozlova
2023-10-09 16:01:37 +02:00
committed by Space Team
parent afdd8466cc
commit 79193006ce
@@ -9,6 +9,7 @@ import com.intellij.psi.*
import com.intellij.psi.impl.PsiImplUtil
import com.intellij.psi.impl.PsiSuperMethodImplUtil
import com.intellij.psi.impl.light.LightReferenceListBuilder
import com.intellij.psi.scope.PsiScopeProcessor
import com.intellij.psi.util.MethodSignature
import com.intellij.psi.util.MethodSignatureBackedByPsiMethod
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
@@ -67,6 +68,15 @@ internal abstract class SymbolLightMethodBase(
override fun getSignature(substitutor: PsiSubstitutor): MethodSignature =
MethodSignatureBackedByPsiMethod.create(this, substitutor)
override fun processDeclarations(
processor: PsiScopeProcessor,
state: ResolveState,
lastParent: PsiElement?,
place: PsiElement,
): Boolean {
return PsiImplUtil.processDeclarationsInMethod(this, processor, state, lastParent, place)
}
abstract override fun equals(other: Any?): Boolean
abstract override fun hashCode(): Int