KT-64993 [AA] Unwrap safe call when deducing the expected type of function argument in KtFirExpressionTypeProvider
^KT-64993 Fixed
This commit is contained in:
+2
-1
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.analysis.api.fir.components
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.analysis.api.components.KtExpressionTypeProvider
|
||||
import org.jetbrains.kotlin.analysis.api.fir.KtFirAnalysisSession
|
||||
import org.jetbrains.kotlin.analysis.api.fir.unwrapSafeCall
|
||||
import org.jetbrains.kotlin.analysis.api.fir.utils.unwrap
|
||||
import org.jetbrains.kotlin.analysis.api.lifetime.KtLifetimeToken
|
||||
import org.jetbrains.kotlin.analysis.api.types.KtErrorType
|
||||
@@ -219,7 +220,7 @@ internal class KtFirExpressionTypeProvider(
|
||||
|
||||
private fun getExpectedTypeOfFunctionParameter(expression: PsiElement): KtType? {
|
||||
val (ktCallElement, argumentExpression) = expression.getFunctionCallAsWithThisAsParameter() ?: return null
|
||||
val firCall = ktCallElement.getOrBuildFirSafe<FirCall>(firResolveSession) ?: return null
|
||||
val firCall = ktCallElement.getOrBuildFir(firResolveSession)?.unwrapSafeCall() as? FirCall ?: return null
|
||||
|
||||
val callee = (firCall.calleeReference as? FirResolvedNamedReference)?.resolvedSymbol
|
||||
if (callee?.fir?.origin == FirDeclarationOrigin.SamConstructor) {
|
||||
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
expression: arg
|
||||
expected type: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/String
|
||||
+4
-1
@@ -1,2 +1,5 @@
|
||||
expression: arg
|
||||
expected type: null
|
||||
expected type: KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: []
|
||||
type: kotlin/String
|
||||
|
||||
Reference in New Issue
Block a user