[NI] Do not calculate lambda return type in Visitor if NI enabled.
This commit is contained in:
committed by
Mikhail Zarechenskiy
parent
85248676d2
commit
42438bd363
+1
-3
@@ -109,9 +109,7 @@ class KotlinResolutionCallbacksImpl(
|
|||||||
trace.record(BindingContext.NEW_INFERENCE_LAMBDA_INFO, ktFunction, LambdaInfo.STUB_EMPTY)
|
trace.record(BindingContext.NEW_INFERENCE_LAMBDA_INFO, ktFunction, LambdaInfo.STUB_EMPTY)
|
||||||
|
|
||||||
val lastExpressionArgument = getLastDeparentesizedExpression(psiCallArgument)?.let { lastExpression ->
|
val lastExpressionArgument = getLastDeparentesizedExpression(psiCallArgument)?.let { lastExpression ->
|
||||||
val lastExpressionType = functionTypeInfo.type?.let {
|
val lastExpressionType = trace.getType(lastExpression)
|
||||||
if (it.isFunctionType) it.getReturnTypeFromFunctionType() else it
|
|
||||||
}
|
|
||||||
val lastExpressionTypeInfo = KotlinTypeInfo(lastExpressionType, lambdaInfo.dataFlowInfoAfter ?: functionTypeInfo.dataFlowInfo)
|
val lastExpressionTypeInfo = KotlinTypeInfo(lastExpressionType, lambdaInfo.dataFlowInfoAfter ?: functionTypeInfo.dataFlowInfo)
|
||||||
createCallArgument(lastExpression, lastExpressionTypeInfo)
|
createCallArgument(lastExpression, lastExpressionTypeInfo)
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -225,7 +225,10 @@ internal class FunctionsTypingVisitor(facade: ExpressionTypingInternals) : Expre
|
|||||||
val blockReturnedType = components.expressionTypingServices.getBlockReturnedType(functionLiteral.bodyExpression!!, COERCION_TO_UNIT, newContext)
|
val blockReturnedType = components.expressionTypingServices.getBlockReturnedType(functionLiteral.bodyExpression!!, COERCION_TO_UNIT, newContext)
|
||||||
val typeOfBodyExpression = blockReturnedType.type
|
val typeOfBodyExpression = blockReturnedType.type
|
||||||
|
|
||||||
context.trace[BindingContext.NEW_INFERENCE_LAMBDA_INFO, expression.functionLiteral]?.dataFlowInfoAfter = blockReturnedType.dataFlowInfo
|
context.trace[BindingContext.NEW_INFERENCE_LAMBDA_INFO, expression.functionLiteral]?.let {
|
||||||
|
it.dataFlowInfoAfter = blockReturnedType.dataFlowInfo
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
return computeReturnTypeBasedOnReturnExpressions(functionLiteral, context, typeOfBodyExpression)
|
return computeReturnTypeBasedOnReturnExpressions(functionLiteral, context, typeOfBodyExpression)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user