[FE 1.0] Resolve equal calls through the new type inference infra

^KT-48961 In progress
This commit is contained in:
Victor Petukhov
2022-06-01 13:30:17 +02:00
committed by teamcity
parent a542de715a
commit a74c221729
@@ -22,6 +22,7 @@ import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStat
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.*;
import org.jetbrains.kotlin.resolve.bindingContextUtil.BindingContextUtilsKt;
import org.jetbrains.kotlin.resolve.calls.tower.NewResolutionOldInferenceKt;
import org.jetbrains.kotlin.resolve.calls.util.CallResolverUtilKt;
import org.jetbrains.kotlin.resolve.calls.util.ResolveArgumentsMode;
import org.jetbrains.kotlin.resolve.calls.util.CallUtilKt;
@@ -287,12 +288,21 @@ public class CallResolver {
@NotNull Collection<FunctionDescriptor> functionDescriptors
) {
BasicCallResolutionContext callResolutionContext = BasicCallResolutionContext.create(context, call, CheckArgumentTypesMode.CHECK_VALUE_ARGUMENTS);
List<OldResolutionCandidate<FunctionDescriptor>> resolutionCandidates = CollectionsKt.map(functionDescriptors, descriptor ->
OldResolutionCandidate.create(
call, descriptor, receiver, ExplicitReceiverKind.DISPATCH_RECEIVER, null));
return computeTasksFromCandidatesAndResolvedCall(
callResolutionContext, resolutionCandidates, TracingStrategyImpl.create(expression, call));
OverloadResolutionResults<FunctionDescriptor> resolutionResults = PSICallResolver.runResolutionAndInferenceForGivenDescriptors(
callResolutionContext,
functionDescriptors,
TracingStrategyImpl.create(expression, call),
null,
NewResolutionOldInferenceKt.transformToReceiverWithSmartCastInfo(context, receiver)
);
if (resolutionResults.isSingleResult()) {
context.trace.record(BindingContext.RESOLVED_CALL, call, resolutionResults.getResultingCall());
context.trace.record(BindingContext.CALL, call.getCalleeExpression(), call);
}
return resolutionResults;
}
@NotNull