From aaee401240e68330306e14c913394a8cf51b70dd Mon Sep 17 00:00:00 2001 From: Dmitry Savvinov Date: Wed, 22 Nov 2017 19:21:49 +0300 Subject: [PATCH] [NI] Minor renaming Use words 'returnArgument' instead of 'resultArgument' when talking about values, which can be possibly returned from lambda. Correct 'addSubsystemForArgument' -> 'addSubsystemFromArgument' --- .../calls/tower/KotlinResolutionCallbacksImpl.kt | 2 +- .../resolve/calls/components/ExternalComponents.kt | 2 +- .../calls/components/PostponedArgumentsAnalyzer.kt | 12 ++++++------ .../calls/inference/ConstraintSystemBuilder.kt | 9 +++------ .../resolve/calls/model/KotlinResolverContext.kt | 10 +++++----- 5 files changed, 16 insertions(+), 19 deletions(-) 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 df032ca8d1e..8a46f6bd273 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 @@ -67,7 +67,7 @@ class KotlinResolutionCallbacksImpl( } } - override fun analyzeAndGetLambdaResultArguments( + override fun analyzeAndGetLambdaReturnArguments( lambdaArgument: LambdaKotlinCallArgument, isSuspend: Boolean, receiverType: UnwrappedType?, diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/ExternalComponents.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/ExternalComponents.kt index 92e709d4b50..4cf622137dc 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/ExternalComponents.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/ExternalComponents.kt @@ -37,7 +37,7 @@ interface KotlinResolutionStatelessCallbacks { // This components hold state (trace). Work with this carefully. interface KotlinResolutionCallbacks { - fun analyzeAndGetLambdaResultArguments( + fun analyzeAndGetLambdaReturnArguments( lambdaArgument: LambdaKotlinCallArgument, isSuspend: Boolean, receiverType: UnwrappedType?, diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/PostponedArgumentsAnalyzer.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/PostponedArgumentsAnalyzer.kt index e71265233b3..b759271c377 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/PostponedArgumentsAnalyzer.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/PostponedArgumentsAnalyzer.kt @@ -17,7 +17,7 @@ package org.jetbrains.kotlin.resolve.calls.components import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemBuilder -import org.jetbrains.kotlin.resolve.calls.inference.addSubsystemForArgument +import org.jetbrains.kotlin.resolve.calls.inference.addSubsystemFromArgument import org.jetbrains.kotlin.resolve.calls.inference.components.NewTypeSubstitutor import org.jetbrains.kotlin.resolve.calls.inference.model.ConstraintStorage import org.jetbrains.kotlin.resolve.calls.inference.model.LambdaArgumentConstraintPosition @@ -64,19 +64,19 @@ class PostponedArgumentsAnalyzer( val parameters = lambda.parameters.map(::substitute) val expectedType = lambda.returnType.takeIf { c.canBeProper(it) }?.let(::substitute) - val resultArguments = resolutionCallbacks.analyzeAndGetLambdaResultArguments(lambda.atom, lambda.isSuspend, receiver, parameters, expectedType) + val returnArguments = resolutionCallbacks.analyzeAndGetLambdaReturnArguments(lambda.atom, lambda.isSuspend, receiver, parameters, expectedType) - resultArguments.forEach { c.addSubsystemForArgument(it) } + returnArguments.forEach { c.addSubsystemFromArgument(it) } - val subResolvedKtPrimitives = resultArguments.map { + val subResolvedKtPrimitives = returnArguments.map { checkSimpleArgument(c.getBuilder(), it, lambda.returnType.let(::substitute), diagnosticHolder, isReceiver = false) } - if (resultArguments.isEmpty()) { + if (returnArguments.isEmpty()) { val unitType = lambda.returnType.builtIns.unitType c.getBuilder().addSubtypeConstraint(lambda.returnType.let(::substitute), unitType, LambdaArgumentConstraintPosition(lambda)) } - lambda.setAnalyzedResults(resultArguments, subResolvedKtPrimitives) + lambda.setAnalyzedResults(returnArguments, subResolvedKtPrimitives) } } \ No newline at end of file diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/ConstraintSystemBuilder.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/ConstraintSystemBuilder.kt index 6bf5171c851..2a1c9e60ae8 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/ConstraintSystemBuilder.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/ConstraintSystemBuilder.kt @@ -21,10 +21,7 @@ import org.jetbrains.kotlin.resolve.calls.components.PostponedArgumentsAnalyzer import org.jetbrains.kotlin.resolve.calls.inference.components.NewTypeSubstitutor import org.jetbrains.kotlin.resolve.calls.inference.model.ConstraintPosition import org.jetbrains.kotlin.resolve.calls.inference.model.NewTypeVariable -import org.jetbrains.kotlin.resolve.calls.model.CallableReferenceKotlinCallArgument -import org.jetbrains.kotlin.resolve.calls.model.KotlinCallArgument -import org.jetbrains.kotlin.resolve.calls.model.LHSResult -import org.jetbrains.kotlin.resolve.calls.model.SubKotlinCallArgument +import org.jetbrains.kotlin.resolve.calls.model.* import org.jetbrains.kotlin.types.TypeConstructor import org.jetbrains.kotlin.types.UnwrappedType import org.jetbrains.kotlin.utils.addToStdlib.safeAs @@ -57,11 +54,11 @@ fun ConstraintSystemBuilder.addSubtypeConstraintIfCompatible(lowerType: Unwrappe } -fun PostponedArgumentsAnalyzer.Context.addSubsystemForArgument(argument: KotlinCallArgument?) { +fun PostponedArgumentsAnalyzer.Context.addSubsystemFromArgument(argument: KotlinCallArgument?) { when (argument) { is SubKotlinCallArgument -> addOtherSystem(argument.callResult.constraintSystem) is CallableReferenceKotlinCallArgument -> { - addSubsystemForArgument(argument.lhsResult.safeAs()?.lshCallArgument) + addSubsystemFromArgument(argument.lhsResult.safeAs()?.lshCallArgument) } } } \ No newline at end of file diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/KotlinResolverContext.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/KotlinResolverContext.kt index 2d8c64f3580..3c3478dd12a 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/KotlinResolverContext.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/KotlinResolverContext.kt @@ -22,7 +22,7 @@ import org.jetbrains.kotlin.config.LanguageVersionSettings import org.jetbrains.kotlin.descriptors.CallableDescriptor import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.resolve.calls.components.* -import org.jetbrains.kotlin.resolve.calls.inference.addSubsystemForArgument +import org.jetbrains.kotlin.resolve.calls.inference.addSubsystemFromArgument import org.jetbrains.kotlin.resolve.calls.inference.components.ConstraintInjector import org.jetbrains.kotlin.resolve.calls.inference.model.ConstraintStorage import org.jetbrains.kotlin.resolve.calls.inference.model.NewConstraintSystemImpl @@ -54,12 +54,12 @@ class SimpleCandidateFactory( init { val baseSystem = NewConstraintSystemImpl(callComponents.constraintInjector, callComponents.builtIns) - baseSystem.addSubsystemForArgument(kotlinCall.explicitReceiver) - baseSystem.addSubsystemForArgument(kotlinCall.dispatchReceiverForInvokeExtension) + baseSystem.addSubsystemFromArgument(kotlinCall.explicitReceiver) + baseSystem.addSubsystemFromArgument(kotlinCall.dispatchReceiverForInvokeExtension) for (argument in kotlinCall.argumentsInParenthesis) { - baseSystem.addSubsystemForArgument(argument) + baseSystem.addSubsystemFromArgument(argument) } - baseSystem.addSubsystemForArgument(kotlinCall.externalArgument) + baseSystem.addSubsystemFromArgument(kotlinCall.externalArgument) this.baseSystem = baseSystem.asReadOnlyStorage() }