[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)
|
||||
|
||||
val lastExpressionArgument = getLastDeparentesizedExpression(psiCallArgument)?.let { lastExpression ->
|
||||
val lastExpressionType = functionTypeInfo.type?.let {
|
||||
if (it.isFunctionType) it.getReturnTypeFromFunctionType() else it
|
||||
}
|
||||
val lastExpressionType = trace.getType(lastExpression)
|
||||
val lastExpressionTypeInfo = KotlinTypeInfo(lastExpressionType, lambdaInfo.dataFlowInfoAfter ?: functionTypeInfo.dataFlowInfo)
|
||||
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 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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user