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 2dd4f54bab8..4c56ca7d8f4 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallResolver.java @@ -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 functionDescriptors ) { BasicCallResolutionContext callResolutionContext = BasicCallResolutionContext.create(context, call, CheckArgumentTypesMode.CHECK_VALUE_ARGUMENTS); - List> resolutionCandidates = CollectionsKt.map(functionDescriptors, descriptor -> - OldResolutionCandidate.create( - call, descriptor, receiver, ExplicitReceiverKind.DISPATCH_RECEIVER, null)); - return computeTasksFromCandidatesAndResolvedCall( - callResolutionContext, resolutionCandidates, TracingStrategyImpl.create(expression, call)); + OverloadResolutionResults 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