[FIR IDE] Fixed getting symbols for lambda literal

This commit is contained in:
Igor Yakovlev
2021-03-29 19:28:00 +02:00
parent d05ef3a635
commit ff9edb8776
2 changed files with 6 additions and 0 deletions
@@ -27,6 +27,11 @@ abstract class KtSymbolProvider : KtAnalysisSessionComponent() {
literalExpression?.let(::getAnonymousObjectSymbol) ?: getClassOrObjectSymbol(psi)
}
is KtPropertyAccessor -> getPropertyAccessorSymbol(psi)
is KtFunctionLiteral -> {
val literalExpression = psi.parent as? KtLambdaExpression
check(literalExpression != null) { "Unexpected parent for KtFunctionLiteral" }
getAnonymousFunctionSymbol(literalExpression)
}
else -> error("Cannot build symbol for ${psi::class}")
}
@@ -127,6 +127,7 @@ internal class FirModuleResolveStateImpl(
val firDeclaration = FirElementFinder.findElementIn<FirDeclaration>(container) { firDeclaration ->
when (val realPsi = firDeclaration.realPsi) {
is KtObjectLiteralExpression -> realPsi.objectDeclaration == ktDeclaration
is KtFunctionLiteral -> realPsi.parent == ktDeclaration
else -> realPsi == ktDeclaration
}
}