removed unused type parameter from CallCandidateResolutionContext
This commit is contained in:
@@ -516,8 +516,8 @@ public class CallResolver {
|
||||
for (ResolutionCandidate<D> resolutionCandidate : task.getCandidates()) {
|
||||
TemporaryBindingTrace candidateTrace = TemporaryBindingTrace.create(
|
||||
task.trace, "trace to resolve candidate");
|
||||
Collection<CallCandidateResolutionContext<D, F>> contexts = callTransformer.createCallContexts(resolutionCandidate, task, candidateTrace);
|
||||
for (CallCandidateResolutionContext<D, F> context : contexts) {
|
||||
Collection<CallCandidateResolutionContext<D>> contexts = callTransformer.createCallContexts(resolutionCandidate, task, candidateTrace);
|
||||
for (CallCandidateResolutionContext<D> context : contexts) {
|
||||
|
||||
candidateResolver.performResolutionForCandidateCall(context, task);
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public class CallTransformer<D extends CallableDescriptor, F extends D> {
|
||||
* Returns two contexts for 'variable as function' case (in FUNCTION_CALL_TRANSFORMER), one context otherwise
|
||||
*/
|
||||
@NotNull
|
||||
public Collection<CallCandidateResolutionContext<D, F>> createCallContexts(@NotNull ResolutionCandidate<D> candidate,
|
||||
public Collection<CallCandidateResolutionContext<D>> createCallContexts(@NotNull ResolutionCandidate<D> candidate,
|
||||
@NotNull ResolutionTask<D, F> task,
|
||||
@NotNull TemporaryBindingTrace candidateTrace) {
|
||||
|
||||
@@ -77,7 +77,7 @@ public class CallTransformer<D extends CallableDescriptor, F extends D> {
|
||||
* the resolved call from callCandidateResolutionContext otherwise
|
||||
*/
|
||||
@NotNull
|
||||
public Collection<ResolvedCallWithTrace<F>> transformCall(@NotNull CallCandidateResolutionContext<D, F> callCandidateResolutionContext,
|
||||
public Collection<ResolvedCallWithTrace<F>> transformCall(@NotNull CallCandidateResolutionContext<D> callCandidateResolutionContext,
|
||||
@NotNull CallResolver callResolver,
|
||||
@NotNull ResolutionTask<D, F> task) {
|
||||
|
||||
@@ -90,7 +90,7 @@ public class CallTransformer<D extends CallableDescriptor, F extends D> {
|
||||
public static CallTransformer<CallableDescriptor, FunctionDescriptor> FUNCTION_CALL_TRANSFORMER = new CallTransformer<CallableDescriptor, FunctionDescriptor>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<CallCandidateResolutionContext<CallableDescriptor, FunctionDescriptor>> createCallContexts(@NotNull ResolutionCandidate<CallableDescriptor> candidate,
|
||||
public Collection<CallCandidateResolutionContext<CallableDescriptor>> createCallContexts(@NotNull ResolutionCandidate<CallableDescriptor> candidate,
|
||||
@NotNull ResolutionTask<CallableDescriptor, FunctionDescriptor> task, @NotNull TemporaryBindingTrace candidateTrace) {
|
||||
|
||||
if (candidate.getDescriptor() instanceof FunctionDescriptor) {
|
||||
@@ -102,18 +102,18 @@ public class CallTransformer<D extends CallableDescriptor, F extends D> {
|
||||
boolean hasReceiver = candidate.getReceiverArgument().exists();
|
||||
Call variableCall = stripCallArguments(task);
|
||||
if (!hasReceiver) {
|
||||
CallCandidateResolutionContext<CallableDescriptor, FunctionDescriptor> context = CallCandidateResolutionContext.create(
|
||||
CallCandidateResolutionContext<CallableDescriptor> context = CallCandidateResolutionContext.create(
|
||||
ResolvedCallImpl.create(candidate, candidateTrace), task, candidateTrace, task.tracing, variableCall);
|
||||
return Collections.singleton(context);
|
||||
}
|
||||
Call variableCallWithoutReceiver = stripReceiver(variableCall);
|
||||
CallCandidateResolutionContext<CallableDescriptor, FunctionDescriptor> contextWithReceiver = createContextWithChainedTrace(
|
||||
CallCandidateResolutionContext<CallableDescriptor> contextWithReceiver = createContextWithChainedTrace(
|
||||
candidate, variableCall, candidateTrace, task);
|
||||
|
||||
ResolutionCandidate<CallableDescriptor> candidateWithoutReceiver = ResolutionCandidate.create(
|
||||
candidate.getDescriptor(), candidate.getThisObject(), ReceiverValue.NO_RECEIVER, ExplicitReceiverKind.NO_EXPLICIT_RECEIVER, false);
|
||||
|
||||
CallCandidateResolutionContext<CallableDescriptor, FunctionDescriptor> contextWithoutReceiver = createContextWithChainedTrace(
|
||||
CallCandidateResolutionContext<CallableDescriptor> contextWithoutReceiver = createContextWithChainedTrace(
|
||||
candidateWithoutReceiver, variableCallWithoutReceiver, candidateTrace, task);
|
||||
|
||||
contextWithoutReceiver.receiverForVariableAsFunctionSecondCall = variableCall.getExplicitReceiver();
|
||||
@@ -121,7 +121,7 @@ public class CallTransformer<D extends CallableDescriptor, F extends D> {
|
||||
return Lists.newArrayList(contextWithReceiver, contextWithoutReceiver);
|
||||
}
|
||||
|
||||
private CallCandidateResolutionContext<CallableDescriptor, FunctionDescriptor> createContextWithChainedTrace(ResolutionCandidate<CallableDescriptor> candidate,
|
||||
private CallCandidateResolutionContext<CallableDescriptor> createContextWithChainedTrace(ResolutionCandidate<CallableDescriptor> candidate,
|
||||
Call call, TemporaryBindingTrace temporaryTrace, ResolutionTask<CallableDescriptor, FunctionDescriptor> task) {
|
||||
|
||||
ChainedTemporaryBindingTrace chainedTrace = ChainedTemporaryBindingTrace.create(temporaryTrace, "chained trace to resolve candidate", candidate);
|
||||
@@ -173,7 +173,7 @@ public class CallTransformer<D extends CallableDescriptor, F extends D> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<ResolvedCallWithTrace<FunctionDescriptor>> transformCall(@NotNull final CallCandidateResolutionContext<CallableDescriptor, FunctionDescriptor> context,
|
||||
public Collection<ResolvedCallWithTrace<FunctionDescriptor>> transformCall(@NotNull final CallCandidateResolutionContext<CallableDescriptor> context,
|
||||
@NotNull CallResolver callResolver, @NotNull final ResolutionTask<CallableDescriptor, FunctionDescriptor> task) {
|
||||
|
||||
final CallableDescriptor descriptor = context.candidateCall.getCandidateDescriptor();
|
||||
@@ -207,7 +207,7 @@ public class CallTransformer<D extends CallableDescriptor, F extends D> {
|
||||
});
|
||||
}
|
||||
|
||||
private Call createFunctionCall(final CallCandidateResolutionContext<CallableDescriptor, FunctionDescriptor> context,
|
||||
private Call createFunctionCall(final CallCandidateResolutionContext<CallableDescriptor> context,
|
||||
final ResolutionTask<CallableDescriptor, FunctionDescriptor> task, JetType returnType) {
|
||||
|
||||
final ExpressionReceiver receiverFromVariable = new ExpressionReceiver(task.reference, returnType);
|
||||
|
||||
@@ -66,7 +66,7 @@ public class CandidateResolver {
|
||||
}
|
||||
|
||||
public <D extends CallableDescriptor, F extends D> void performResolutionForCandidateCall(
|
||||
@NotNull CallCandidateResolutionContext<D, F> context,
|
||||
@NotNull CallCandidateResolutionContext<D> context,
|
||||
@NotNull ResolutionTask<D, F> task) {
|
||||
|
||||
ProgressIndicatorProvider.checkCanceled();
|
||||
@@ -167,7 +167,7 @@ public class CandidateResolver {
|
||||
AutoCastUtils.recordAutoCastIfNecessary(candidateCall.getThisObject(), candidateCall.getTrace());
|
||||
}
|
||||
|
||||
private static boolean checkOuterClassMemberIsAccessible(@NotNull CallCandidateResolutionContext<?, ?> 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;
|
||||
|
||||
@@ -186,7 +186,7 @@ public class CandidateResolver {
|
||||
}
|
||||
|
||||
public <D extends CallableDescriptor> void completeTypeInferenceDependentOnFunctionLiteralsForCall(
|
||||
CallCandidateResolutionContext<D, D> context
|
||||
CallCandidateResolutionContext<D> context
|
||||
) {
|
||||
ResolvedCallImpl<D> resolvedCall = context.candidateCall;
|
||||
assert resolvedCall.hasUnknownTypeParameters();
|
||||
@@ -209,7 +209,7 @@ public class CandidateResolver {
|
||||
}
|
||||
|
||||
public <D extends CallableDescriptor> void completeTypeInferenceDependentOnExpectedTypeForCall(
|
||||
CallCandidateResolutionContext<D, D> context
|
||||
CallCandidateResolutionContext<D> context
|
||||
) {
|
||||
ResolvedCallImpl<D> resolvedCall = context.candidateCall;
|
||||
assert resolvedCall.hasUnknownTypeParameters();
|
||||
@@ -263,7 +263,7 @@ public class CandidateResolver {
|
||||
@NotNull ValueArgument valueArgument,
|
||||
@NotNull ValueParameterDescriptor valueParameterDescriptor,
|
||||
@NotNull ConstraintSystem constraintSystem,
|
||||
@NotNull CallCandidateResolutionContext<D, D> context
|
||||
@NotNull CallCandidateResolutionContext<D> context
|
||||
) {
|
||||
JetExpression argumentExpression = valueArgument.getArgumentExpression();
|
||||
assert argumentExpression instanceof JetFunctionLiteralExpression;
|
||||
@@ -283,7 +283,7 @@ public class CandidateResolver {
|
||||
if (statementExpression == null) return;
|
||||
ObservableBindingTrace errorInterceptingTrace = ExpressionTypingUtils.makeTraceInterceptingTypeMismatch(
|
||||
traceToResolveFunctionLiteral, statementExpression, mismatch);
|
||||
CallCandidateResolutionContext<D, D> newContext =
|
||||
CallCandidateResolutionContext<D> newContext =
|
||||
context.replaceBindingTrace(errorInterceptingTrace).replaceExpectedType(expectedType);
|
||||
JetType type = argumentTypeResolver.getArgumentTypeInfo(argumentExpression, newContext, RESOLVE_FUNCTION_ARGUMENTS).getType();
|
||||
if (!mismatch[0]) {
|
||||
@@ -296,13 +296,13 @@ public class CandidateResolver {
|
||||
}
|
||||
}
|
||||
JetType expectedTypeWithoutReturnType = hasExpectedReturnType ? CallResolverUtil.replaceReturnTypeToUnknown(expectedType) : expectedType;
|
||||
CallCandidateResolutionContext<D, D> newContext = context.replaceExpectedType(expectedTypeWithoutReturnType);
|
||||
CallCandidateResolutionContext<D> newContext = context.replaceExpectedType(expectedTypeWithoutReturnType);
|
||||
JetType type = argumentTypeResolver.getArgumentTypeInfo(argumentExpression, newContext, RESOLVE_FUNCTION_ARGUMENTS).getType();
|
||||
constraintSystem.addSubtypeConstraint(
|
||||
type, effectiveExpectedType, ConstraintPosition.getValueParameterPosition(valueParameterDescriptor.getIndex()));
|
||||
}
|
||||
|
||||
private <D extends CallableDescriptor, F extends D> ResolutionStatus inferTypeArguments(CallCandidateResolutionContext<D, F> context) {
|
||||
private <D extends CallableDescriptor> ResolutionStatus inferTypeArguments(CallCandidateResolutionContext<D> context) {
|
||||
ResolvedCallImpl<D> candidateCall = context.candidateCall;
|
||||
final D candidate = candidateCall.getCandidateDescriptor();
|
||||
|
||||
@@ -418,8 +418,8 @@ public class CandidateResolver {
|
||||
}
|
||||
}
|
||||
|
||||
private <D extends CallableDescriptor, F extends D> ValueArgumentsCheckingResult checkAllValueArguments(
|
||||
@NotNull CallCandidateResolutionContext<D, F> context,
|
||||
private <D extends CallableDescriptor> ValueArgumentsCheckingResult checkAllValueArguments(
|
||||
@NotNull CallCandidateResolutionContext<D> context,
|
||||
@NotNull ResolveMode resolveFunctionArgumentBodies) {
|
||||
ValueArgumentsCheckingResult checkingResult = checkValueArgumentTypes(context, context.candidateCall,
|
||||
context.candidateCall.getTrace(), resolveFunctionArgumentBodies);
|
||||
@@ -511,7 +511,7 @@ public class CandidateResolver {
|
||||
return null;
|
||||
}
|
||||
|
||||
private <D extends CallableDescriptor, F extends D> ResolutionStatus checkReceiver(CallCandidateResolutionContext<D, F> context, ResolvedCall<D> candidateCall,
|
||||
private <D extends CallableDescriptor> ResolutionStatus checkReceiver(CallCandidateResolutionContext<D> context, ResolvedCall<D> candidateCall,
|
||||
ReceiverParameterDescriptor receiverParameter, ReceiverValue receiverArgument,
|
||||
boolean isExplicitReceiver, boolean implicitInvokeCheck) {
|
||||
|
||||
|
||||
+9
-9
@@ -28,7 +28,7 @@ import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
|
||||
public final class CallCandidateResolutionContext<D extends CallableDescriptor, F extends D> extends CallResolutionContext<CallCandidateResolutionContext<D, F>> {
|
||||
public final class CallCandidateResolutionContext<D extends CallableDescriptor> extends CallResolutionContext<CallCandidateResolutionContext<D>> {
|
||||
public final ResolvedCallImpl<D> candidateCall;
|
||||
public final TracingStrategy tracing;
|
||||
public ReceiverValue receiverForVariableAsFunctionSecondCall = ReceiverValue.NO_RECEIVER;
|
||||
@@ -52,40 +52,40 @@ public final class CallCandidateResolutionContext<D extends CallableDescriptor,
|
||||
}
|
||||
}
|
||||
|
||||
public static <D extends CallableDescriptor, F extends D> CallCandidateResolutionContext<D, F> create(
|
||||
public static <D extends CallableDescriptor, F extends D> CallCandidateResolutionContext<D> create(
|
||||
@NotNull ResolvedCallImpl<D> candidateCall, @NotNull ResolutionTask<D, F> task, @NotNull BindingTrace trace,
|
||||
@NotNull TracingStrategy tracing, @NotNull Call call) {
|
||||
return new CallCandidateResolutionContext<D, F>(candidateCall, tracing, trace, task.scope, call, task.expectedType,
|
||||
return new CallCandidateResolutionContext<D>(candidateCall, tracing, trace, task.scope, call, task.expectedType,
|
||||
task.dataFlowInfo, task.namespacesAllowed, true);
|
||||
}
|
||||
|
||||
public static <D extends CallableDescriptor, F extends D> CallCandidateResolutionContext<D, F> create(
|
||||
public static <D extends CallableDescriptor, F extends D> CallCandidateResolutionContext<D> create(
|
||||
@NotNull ResolvedCallImpl<D> candidateCall, @NotNull ResolutionTask<D, F> task, @NotNull BindingTrace trace,
|
||||
@NotNull TracingStrategy tracing) {
|
||||
return create(candidateCall, task, trace, tracing, task.call);
|
||||
}
|
||||
|
||||
public static <D extends CallableDescriptor> CallCandidateResolutionContext<D, D> createForCallBeingAnalyzed(
|
||||
public static <D extends CallableDescriptor> CallCandidateResolutionContext<D> createForCallBeingAnalyzed(
|
||||
@NotNull ResolvedCallImpl<D> candidateCall, @NotNull BasicCallResolutionContext context, @NotNull TracingStrategy tracing
|
||||
) {
|
||||
return new CallCandidateResolutionContext<D, D>(candidateCall, tracing, context.trace, context.scope, context.call,
|
||||
return new CallCandidateResolutionContext<D>(candidateCall, tracing, context.trace, context.scope, context.call,
|
||||
context.expectedType, context.dataFlowInfo, context.namespacesAllowed, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CallCandidateResolutionContext<D, F> replace(
|
||||
protected CallCandidateResolutionContext<D> replace(
|
||||
@NotNull BindingTrace trace,
|
||||
@NotNull JetScope scope,
|
||||
@NotNull DataFlowInfo dataFlowInfo,
|
||||
@NotNull JetType expectedType,
|
||||
boolean namespacesAllowed
|
||||
) {
|
||||
return new CallCandidateResolutionContext<D, F>(candidateCall, tracing, trace, scope, call, expectedType, dataFlowInfo,
|
||||
return new CallCandidateResolutionContext<D>(candidateCall, tracing, trace, scope, call, expectedType, dataFlowInfo,
|
||||
namespacesAllowed, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CallCandidateResolutionContext<D, F> self() {
|
||||
protected CallCandidateResolutionContext<D> self() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user