[FE 1.0] Rename the remaining coroutine inference stuff into builder inference

This commit is contained in:
Victor Petukhov
2021-12-24 12:47:53 +03:00
committed by teamcity
parent 27ed4a7dc2
commit cedd98148c
@@ -197,7 +197,7 @@ class KotlinResolutionCallbacksImpl(
val approximatesExpectedType = val approximatesExpectedType =
typeApproximator.approximateToSubType(expectedType, TypeApproximatorConfiguration.LocalDeclaration) ?: expectedType typeApproximator.approximateToSubType(expectedType, TypeApproximatorConfiguration.LocalDeclaration) ?: expectedType
val coroutineSession = val builderInferenceSession =
if (stubsForPostponedVariables.isNotEmpty()) { if (stubsForPostponedVariables.isNotEmpty()) {
BuilderInferenceSession( BuilderInferenceSession(
psiCallResolver, postponedArgumentsAnalyzer, kotlinConstraintSystemCompleter, psiCallResolver, postponedArgumentsAnalyzer, kotlinConstraintSystemCompleter,
@@ -211,8 +211,8 @@ class KotlinResolutionCallbacksImpl(
} }
val temporaryTrace = if (coroutineSession != null) val temporaryTrace = if (builderInferenceSession != null)
TemporaryBindingTrace.create(trace, "Trace to resolve coroutine $lambdaArgument") TemporaryBindingTrace.create(trace, "Trace to resolve builder inference lambda: $lambdaArgument")
else else
null null
@@ -223,14 +223,16 @@ class KotlinResolutionCallbacksImpl(
.replaceContextDependency(lambdaInfo.contextDependency) .replaceContextDependency(lambdaInfo.contextDependency)
.replaceExpectedType(approximatesExpectedType) .replaceExpectedType(approximatesExpectedType)
.replaceDataFlowInfo(psiCallArgument.dataFlowInfoBeforeThisArgument).let { .replaceDataFlowInfo(psiCallArgument.dataFlowInfoBeforeThisArgument).let {
if (coroutineSession != null) it.replaceInferenceSession(coroutineSession) else it if (builderInferenceSession != null) it.replaceInferenceSession(builderInferenceSession) else it
} }
val functionTypeInfo = expressionTypingServices.getTypeInfo(psiCallArgument.expression, actualContext) val functionTypeInfo = expressionTypingServices.getTypeInfo(psiCallArgument.expression, actualContext)
(temporaryTrace ?: trace).record(BindingContext.NEW_INFERENCE_LAMBDA_INFO, psiCallArgument.ktFunction, LambdaInfo.STUB_EMPTY) (temporaryTrace ?: trace).record(BindingContext.NEW_INFERENCE_LAMBDA_INFO, psiCallArgument.ktFunction, LambdaInfo.STUB_EMPTY)
if (coroutineSession?.hasInapplicableCall() == true) { if (builderInferenceSession?.hasInapplicableCall() == true) {
return ReturnArgumentsAnalysisResult(ReturnArgumentsInfo.empty, coroutineSession, hasInapplicableCallForBuilderInference = true) return ReturnArgumentsAnalysisResult(
ReturnArgumentsInfo.empty, builderInferenceSession, hasInapplicableCallForBuilderInference = true
)
} else { } else {
temporaryTrace?.commit() temporaryTrace?.commit()
} }
@@ -277,7 +279,7 @@ class KotlinResolutionCallbacksImpl(
lastExpressionCoercedToUnit, lastExpressionCoercedToUnit,
returnArgumentFound returnArgumentFound
), ),
coroutineSession, builderInferenceSession,
) )
} }