diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolutionContext.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallCandidateResolutionContext.java similarity index 82% rename from compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolutionContext.java rename to compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallCandidateResolutionContext.java index 52fb83744b3..5c60556059f 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolutionContext.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallCandidateResolutionContext.java @@ -25,12 +25,12 @@ import org.jetbrains.jet.lang.resolve.calls.tasks.ResolutionTask; import org.jetbrains.jet.lang.resolve.calls.tasks.TracingStrategy; import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue; -public final class CallResolutionContext extends ResolutionContext { +public final class CallCandidateResolutionContext extends ResolutionContext { /*package*/ final ResolvedCallImpl candidateCall; /*package*/ final TracingStrategy tracing; /*package*/ ReceiverValue receiverForVariableAsFunctionSecondCall = ReceiverValue.NO_RECEIVER; - private CallResolutionContext( + private CallCandidateResolutionContext( @NotNull ResolvedCallImpl candidateCall, @NotNull ResolutionTask task, @NotNull BindingTrace trace, @NotNull TracingStrategy tracing, @NotNull Call call, boolean namespacesAllowed ) { @@ -40,7 +40,7 @@ public final class CallResolutionContext candidateCall ) { @@ -50,21 +50,21 @@ public final class CallResolutionContext CallResolutionContext create( + public static CallCandidateResolutionContext create( @NotNull ResolvedCallImpl candidateCall, @NotNull ResolutionTask task, @NotNull BindingTrace trace, @NotNull TracingStrategy tracing, @NotNull Call call) { - return new CallResolutionContext(candidateCall, task, trace, tracing, call, task.namespacesAllowed); + return new CallCandidateResolutionContext(candidateCall, task, trace, tracing, call, task.namespacesAllowed); } - public static CallResolutionContext create( + public static CallCandidateResolutionContext create( @NotNull ResolvedCallImpl candidateCall, @NotNull ResolutionTask task, @NotNull BindingTrace trace, @NotNull TracingStrategy tracing) { return create(candidateCall, task, trace, tracing, task.call); } - public static CallResolutionContext create( + public static CallCandidateResolutionContext create( @NotNull BasicResolutionContext context, @NotNull TracingStrategy tracing, @NotNull ResolvedCallImpl candidateCall) { - return new CallResolutionContext(context, tracing, candidateCall); + return new CallCandidateResolutionContext(context, tracing, candidateCall); } } 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 6dfbcf11d11..58353cd4bb2 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 @@ -321,7 +321,7 @@ public class CallResolver { ResolvedCallWithTrace maximallySpecific = OverloadingConflictResolver.INSTANCE.findMaximallySpecific(incompleteCalls, false); if (maximallySpecific != null) { candidateResolver.completeTypeInferenceDependentOnExpectedTypeForCall( - CallResolutionContext.create(context, tracing, (ResolvedCallImpl) maximallySpecific)); + CallCandidateResolutionContext.create(context, tracing, (ResolvedCallImpl) maximallySpecific)); for (ResolvedCallWithTrace callWithUnknownTypeParameters : incompleteCalls) { if (callWithUnknownTypeParameters != maximallySpecific) { ((ResolvedCallImpl) callWithUnknownTypeParameters).addStatus(ResolutionStatus.OTHER_ERROR); @@ -499,8 +499,8 @@ public class CallResolver { for (ResolutionCandidate resolutionCandidate : task.getCandidates()) { TemporaryBindingTrace candidateTrace = TemporaryBindingTrace.create( task.trace, "trace to resolve candidate"); - Collection> contexts = callTransformer.createCallContexts(resolutionCandidate, task, candidateTrace); - for (CallResolutionContext context : contexts) { + Collection> contexts = callTransformer.createCallContexts(resolutionCandidate, task, candidateTrace); + for (CallCandidateResolutionContext context : contexts) { candidateResolver.performResolutionForCandidateCall(context, task); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallTransformer.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallTransformer.java index 1aa74ceb22f..1c43c3de6d5 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallTransformer.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallTransformer.java @@ -62,24 +62,24 @@ public class CallTransformer { * Returns two contexts for 'variable as function' case (in FUNCTION_CALL_TRANSFORMER), one context otherwise */ @NotNull - public Collection> createCallContexts(@NotNull ResolutionCandidate candidate, + public Collection> createCallContexts(@NotNull ResolutionCandidate candidate, @NotNull ResolutionTask task, @NotNull TemporaryBindingTrace candidateTrace) { ResolvedCallImpl candidateCall = ResolvedCallImpl.create(candidate, candidateTrace); - return Collections.singleton(CallResolutionContext.create(candidateCall, task, candidateTrace, task.tracing)); + return Collections.singleton(CallCandidateResolutionContext.create(candidateCall, task, candidateTrace, task.tracing)); } /** * Returns collection of resolved calls for 'invoke' for 'variable as function' case (in FUNCTION_CALL_TRANSFORMER), - * the resolved call from callResolutionContext otherwise + * the resolved call from callCandidateResolutionContext otherwise */ @NotNull - public Collection> transformCall(@NotNull CallResolutionContext callResolutionContext, + public Collection> transformCall(@NotNull CallCandidateResolutionContext callCandidateResolutionContext, @NotNull CallResolver callResolver, @NotNull ResolutionTask task) { - return Collections.singleton((ResolvedCallWithTrace)callResolutionContext.candidateCall); + return Collections.singleton((ResolvedCallWithTrace) callCandidateResolutionContext.candidateCall); } @@ -88,7 +88,7 @@ public class CallTransformer { public static CallTransformer FUNCTION_CALL_TRANSFORMER = new CallTransformer() { @NotNull @Override - public Collection> createCallContexts(@NotNull ResolutionCandidate candidate, + public Collection> createCallContexts(@NotNull ResolutionCandidate candidate, @NotNull ResolutionTask task, @NotNull TemporaryBindingTrace candidateTrace) { if (candidate.getDescriptor() instanceof FunctionDescriptor) { @@ -100,18 +100,18 @@ public class CallTransformer { boolean hasReceiver = candidate.getReceiverArgument().exists(); Call variableCall = stripCallArguments(task); if (!hasReceiver) { - CallResolutionContext context = CallResolutionContext.create( + CallCandidateResolutionContext context = CallCandidateResolutionContext.create( ResolvedCallImpl.create(candidate, candidateTrace), task, candidateTrace, task.tracing, variableCall); return Collections.singleton(context); } Call variableCallWithoutReceiver = stripReceiver(variableCall); - CallResolutionContext contextWithReceiver = createContextWithChainedTrace( + CallCandidateResolutionContext contextWithReceiver = createContextWithChainedTrace( candidate, variableCall, candidateTrace, task); ResolutionCandidate candidateWithoutReceiver = ResolutionCandidate.create( candidate.getDescriptor(), candidate.getThisObject(), ReceiverValue.NO_RECEIVER, ExplicitReceiverKind.NO_EXPLICIT_RECEIVER, false); - CallResolutionContext contextWithoutReceiver = createContextWithChainedTrace( + CallCandidateResolutionContext contextWithoutReceiver = createContextWithChainedTrace( candidateWithoutReceiver, variableCallWithoutReceiver, candidateTrace, task); contextWithoutReceiver.receiverForVariableAsFunctionSecondCall = variableCall.getExplicitReceiver(); @@ -119,12 +119,12 @@ public class CallTransformer { return Lists.newArrayList(contextWithReceiver, contextWithoutReceiver); } - private CallResolutionContext createContextWithChainedTrace(ResolutionCandidate candidate, + private CallCandidateResolutionContext createContextWithChainedTrace(ResolutionCandidate candidate, Call call, TemporaryBindingTrace temporaryTrace, ResolutionTask task) { ChainedTemporaryBindingTrace chainedTrace = ChainedTemporaryBindingTrace.create(temporaryTrace, "chained trace to resolve candidate", candidate); ResolvedCallImpl resolvedCall = ResolvedCallImpl.create(candidate, chainedTrace); - return CallResolutionContext.create(resolvedCall, task, chainedTrace, task.tracing, call); + return CallCandidateResolutionContext.create(resolvedCall, task, chainedTrace, task.tracing, call); } private Call stripCallArguments(@NotNull ResolutionTask task) { @@ -171,7 +171,7 @@ public class CallTransformer { @NotNull @Override - public Collection> transformCall(@NotNull final CallResolutionContext context, + public Collection> transformCall(@NotNull final CallCandidateResolutionContext context, @NotNull CallResolver callResolver, @NotNull final ResolutionTask task) { final CallableDescriptor descriptor = context.candidateCall.getCandidateDescriptor(); @@ -205,7 +205,7 @@ public class CallTransformer { }); } - private Call createFunctionCall(final CallResolutionContext context, + private Call createFunctionCall(final CallCandidateResolutionContext context, final ResolutionTask task, JetType returnType) { final ExpressionReceiver receiverFromVariable = new ExpressionReceiver(task.reference, returnType); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CandidateResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CandidateResolver.java index 857be500872..d3d9c9505b8 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CandidateResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CandidateResolver.java @@ -62,7 +62,7 @@ public class CandidateResolver { } public void performResolutionForCandidateCall( - @NotNull CallResolutionContext context, + @NotNull CallCandidateResolutionContext context, @NotNull ResolutionTask task) { ProgressIndicatorProvider.checkCanceled(); @@ -163,7 +163,7 @@ public class CandidateResolver { AutoCastUtils.recordAutoCastIfNecessary(candidateCall.getThisObject(), candidateCall.getTrace()); } - private static boolean checkOuterClassMemberIsAccessible(@NotNull CallResolutionContext context) { + private static boolean checkOuterClassMemberIsAccessible(@NotNull CallCandidateResolutionContext context) { // In "this@Outer.foo()" the error will be reported on "this@Outer" instead if (context.call.getExplicitReceiver().exists()) return true; @@ -182,7 +182,7 @@ public class CandidateResolver { } public void completeTypeInferenceDependentOnExpectedTypeForCall( - CallResolutionContext context + CallCandidateResolutionContext context ) { ResolvedCallImpl resolvedCall = context.candidateCall; assert resolvedCall.hasUnknownTypeParameters(); @@ -257,7 +257,7 @@ public class CandidateResolver { } } - private ResolutionStatus inferTypeArguments(CallResolutionContext context) { + private ResolutionStatus inferTypeArguments(CallCandidateResolutionContext context) { ResolvedCallImpl candidateCall = context.candidateCall; final D candidate = candidateCall.getCandidateDescriptor(); @@ -372,7 +372,7 @@ public class CandidateResolver { } private ValueArgumentsCheckingResult checkAllValueArguments( - @NotNull CallResolutionContext context, + @NotNull CallCandidateResolutionContext context, @NotNull ResolveMode resolveFunctionArgumentBodies) { ValueArgumentsCheckingResult checkingResult = checkValueArgumentTypes(context, context.candidateCall, context.candidateCall.getTrace(), resolveFunctionArgumentBodies); @@ -462,7 +462,7 @@ public class CandidateResolver { return null; } - private ResolutionStatus checkReceiver(CallResolutionContext context, ResolvedCall candidateCall, + private ResolutionStatus checkReceiver(CallCandidateResolutionContext context, ResolvedCall candidateCall, ReceiverParameterDescriptor receiverParameter, ReceiverValue receiverArgument, boolean isExplicitReceiver, boolean implicitInvokeCheck) {