@NotNull private <D extends CallableDescriptor, F extends D> OverloadResolutionResultsImpl<F> performResolution( @NotNull ResolutionTask<D, F> task, @NotNull CallTransformer<D, F> callTransformer) { for (ResolutionCandidate<D> resolutionCandidate : task.getCandidates()) { TemporaryBindingTrace candidateTrace = TemporaryBindingTrace.create(task.trace, "trace to resolve candidate"); Collection<CallCandidateResolutionContext<D>> contexts = callTransformer.createCallContexts(resolutionCandidate, task, candidateTrace); for (CallCandidateResolutionContext<D> context : contexts) { candidateResolver.performResolutionForCandidateCall(context, task); /* important for 'variable as function case': temporary bind reference to descriptor (will be rewritten) to have a binding to variable while 'invoke' call resolve */ task.tracing.bindReference(context.candidateCall.getTrace(), context.candidateCall); Collection<ResolvedCallWithTrace<F>> calls = callTransformer.transformCall(context, this, task); for (ResolvedCallWithTrace<F> call : calls) { task.tracing.bindReference(call.getTrace(), call); task.tracing.bindResolvedCall(call.getTrace(), call); task.getResolvedCalls().add(call); } } } OverloadResolutionResultsImpl<F> results = ResolutionResultsHandler.INSTANCE.computeResultAndReportErrors( task.trace, task.tracing, task.getResolvedCalls()); if (!results.isSingleResult() && !results.isIncomplete()) { argumentTypeResolver.checkTypesWithNoCallee(task.toBasic()); } return results; }