diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/inference/CoroutineInferenceSession.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/inference/BuilderInferenceSession.kt similarity index 98% rename from compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/inference/CoroutineInferenceSession.kt rename to compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/inference/BuilderInferenceSession.kt index f6e7eec4819..350f1a18e04 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/inference/CoroutineInferenceSession.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/inference/BuilderInferenceSession.kt @@ -36,7 +36,7 @@ import org.jetbrains.kotlin.types.expressions.ExpressionTypingServices import org.jetbrains.kotlin.types.typeUtil.contains import org.jetbrains.kotlin.utils.addToStdlib.cast -class CoroutineInferenceSession( +class BuilderInferenceSession( psiCallResolver: PSICallResolver, postponedArgumentsAnalyzer: PostponedArgumentsAnalyzer, kotlinConstraintSystemCompleter: KotlinConstraintSystemCompleter, @@ -56,10 +56,10 @@ class CoroutineInferenceSession( ) : ManyCandidatesResolver( psiCallResolver, postponedArgumentsAnalyzer, kotlinConstraintSystemCompleter, callComponents, builtIns ) { - var nestedBuilderInferenceSession: CoroutineInferenceSession? = null + var nestedBuilderInferenceSession: BuilderInferenceSession? = null init { - if (topLevelCallContext.inferenceSession is CoroutineInferenceSession) { + if (topLevelCallContext.inferenceSession is BuilderInferenceSession) { topLevelCallContext.inferenceSession.nestedBuilderInferenceSession = this } } @@ -147,7 +147,7 @@ class CoroutineInferenceSession( descriptor.extensionReceiverParameter?.type?.contains { it is StubType } == true } - private fun isTopLevelBuilderInferenceCall() = topLevelCallContext.inferenceSession !is CoroutineInferenceSession + private fun isTopLevelBuilderInferenceCall() = topLevelCallContext.inferenceSession !is BuilderInferenceSession fun hasInapplicableCall(): Boolean = hasInapplicableCall @@ -234,7 +234,7 @@ class CoroutineInferenceSession( bindings[nonFixedType.constructor] = variable.defaultType } - val parentBuilderInferenceCallSession = topLevelCallContext.inferenceSession as? CoroutineInferenceSession + val parentBuilderInferenceCallSession = topLevelCallContext.inferenceSession as? BuilderInferenceSession if (parentBuilderInferenceCallSession != null) { bindings.putAll(parentBuilderInferenceCallSession.createNonFixedTypeToVariableMap()) @@ -399,7 +399,7 @@ class CoroutineInferenceSession( } companion object { - private fun CoroutineInferenceSession.updateCalls( + private fun BuilderInferenceSession.updateCalls( lambda: ResolvedLambdaAtom, substitutor: NewTypeSubstitutor, errors: List diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinResolutionCallbacksImpl.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinResolutionCallbacksImpl.kt index 4995779cbd1..1860f079635 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinResolutionCallbacksImpl.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinResolutionCallbacksImpl.kt @@ -23,7 +23,7 @@ import org.jetbrains.kotlin.resolve.calls.ArgumentTypeResolver import org.jetbrains.kotlin.resolve.calls.components.* import org.jetbrains.kotlin.resolve.calls.context.BasicCallResolutionContext import org.jetbrains.kotlin.resolve.calls.context.ContextDependency -import org.jetbrains.kotlin.resolve.calls.inference.CoroutineInferenceSession +import org.jetbrains.kotlin.resolve.calls.inference.BuilderInferenceSession import org.jetbrains.kotlin.resolve.calls.inference.components.KotlinConstraintSystemCompleter import org.jetbrains.kotlin.resolve.calls.inference.model.NewTypeVariable import org.jetbrains.kotlin.resolve.calls.model.* @@ -162,7 +162,7 @@ class KotlinResolutionCallbacksImpl( if (stubsForPostponedVariables.isNotEmpty()) { require(topLevelCallContext != null) { "Top level call context should not be null to analyze coroutine-lambda" } - CoroutineInferenceSession( + BuilderInferenceSession( psiCallResolver, postponedArgumentsAnalyzer, kotlinConstraintSystemCompleter, callComponents, builtIns, topLevelCallContext, stubsForPostponedVariables, trace, kotlinToResolvedCallTransformer, expressionTypingServices, argumentTypeResolver, diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/DoubleColonExpressionResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/DoubleColonExpressionResolver.kt index 7791cb46ad7..5bf91f812d3 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/DoubleColonExpressionResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/DoubleColonExpressionResolver.kt @@ -30,7 +30,7 @@ import org.jetbrains.kotlin.resolve.calls.callUtil.getCalleeExpressionIfAny import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall import org.jetbrains.kotlin.resolve.calls.checkers.isBuiltInCoroutineContext import org.jetbrains.kotlin.resolve.calls.context.* -import org.jetbrains.kotlin.resolve.calls.inference.CoroutineInferenceSession +import org.jetbrains.kotlin.resolve.calls.inference.BuilderInferenceSession import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResults import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResultsUtil import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo @@ -553,7 +553,7 @@ class DoubleColonExpressionResolver( val dataFlowInfo = (lhs as? DoubleColonLHS.Expression)?.dataFlowInfo ?: c.dataFlowInfo - if (c.inferenceSession is CoroutineInferenceSession && result?.contains { it is StubType } == true) { + if (c.inferenceSession is BuilderInferenceSession && result?.contains { it is StubType } == true) { c.inferenceSession.addOldCallableReferenceCalls(expression) } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingServices.java b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingServices.java index 79244aeadaa..9eef271d879 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingServices.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingServices.java @@ -22,7 +22,7 @@ import org.jetbrains.kotlin.resolve.*; import org.jetbrains.kotlin.resolve.calls.components.InferenceSession; import org.jetbrains.kotlin.resolve.calls.context.ContextDependency; import org.jetbrains.kotlin.resolve.calls.context.ResolutionContext; -import org.jetbrains.kotlin.resolve.calls.inference.CoroutineInferenceSession; +import org.jetbrains.kotlin.resolve.calls.inference.BuilderInferenceSession; import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo; import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValue; import org.jetbrains.kotlin.resolve.calls.tower.KotlinResolutionCallbacksImpl; @@ -429,7 +429,7 @@ public class ExpressionTypingServices { @NotNull KtExpression statementExpression, @NotNull ExpressionTypingContext context ) { - if (!context.languageVersionSettings.supportsFeature(LanguageFeature.NewInference) || context.inferenceSession instanceof CoroutineInferenceSession) + if (!context.languageVersionSettings.supportsFeature(LanguageFeature.NewInference) || context.inferenceSession instanceof BuilderInferenceSession) return null; KtFunctionLiteral functionLiteral = PsiUtilsKt.getNonStrictParentOfType(statementExpression, KtFunctionLiteral.class); if (functionLiteral != null) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingVisitorForStatements.java b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingVisitorForStatements.java index 63d891fd801..ce6e697dac1 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingVisitorForStatements.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingVisitorForStatements.java @@ -34,7 +34,7 @@ import org.jetbrains.kotlin.resolve.calls.ArgumentTypeResolver; import org.jetbrains.kotlin.resolve.calls.context.CallPosition; import org.jetbrains.kotlin.resolve.calls.context.ContextDependency; import org.jetbrains.kotlin.resolve.calls.context.TemporaryTraceAndCache; -import org.jetbrains.kotlin.resolve.calls.inference.CoroutineInferenceSession; +import org.jetbrains.kotlin.resolve.calls.inference.BuilderInferenceSession; import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall; import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResults; import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResultsImpl; @@ -247,8 +247,8 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito if (assignmentOperationType == null || lhsAssignable) { // Check for '+' // We should clear calls info for coroutine inference within right side as here we analyze it a second time in another context - if (context.inferenceSession instanceof CoroutineInferenceSession) { - ((CoroutineInferenceSession) context.inferenceSession).clearCallsInfoByContainingElement(right); + if (context.inferenceSession instanceof BuilderInferenceSession) { + ((BuilderInferenceSession) context.inferenceSession).clearCallsInfoByContainingElement(right); } Name counterpartName = OperatorConventions.BINARY_OPERATION_NAMES.get(OperatorConventions.ASSIGNMENT_OPERATION_COUNTERPARTS.get(operationType)); binaryOperationDescriptors = components.callResolver.resolveBinaryCall(