diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallCompleter.kt b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallCompleter.kt index 2182199f50b..4bc1b1421d9 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallCompleter.kt +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallCompleter.kt @@ -69,18 +69,24 @@ public class CallCompleter( results: OverloadResolutionResultsImpl, tracing: TracingStrategy ): OverloadResolutionResultsImpl { - // for the case 'foo(a)' where 'foo' is a variable, the call 'foo.invoke(a)' shouldn't be completed separately, - // it's completed when the outer (variable as function call) is completed - if (CallResolverUtil.isInvokeCallOnVariable(context.call)) return results val resolvedCall = if (results.isSingleResult()) results.getResultingCall() else null - val temporaryTrace = TemporaryBindingTrace.create(context.trace, "Trace to complete a resulting call") - completeResolvedCallAndArguments(resolvedCall, results, context.replaceBindingTrace(temporaryTrace), tracing) + // for the case 'foo(a)' where 'foo' is a variable, the call 'foo.invoke(a)' shouldn't be completed separately, + // it's completed when the outer (variable as function call) is completed + if (!CallResolverUtil.isInvokeCallOnVariable(context.call)) { - completeAllCandidates(context, results) + val temporaryTrace = TemporaryBindingTrace.create(context.trace, "Trace to complete a resulting call") + + completeResolvedCallAndArguments(resolvedCall, results, context.replaceBindingTrace(temporaryTrace), tracing) + + completeAllCandidates(context, results) + + temporaryTrace.commit() + } + + resolvedCall?.let { context.callResolverExtension.run(it, context) } - temporaryTrace.commit() if (results.isSingleResult() && results.getResultingCall().getStatus().isSuccess()) { return results.changeStatusToSuccess() } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java index 01236a192aa..7009fadd9a6 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java @@ -363,10 +363,6 @@ public class CallResolver { results = callCompleter.completeCall(context, results, tracing); } - if (results.isSingleResult()) { - context.callResolverExtension.run(results.getResultingCall(), context); - } - return results; }