diff --git a/compiler/frontend/cfg/src/org/jetbrains/kotlin/cfg/pseudocode/pseudocodeUtils.kt b/compiler/frontend/cfg/src/org/jetbrains/kotlin/cfg/pseudocode/pseudocodeUtils.kt index 41f4197d627..234008c6a93 100644 --- a/compiler/frontend/cfg/src/org/jetbrains/kotlin/cfg/pseudocode/pseudocodeUtils.kt +++ b/compiler/frontend/cfg/src/org/jetbrains/kotlin/cfg/pseudocode/pseudocodeUtils.kt @@ -43,7 +43,7 @@ import org.jetbrains.kotlin.resolve.calls.model.* import org.jetbrains.kotlin.resolve.calls.resolvedCallUtil.getExplicitReceiverValue import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind -import org.jetbrains.kotlin.resolve.calls.tasks.ResolutionCandidate +import org.jetbrains.kotlin.resolve.calls.tasks.OldResolutionCandidate import org.jetbrains.kotlin.resolve.calls.tasks.TracingStrategy import org.jetbrains.kotlin.resolve.findTopMostOverriddenDescriptors import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue @@ -102,7 +102,7 @@ fun getExpectedTypePredicate( val predicates = ArrayList() for (candidate in candidates) { - val resolutionCandidate = ResolutionCandidate.create( + val resolutionCandidate = OldResolutionCandidate.create( call, candidate, null, diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallResolver.java index e275fd15baf..87e819f85ae 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallResolver.java @@ -218,7 +218,7 @@ public class CallResolver { private OverloadResolutionResults computeTasksFromCandidatesAndResolvedCall( @NotNull BasicCallResolutionContext context, @NotNull KtReferenceExpression referenceExpression, - @NotNull Collection> candidates + @NotNull Collection> candidates ) { return computeTasksFromCandidatesAndResolvedCall(context, candidates, TracingStrategyImpl.create(referenceExpression, context.call)); @@ -227,7 +227,7 @@ public class CallResolver { @NotNull private OverloadResolutionResults computeTasksFromCandidatesAndResolvedCall( @NotNull BasicCallResolutionContext context, - @NotNull Collection> candidates, + @NotNull Collection> candidates, @NotNull TracingStrategy tracing ) { return callResolvePerfCounter.>time(() -> { @@ -261,8 +261,8 @@ public class CallResolver { @NotNull Collection functionDescriptors ) { BasicCallResolutionContext callResolutionContext = BasicCallResolutionContext.create(context, call, CheckArgumentTypesMode.CHECK_VALUE_ARGUMENTS); - List> candidates = CollectionsKt.map(functionDescriptors, descriptor -> - ResolutionCandidate.create( + List> candidates = CollectionsKt.map(functionDescriptors, descriptor -> + OldResolutionCandidate.create( call, descriptor, null, @@ -282,8 +282,8 @@ public class CallResolver { @NotNull Collection functionDescriptors ) { BasicCallResolutionContext callResolutionContext = BasicCallResolutionContext.create(context, call, CheckArgumentTypesMode.CHECK_VALUE_ARGUMENTS); - List> resolutionCandidates = CollectionsKt.map(functionDescriptors, descriptor -> - ResolutionCandidate.create( + List> resolutionCandidates = CollectionsKt.map(functionDescriptors, descriptor -> + OldResolutionCandidate.create( call, descriptor, receiver, ExplicitReceiverKind.DISPATCH_RECEIVER, null)); return computeTasksFromCandidatesAndResolvedCall( @@ -412,10 +412,10 @@ public class CallResolver { @NotNull KtReferenceExpression functionReference, @NotNull KotlinType constructedType ) { - Pair>, BasicCallResolutionContext> candidatesAndContext = + Pair>, BasicCallResolutionContext> candidatesAndContext = prepareCandidatesAndContextForConstructorCall(constructedType, context, syntheticScopes); - Collection> candidates = candidatesAndContext.getFirst(); + Collection> candidates = candidatesAndContext.getFirst(); context = candidatesAndContext.getSecond(); return computeTasksFromCandidatesAndResolvedCall(context, functionReference, candidates); @@ -502,9 +502,9 @@ public class CallResolver { KotlinType superType = isThisCall ? currentClassDescriptor.getDefaultType() : DescriptorUtils.getSuperClassType(currentClassDescriptor); - Pair>, BasicCallResolutionContext> candidatesAndContext = + Pair>, BasicCallResolutionContext> candidatesAndContext = prepareCandidatesAndContextForConstructorCall(superType, context, syntheticScopes); - Collection> candidates = candidatesAndContext.getFirst(); + Collection> candidates = candidatesAndContext.getFirst(); context = candidatesAndContext.getSecond(); TracingStrategy tracing = call.isImplicit() ? @@ -529,13 +529,13 @@ public class CallResolver { } @NotNull - private static Pair>, BasicCallResolutionContext> prepareCandidatesAndContextForConstructorCall( + private static Pair>, BasicCallResolutionContext> prepareCandidatesAndContextForConstructorCall( @NotNull KotlinType superType, @NotNull BasicCallResolutionContext context, @NotNull SyntheticScopes syntheticScopes ) { if (!(superType.getConstructor().getDeclarationDescriptor() instanceof ClassDescriptor)) { - return new Pair<>(Collections.>emptyList(), context); + return new Pair<>(Collections.>emptyList(), context); } // If any constructor has type parameter (currently it only can be true for ones from Java), try to infer arguments for them @@ -547,7 +547,7 @@ public class CallResolver { context = context.replaceExpectedType(superType); } - List> candidates = + List> candidates = CallResolverUtilKt.createResolutionCandidatesForConstructors( context.scope, context.call, superType, !anyConstructorHasDeclaredTypeParameters, syntheticScopes ); @@ -568,14 +568,14 @@ public class CallResolver { @NotNull Call call, @NotNull TracingStrategy tracing, @NotNull ResolutionContext context, - @NotNull ResolutionCandidate candidate, + @NotNull OldResolutionCandidate candidate, @Nullable MutableDataFlowInfoForArguments dataFlowInfoForArguments ) { return callResolvePerfCounter.>time(() -> { BasicCallResolutionContext basicCallResolutionContext = BasicCallResolutionContext.create(context, call, CheckArgumentTypesMode.CHECK_VALUE_ARGUMENTS, dataFlowInfoForArguments); - Set> candidates = Collections.singleton(candidate); + Set> candidates = Collections.singleton(candidate); ResolutionTask resolutionTask = new ResolutionTask<>( new NewResolutionOldInference.ResolutionKind.GivenCandidates(), null, candidates @@ -737,7 +737,7 @@ public class CallResolver { final Name name; @Nullable - final Collection> givenCandidates; + final Collection> givenCandidates; @NotNull final NewResolutionOldInference.ResolutionKind resolutionKind; @@ -745,7 +745,7 @@ public class CallResolver { private ResolutionTask( @NotNull NewResolutionOldInference.ResolutionKind kind, @Nullable Name name, - @Nullable Collection> candidates + @Nullable Collection> candidates ) { this.name = name; givenCandidates = candidates; diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallResolverUtil.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallResolverUtil.kt index 199dc8656aa..489a6a60d14 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallResolverUtil.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallResolverUtil.kt @@ -26,7 +26,7 @@ import org.jetbrains.kotlin.resolve.calls.inference.constraintPosition.Constrain import org.jetbrains.kotlin.resolve.calls.inference.getNestedTypeVariables import org.jetbrains.kotlin.resolve.calls.model.ResolvedValueArgument import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind -import org.jetbrains.kotlin.resolve.calls.tasks.ResolutionCandidate +import org.jetbrains.kotlin.resolve.calls.tasks.OldResolutionCandidate import org.jetbrains.kotlin.resolve.descriptorUtil.isParameterOfAnnotation import org.jetbrains.kotlin.resolve.scopes.LexicalScope import org.jetbrains.kotlin.resolve.scopes.SyntheticScopes @@ -277,7 +277,7 @@ fun createResolutionCandidatesForConstructors( typeWithConstructors: KotlinType, useKnownTypeSubstitutor: Boolean, syntheticScopes: SyntheticScopes -): List> { +): List> { val classWithConstructors = typeWithConstructors.constructor.declarationDescriptor as ClassDescriptor val unwrappedType = typeWithConstructors.unwrap() @@ -320,7 +320,7 @@ fun createResolutionCandidatesForConstructors( val syntheticConstructors = constructors.flatMap { syntheticScopes.collectSyntheticConstructors(it) } return (constructors + syntheticConstructors).map { - ResolutionCandidate.create(call, it, dispatchReceiver, receiverKind, knownSubstitutor) + OldResolutionCandidate.create(call, it, dispatchReceiver, receiverKind, knownSubstitutor) } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/model/ResolvedCallImpl.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/model/ResolvedCallImpl.java index 072697869fb..836e8cae63a 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/model/ResolvedCallImpl.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/model/ResolvedCallImpl.java @@ -33,7 +33,7 @@ import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilKt; import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystem; import org.jetbrains.kotlin.resolve.calls.results.ResolutionStatus; import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind; -import org.jetbrains.kotlin.resolve.calls.tasks.ResolutionCandidate; +import org.jetbrains.kotlin.resolve.calls.tasks.OldResolutionCandidate; import org.jetbrains.kotlin.resolve.calls.tasks.TracingStrategy; import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt; import org.jetbrains.kotlin.resolve.scopes.receivers.*; @@ -53,7 +53,7 @@ public class ResolvedCallImpl implements MutableRe @NotNull public static ResolvedCallImpl create( - @NotNull ResolutionCandidate candidate, + @NotNull OldResolutionCandidate candidate, @NotNull DelegatingBindingTrace trace, @NotNull TracingStrategy tracing, @NotNull MutableDataFlowInfoForArguments dataFlowInfoForArguments @@ -87,7 +87,7 @@ public class ResolvedCallImpl implements MutableRe private Queue> remainingTasks = null; private ResolvedCallImpl( - @NotNull ResolutionCandidate candidate, + @NotNull OldResolutionCandidate candidate, @NotNull DelegatingBindingTrace trace, @NotNull TracingStrategy tracing, @NotNull MutableDataFlowInfoForArguments dataFlowInfoForArguments diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/ResolutionCandidate.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/OldResolutionCandidate.java similarity index 81% rename from compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/ResolutionCandidate.java rename to compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/OldResolutionCandidate.java index e732a09c35f..4f536aef61c 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/ResolutionCandidate.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/OldResolutionCandidate.java @@ -23,14 +23,14 @@ import org.jetbrains.kotlin.psi.Call; import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue; import org.jetbrains.kotlin.types.TypeSubstitutor; -public class ResolutionCandidate { +public class OldResolutionCandidate { private final Call call; private final D candidateDescriptor; private final TypeSubstitutor knownTypeParametersResultingSubstitutor; private ReceiverValue dispatchReceiver; // receiver object of a method private ExplicitReceiverKind explicitReceiverKind; - private ResolutionCandidate( + private OldResolutionCandidate( @NotNull Call call, @NotNull D descriptor, @Nullable ReceiverValue dispatchReceiver, @NotNull ExplicitReceiverKind explicitReceiverKind, @Nullable TypeSubstitutor knownTypeParametersResultingSubstitutor @@ -42,25 +42,25 @@ public class ResolutionCandidate { this.knownTypeParametersResultingSubstitutor = knownTypeParametersResultingSubstitutor; } - public static ResolutionCandidate create( + public static OldResolutionCandidate create( @NotNull Call call, @NotNull D descriptor ) { - return new ResolutionCandidate<>(call, descriptor, null, ExplicitReceiverKind.NO_EXPLICIT_RECEIVER, null); + return new OldResolutionCandidate<>(call, descriptor, null, ExplicitReceiverKind.NO_EXPLICIT_RECEIVER, null); } - public static ResolutionCandidate create( + public static OldResolutionCandidate create( @NotNull Call call, @NotNull D descriptor, @Nullable TypeSubstitutor knownTypeParametersResultingSubstitutor ) { - return new ResolutionCandidate<>(call, descriptor, null, ExplicitReceiverKind.NO_EXPLICIT_RECEIVER, + return new OldResolutionCandidate<>(call, descriptor, null, ExplicitReceiverKind.NO_EXPLICIT_RECEIVER, knownTypeParametersResultingSubstitutor); } - public static ResolutionCandidate create( + public static OldResolutionCandidate create( @NotNull Call call, @NotNull D descriptor, @Nullable ReceiverValue dispatchReceiver, @NotNull ExplicitReceiverKind explicitReceiverKind, @Nullable TypeSubstitutor knownTypeParametersResultingSubstitutor ) { - return new ResolutionCandidate<>(call, descriptor, dispatchReceiver, explicitReceiverKind, knownTypeParametersResultingSubstitutor); + return new OldResolutionCandidate<>(call, descriptor, dispatchReceiver, explicitReceiverKind, knownTypeParametersResultingSubstitutor); } public void setDispatchReceiver(@Nullable ReceiverValue dispatchReceiver) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewResolutionOldInference.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewResolutionOldInference.kt index a1876d4c214..9d1612c1390 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewResolutionOldInference.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewResolutionOldInference.kt @@ -225,7 +225,7 @@ class NewResolutionOldInference( fun runResolutionForGivenCandidates( basicCallContext: BasicCallResolutionContext, tracing: TracingStrategy, - candidates: Collection> + candidates: Collection> ): OverloadResolutionResultsImpl { val resolvedCandidates = candidates.map { candidate -> val candidateTrace = TemporaryBindingTrace.create(basicCallContext.trace, "Context for resolve candidate") diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/PSICallResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/PSICallResolver.kt index daf67b0db76..274fa3f70cf 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/PSICallResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/PSICallResolver.kt @@ -34,7 +34,7 @@ import org.jetbrains.kotlin.resolve.calls.results.* import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory import org.jetbrains.kotlin.resolve.calls.tasks.DynamicCallableDescriptors -import org.jetbrains.kotlin.resolve.calls.tasks.ResolutionCandidate +import org.jetbrains.kotlin.resolve.calls.tasks.OldResolutionCandidate import org.jetbrains.kotlin.resolve.calls.tasks.TracingStrategy import org.jetbrains.kotlin.resolve.calls.util.CallMaker import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluator @@ -121,7 +121,7 @@ class PSICallResolver( // actually, `D` is at least FunctionDescriptor, but right now because of CallResolver it isn't possible change upper bound for `D` fun runResolutionAndInferenceForGivenCandidates( context: BasicCallResolutionContext, - resolutionCandidates: Collection>, + resolutionCandidates: Collection>, tracingStrategy: TracingStrategy ): OverloadResolutionResults { val dispatchReceiver = resolutionCandidates.firstNotNullOfOrNull { it.dispatchReceiver } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java index 90cdc191bf4..f267375d1b2 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java @@ -58,7 +58,7 @@ import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo; import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValue; import org.jetbrains.kotlin.resolve.calls.smartcasts.Nullability; import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind; -import org.jetbrains.kotlin.resolve.calls.tasks.ResolutionCandidate; +import org.jetbrains.kotlin.resolve.calls.tasks.OldResolutionCandidate; import org.jetbrains.kotlin.resolve.calls.tasks.TracingStrategy; import org.jetbrains.kotlin.resolve.calls.tower.NewAbstractResolvedCall; import org.jetbrains.kotlin.resolve.calls.util.CallMaker; @@ -613,8 +613,8 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor { ) { BindingTrace trace = context.trace; Call call = CallMaker.makeCall(expression, null, null, expression, Collections.emptyList()); - ResolutionCandidate resolutionCandidate = - ResolutionCandidate.create( + OldResolutionCandidate resolutionCandidate = + OldResolutionCandidate.create( call, descriptor, null, ExplicitReceiverKind.NO_EXPLICIT_RECEIVER, null); ResolvedCallImpl resolvedCall = @@ -1003,7 +1003,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor { ) { Call call = propertyResolvedCall.getCall(); - ResolutionCandidate resolutionCandidate = ResolutionCandidate.create( + OldResolutionCandidate resolutionCandidate = OldResolutionCandidate.create( call, descriptor, propertyResolvedCall.getDispatchReceiver(), propertyResolvedCall.getExplicitReceiverKind(), null ); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ControlStructureTypingUtils.java b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ControlStructureTypingUtils.java index 64431b2ee50..a91c57098fe 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ControlStructureTypingUtils.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ControlStructureTypingUtils.java @@ -49,7 +49,7 @@ import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall; import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResults; import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo; import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind; -import org.jetbrains.kotlin.resolve.calls.tasks.ResolutionCandidate; +import org.jetbrains.kotlin.resolve.calls.tasks.OldResolutionCandidate; import org.jetbrains.kotlin.resolve.calls.tasks.TracingStrategy; import org.jetbrains.kotlin.resolve.calls.util.CallMaker; import org.jetbrains.kotlin.resolve.descriptorUtil.AnnotationsForResolveUtilsKt; @@ -162,8 +162,8 @@ public class ControlStructureTypingUtils { ) { TracingStrategy tracing = createTracingForSpecialConstruction(call, construct.getName(), context); TypeSubstitutor knownTypeParameterSubstitutor = createKnownTypeParameterSubstitutorForSpecialCall(construct, function, context.expectedType, context.languageVersionSettings); - ResolutionCandidate resolutionCandidate = - ResolutionCandidate.create(call, function, knownTypeParameterSubstitutor); + OldResolutionCandidate resolutionCandidate = + OldResolutionCandidate.create(call, function, knownTypeParameterSubstitutor); OverloadResolutionResults results = callResolver.resolveCallWithKnownCandidate( call, tracing, context, resolutionCandidate, dataFlowInfoForArguments); assert results.isSingleResult() : "Not single result after resolving one known candidate"; diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/LazyOperationsLog.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/LazyOperationsLog.kt index f18cfa05fa8..99076b551e1 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/LazyOperationsLog.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/LazyOperationsLog.kt @@ -25,7 +25,7 @@ import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.renderer.DescriptorRenderer import org.jetbrains.kotlin.resolve.DescriptorUtils -import org.jetbrains.kotlin.resolve.calls.tasks.ResolutionCandidate +import org.jetbrains.kotlin.resolve.calls.tasks.OldResolutionCandidate import org.jetbrains.kotlin.resolve.scopes.MemberScope import org.jetbrains.kotlin.serialization.deserialization.DeserializationContext import org.jetbrains.kotlin.serialization.deserialization.TypeDeserializer @@ -185,7 +185,7 @@ class LazyOperationsLog( } }.appendQuoted() } - o is ResolutionCandidate<*> -> DescriptorRenderer.COMPACT.render(o.descriptor).appendQuoted() + o is OldResolutionCandidate<*> -> DescriptorRenderer.COMPACT.render(o.descriptor).appendQuoted() } return sb.toString() }