[FIR IDE] Fix receiverType for non-extension functions in AAPI/FE10

This commit partially fixes KtFe10SymbolByPsiTestGenerated.testDelegateField().
This commit is contained in:
Yan Zhulanow
2021-11-01 20:25:55 +09:00
parent 308e7c9e67
commit fac10881ea
3 changed files with 16 additions and 6 deletions
@@ -46,7 +46,13 @@ internal class KtFe10PsiAnonymousFunctionSymbol(
override val receiverType: KtTypeAndAnnotations?
get() = withValidityAssertion {
descriptor?.extensionReceiverParameter?.type?.toKtTypeAndAnnotations(analysisContext) ?: createErrorTypeAndAnnotations()
if (psi.isExtensionDeclaration()) {
return null
}
val descriptor = this.descriptor ?: return createErrorTypeAndAnnotations()
val extensionReceiverParameter = descriptor.extensionReceiverParameter ?: return null
return extensionReceiverParameter.type.toKtTypeAndAnnotations(analysisContext)
}
override val isExtension: Boolean
@@ -80,11 +80,13 @@ internal class KtFe10PsiFunctionSymbol(
override val receiverType: KtTypeAndAnnotations?
get() = withValidityAssertion {
return if (psi.isExtensionDeclaration()) {
descriptor?.extensionReceiverParameter?.type?.toKtTypeAndAnnotations(analysisContext) ?: createErrorTypeAndAnnotations()
} else {
null
if (!psi.isExtensionDeclaration()) {
return null
}
val descriptor = this.descriptor ?: return createErrorTypeAndAnnotations()
val extensionReceiverParameter = descriptor.extensionReceiverParameter ?: return null
return extensionReceiverParameter.type.toKtTypeAndAnnotations(analysisContext)
}
override val isExtension: Boolean
@@ -45,7 +45,9 @@ internal class KtFe10PsiLiteralAnonymousFunctionSymbol(
override val receiverType: KtTypeAndAnnotations?
get() = withValidityAssertion {
descriptor?.extensionReceiverParameter?.type?.toKtTypeAndAnnotations(analysisContext) ?: createErrorTypeAndAnnotations()
val descriptor = this.descriptor ?: return createErrorTypeAndAnnotations()
val extensionReceiverParameter = descriptor.extensionReceiverParameter ?: return null
extensionReceiverParameter.type.toKtTypeAndAnnotations(analysisContext)
}
override val isExtension: Boolean