Rename CoroutineInferenceSession to BuilderInferenceSession
This commit is contained in:
+6
-6
@@ -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<CallableDescriptor>(
|
||||
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<ConstraintSystemError>
|
||||
+2
-2
@@ -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,
|
||||
|
||||
+2
-2
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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) {
|
||||
|
||||
+3
-3
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user