Used MutableResolvedCall instead of ResolvedCallImpl
during resolve process
This commit is contained in:
@@ -75,7 +75,7 @@ public class CandidateResolver {
|
|||||||
|
|
||||||
ProgressIndicatorProvider.checkCanceled();
|
ProgressIndicatorProvider.checkCanceled();
|
||||||
|
|
||||||
ResolvedCallImpl<D> candidateCall = context.candidateCall;
|
MutableResolvedCall<D> candidateCall = context.candidateCall;
|
||||||
D candidate = candidateCall.getCandidateDescriptor();
|
D candidate = candidateCall.getCandidateDescriptor();
|
||||||
|
|
||||||
candidateCall.addStatus(checkReceiverTypeError(context));
|
candidateCall.addStatus(checkReceiverTypeError(context));
|
||||||
@@ -104,11 +104,10 @@ public class CandidateResolver {
|
|||||||
|
|
||||||
if (task.checkArguments == CheckValueArgumentsMode.ENABLED) {
|
if (task.checkArguments == CheckValueArgumentsMode.ENABLED) {
|
||||||
Set<ValueArgument> unmappedArguments = Sets.newLinkedHashSet();
|
Set<ValueArgument> unmappedArguments = Sets.newLinkedHashSet();
|
||||||
ValueArgumentsToParametersMapper.Status
|
ValueArgumentsToParametersMapper.Status argumentMappingStatus = ValueArgumentsToParametersMapper.mapValueArgumentsToParameters(
|
||||||
argumentMappingStatus = ValueArgumentsToParametersMapper.mapValueArgumentsToParameters(context.call, context.tracing,
|
context.call, context.tracing, candidateCall, unmappedArguments);
|
||||||
candidateCall, unmappedArguments);
|
|
||||||
if (!argumentMappingStatus.isSuccess()) {
|
if (!argumentMappingStatus.isSuccess()) {
|
||||||
candidateCall.setUnmappedArguments(unmappedArguments);
|
candidateCall.addUnmappedArguments(unmappedArguments);
|
||||||
//For the expressions like '42.(f)()' where f: () -> Unit we'd like to generate an error 'no receiver admitted',
|
//For the expressions like '42.(f)()' where f: () -> Unit we'd like to generate an error 'no receiver admitted',
|
||||||
//not to throw away the candidate.
|
//not to throw away the candidate.
|
||||||
if (argumentMappingStatus == ValueArgumentsToParametersMapper.Status.STRONG_ERROR
|
if (argumentMappingStatus == ValueArgumentsToParametersMapper.Status.STRONG_ERROR
|
||||||
@@ -175,7 +174,7 @@ public class CandidateResolver {
|
|||||||
|
|
||||||
private static void markAllArgumentsAsUnmapped(CallCandidateResolutionContext<?> context) {
|
private static void markAllArgumentsAsUnmapped(CallCandidateResolutionContext<?> context) {
|
||||||
if (context.checkArguments == CheckValueArgumentsMode.ENABLED) {
|
if (context.checkArguments == CheckValueArgumentsMode.ENABLED) {
|
||||||
context.candidateCall.setUnmappedArguments(context.call.getValueArguments());
|
context.candidateCall.addUnmappedArguments(context.call.getValueArguments());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,7 +199,7 @@ public class CandidateResolver {
|
|||||||
public <D extends CallableDescriptor> void completeTypeInferenceDependentOnFunctionLiteralsForCall(
|
public <D extends CallableDescriptor> void completeTypeInferenceDependentOnFunctionLiteralsForCall(
|
||||||
CallCandidateResolutionContext<D> context
|
CallCandidateResolutionContext<D> context
|
||||||
) {
|
) {
|
||||||
ResolvedCallImpl<D> resolvedCall = context.candidateCall;
|
MutableResolvedCall<D> resolvedCall = context.candidateCall;
|
||||||
ConstraintSystem constraintSystem = resolvedCall.getConstraintSystem();
|
ConstraintSystem constraintSystem = resolvedCall.getConstraintSystem();
|
||||||
if (!resolvedCall.hasIncompleteTypeParameters() || constraintSystem == null) return;
|
if (!resolvedCall.hasIncompleteTypeParameters() || constraintSystem == null) return;
|
||||||
|
|
||||||
@@ -222,7 +221,7 @@ public class CandidateResolver {
|
|||||||
@NotNull CallCandidateResolutionContext<D> context,
|
@NotNull CallCandidateResolutionContext<D> context,
|
||||||
boolean isInnerCall
|
boolean isInnerCall
|
||||||
) {
|
) {
|
||||||
ResolvedCallImpl<D> resolvedCall = context.candidateCall;
|
MutableResolvedCall<D> resolvedCall = context.candidateCall;
|
||||||
if (!resolvedCall.hasIncompleteTypeParameters()) {
|
if (!resolvedCall.hasIncompleteTypeParameters()) {
|
||||||
completeNestedCallsInference(context);
|
completeNestedCallsInference(context);
|
||||||
checkValueArgumentTypes(context);
|
checkValueArgumentTypes(context);
|
||||||
@@ -252,7 +251,7 @@ public class CandidateResolver {
|
|||||||
// Here we type check the arguments with inferred types expected
|
// Here we type check the arguments with inferred types expected
|
||||||
checkAllValueArguments(context, context.trace, RESOLVE_FUNCTION_ARGUMENTS);
|
checkAllValueArguments(context, context.trace, RESOLVE_FUNCTION_ARGUMENTS);
|
||||||
|
|
||||||
resolvedCall.setHasUnknownTypeParameters(false);
|
resolvedCall.setHasIncompleteTypeParameters(false);
|
||||||
ResolutionStatus status = resolvedCall.getStatus();
|
ResolutionStatus status = resolvedCall.getStatus();
|
||||||
if (status == ResolutionStatus.UNKNOWN_STATUS || status == ResolutionStatus.INCOMPLETE_TYPE_INFERENCE) {
|
if (status == ResolutionStatus.UNKNOWN_STATUS || status == ResolutionStatus.INCOMPLETE_TYPE_INFERENCE) {
|
||||||
resolvedCall.setStatusToSuccess();
|
resolvedCall.setStatusToSuccess();
|
||||||
@@ -310,7 +309,7 @@ public class CandidateResolver {
|
|||||||
|
|
||||||
private static <D extends CallableDescriptor> void updateSystemWithConstraintSystemCompleter(
|
private static <D extends CallableDescriptor> void updateSystemWithConstraintSystemCompleter(
|
||||||
@NotNull CallCandidateResolutionContext<D> context,
|
@NotNull CallCandidateResolutionContext<D> context,
|
||||||
@NotNull ResolvedCallImpl<D> resolvedCall
|
@NotNull MutableResolvedCall<D> resolvedCall
|
||||||
) {
|
) {
|
||||||
ConstraintSystem constraintSystem = resolvedCall.getConstraintSystem();
|
ConstraintSystem constraintSystem = resolvedCall.getConstraintSystem();
|
||||||
assert constraintSystem != null;
|
assert constraintSystem != null;
|
||||||
@@ -330,7 +329,7 @@ public class CandidateResolver {
|
|||||||
|
|
||||||
private static <D extends CallableDescriptor> void updateSystemIfExpectedTypeIsUnit(
|
private static <D extends CallableDescriptor> void updateSystemIfExpectedTypeIsUnit(
|
||||||
@NotNull CallCandidateResolutionContext<D> context,
|
@NotNull CallCandidateResolutionContext<D> context,
|
||||||
@NotNull ResolvedCallImpl<D> resolvedCall
|
@NotNull MutableResolvedCall<D> resolvedCall
|
||||||
) {
|
) {
|
||||||
ConstraintSystem constraintSystem = resolvedCall.getConstraintSystem();
|
ConstraintSystem constraintSystem = resolvedCall.getConstraintSystem();
|
||||||
assert constraintSystem != null;
|
assert constraintSystem != null;
|
||||||
@@ -350,7 +349,7 @@ public class CandidateResolver {
|
|||||||
private <D extends CallableDescriptor> JetType reportInferenceError(
|
private <D extends CallableDescriptor> JetType reportInferenceError(
|
||||||
@NotNull CallCandidateResolutionContext<D> context
|
@NotNull CallCandidateResolutionContext<D> context
|
||||||
) {
|
) {
|
||||||
ResolvedCallImpl<D> resolvedCall = context.candidateCall;
|
MutableResolvedCall<D> resolvedCall = context.candidateCall;
|
||||||
ConstraintSystem constraintSystem = resolvedCall.getConstraintSystem();
|
ConstraintSystem constraintSystem = resolvedCall.getConstraintSystem();
|
||||||
assert constraintSystem != null;
|
assert constraintSystem != null;
|
||||||
|
|
||||||
@@ -372,7 +371,7 @@ public class CandidateResolver {
|
|||||||
@NotNull CallCandidateResolutionContext<D> context
|
@NotNull CallCandidateResolutionContext<D> context
|
||||||
) {
|
) {
|
||||||
if (CallResolverUtil.isInvokeCallOnVariable(context.call)) return;
|
if (CallResolverUtil.isInvokeCallOnVariable(context.call)) return;
|
||||||
ResolvedCallImpl<D> resolvedCall = context.candidateCall;
|
MutableResolvedCall<D> resolvedCall = context.candidateCall;
|
||||||
for (Map.Entry<ValueParameterDescriptor, ResolvedValueArgument> entry : resolvedCall.getValueArguments().entrySet()) {
|
for (Map.Entry<ValueParameterDescriptor, ResolvedValueArgument> entry : resolvedCall.getValueArguments().entrySet()) {
|
||||||
ValueParameterDescriptor parameterDescriptor = entry.getKey();
|
ValueParameterDescriptor parameterDescriptor = entry.getKey();
|
||||||
ResolvedValueArgument resolvedArgument = entry.getValue();
|
ResolvedValueArgument resolvedArgument = entry.getValue();
|
||||||
@@ -631,7 +630,7 @@ public class CandidateResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private <D extends CallableDescriptor> ResolutionStatus inferTypeArguments(CallCandidateResolutionContext<D> context) {
|
private <D extends CallableDescriptor> ResolutionStatus inferTypeArguments(CallCandidateResolutionContext<D> context) {
|
||||||
ResolvedCallImpl<D> candidateCall = context.candidateCall;
|
MutableResolvedCall<D> candidateCall = context.candidateCall;
|
||||||
final D candidate = candidateCall.getCandidateDescriptor();
|
final D candidate = candidateCall.getCandidateDescriptor();
|
||||||
|
|
||||||
context.trace.get(ResolutionDebugInfo.RESOLUTION_DEBUG_INFO, context.call.getCallElement());
|
context.trace.get(ResolutionDebugInfo.RESOLUTION_DEBUG_INFO, context.call.getCallElement());
|
||||||
@@ -706,7 +705,7 @@ public class CandidateResolver {
|
|||||||
|
|
||||||
// Solution
|
// Solution
|
||||||
boolean hasContradiction = constraintSystem.getStatus().hasContradiction();
|
boolean hasContradiction = constraintSystem.getStatus().hasContradiction();
|
||||||
candidateCall.setHasUnknownTypeParameters(true);
|
candidateCall.setHasIncompleteTypeParameters(true);
|
||||||
if (!hasContradiction) {
|
if (!hasContradiction) {
|
||||||
return INCOMPLETE_TYPE_INFERENCE;
|
return INCOMPLETE_TYPE_INFERENCE;
|
||||||
}
|
}
|
||||||
@@ -817,7 +816,7 @@ public class CandidateResolver {
|
|||||||
|
|
||||||
private <D extends CallableDescriptor, C extends CallResolutionContext<C>> ValueArgumentsCheckingResult checkValueArgumentTypes(
|
private <D extends CallableDescriptor, C extends CallResolutionContext<C>> ValueArgumentsCheckingResult checkValueArgumentTypes(
|
||||||
@NotNull CallResolutionContext<C> context,
|
@NotNull CallResolutionContext<C> context,
|
||||||
@NotNull ResolvedCallImpl<D> candidateCall,
|
@NotNull MutableResolvedCall<D> candidateCall,
|
||||||
@NotNull BindingTrace trace,
|
@NotNull BindingTrace trace,
|
||||||
@NotNull CallResolverUtil.ResolveArgumentsMode resolveFunctionArgumentBodies) {
|
@NotNull CallResolverUtil.ResolveArgumentsMode resolveFunctionArgumentBodies) {
|
||||||
ResolutionStatus resultStatus = SUCCESS;
|
ResolutionStatus resultStatus = SUCCESS;
|
||||||
@@ -893,7 +892,7 @@ public class CandidateResolver {
|
|||||||
private static <D extends CallableDescriptor> ResolutionStatus checkReceiverTypeError(
|
private static <D extends CallableDescriptor> ResolutionStatus checkReceiverTypeError(
|
||||||
@NotNull CallCandidateResolutionContext<D> context
|
@NotNull CallCandidateResolutionContext<D> context
|
||||||
) {
|
) {
|
||||||
ResolvedCallImpl<D> candidateCall = context.candidateCall;
|
MutableResolvedCall<D> candidateCall = context.candidateCall;
|
||||||
D candidateDescriptor = candidateCall.getCandidateDescriptor();
|
D candidateDescriptor = candidateCall.getCandidateDescriptor();
|
||||||
|
|
||||||
ReceiverParameterDescriptor receiverDescriptor = candidateDescriptor.getReceiverParameter();
|
ReceiverParameterDescriptor receiverDescriptor = candidateDescriptor.getReceiverParameter();
|
||||||
|
|||||||
+3
-3
@@ -71,7 +71,7 @@ import static org.jetbrains.jet.lang.resolve.calls.ValueArgumentsToParametersMap
|
|||||||
public static <D extends CallableDescriptor> Status mapValueArgumentsToParameters(
|
public static <D extends CallableDescriptor> Status mapValueArgumentsToParameters(
|
||||||
@NotNull Call call,
|
@NotNull Call call,
|
||||||
@NotNull TracingStrategy tracing,
|
@NotNull TracingStrategy tracing,
|
||||||
@NotNull ResolvedCallImpl<D> candidateCall,
|
@NotNull MutableResolvedCall<D> candidateCall,
|
||||||
@NotNull Set<ValueArgument> unmappedArguments
|
@NotNull Set<ValueArgument> unmappedArguments
|
||||||
) {
|
) {
|
||||||
//return new ValueArgumentsToParametersMapper().process(call, tracing, candidateCall, unmappedArguments);
|
//return new ValueArgumentsToParametersMapper().process(call, tracing, candidateCall, unmappedArguments);
|
||||||
@@ -84,7 +84,7 @@ import static org.jetbrains.jet.lang.resolve.calls.ValueArgumentsToParametersMap
|
|||||||
private static class Processor<D extends CallableDescriptor> {
|
private static class Processor<D extends CallableDescriptor> {
|
||||||
private final Call call;
|
private final Call call;
|
||||||
private final TracingStrategy tracing;
|
private final TracingStrategy tracing;
|
||||||
private final ResolvedCallImpl<D> candidateCall;
|
private final MutableResolvedCall<D> candidateCall;
|
||||||
|
|
||||||
private final Map<Name,ValueParameterDescriptor> parameterByName;
|
private final Map<Name,ValueParameterDescriptor> parameterByName;
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ import static org.jetbrains.jet.lang.resolve.calls.ValueArgumentsToParametersMap
|
|||||||
private final Set<ValueParameterDescriptor> usedParameters = Sets.newHashSet();
|
private final Set<ValueParameterDescriptor> usedParameters = Sets.newHashSet();
|
||||||
private Status status = OK;
|
private Status status = OK;
|
||||||
|
|
||||||
private Processor(@NotNull Call call, @NotNull ResolvedCallImpl<D> candidateCall, @NotNull TracingStrategy tracing) {
|
private Processor(@NotNull Call call, @NotNull MutableResolvedCall<D> candidateCall, @NotNull TracingStrategy tracing) {
|
||||||
this.call = call;
|
this.call = call;
|
||||||
this.tracing = tracing;
|
this.tracing = tracing;
|
||||||
this.candidateCall = candidateCall;
|
this.candidateCall = candidateCall;
|
||||||
|
|||||||
+7
-7
@@ -24,7 +24,7 @@ import org.jetbrains.jet.lang.resolve.BindingTrace;
|
|||||||
import org.jetbrains.jet.lang.resolve.calls.CallResolverExtension;
|
import org.jetbrains.jet.lang.resolve.calls.CallResolverExtension;
|
||||||
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
|
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
|
||||||
import org.jetbrains.jet.lang.resolve.calls.model.MutableDataFlowInfoForArguments;
|
import org.jetbrains.jet.lang.resolve.calls.model.MutableDataFlowInfoForArguments;
|
||||||
import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCallImpl;
|
import org.jetbrains.jet.lang.resolve.calls.model.MutableResolvedCall;
|
||||||
import org.jetbrains.jet.lang.resolve.calls.tasks.TracingStrategy;
|
import org.jetbrains.jet.lang.resolve.calls.tasks.TracingStrategy;
|
||||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||||
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue;
|
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue;
|
||||||
@@ -32,12 +32,12 @@ import org.jetbrains.jet.lang.types.JetType;
|
|||||||
import org.jetbrains.jet.lang.types.expressions.LabelResolver;
|
import org.jetbrains.jet.lang.types.expressions.LabelResolver;
|
||||||
|
|
||||||
public final class CallCandidateResolutionContext<D extends CallableDescriptor> extends CallResolutionContext<CallCandidateResolutionContext<D>> {
|
public final class CallCandidateResolutionContext<D extends CallableDescriptor> extends CallResolutionContext<CallCandidateResolutionContext<D>> {
|
||||||
public final ResolvedCallImpl<D> candidateCall;
|
public final MutableResolvedCall<D> candidateCall;
|
||||||
public final TracingStrategy tracing;
|
public final TracingStrategy tracing;
|
||||||
public final ReceiverValue explicitExtensionReceiverForInvoke;
|
public final ReceiverValue explicitExtensionReceiverForInvoke;
|
||||||
|
|
||||||
private CallCandidateResolutionContext(
|
private CallCandidateResolutionContext(
|
||||||
@NotNull ResolvedCallImpl<D> candidateCall,
|
@NotNull MutableResolvedCall<D> candidateCall,
|
||||||
@NotNull TracingStrategy tracing,
|
@NotNull TracingStrategy tracing,
|
||||||
@NotNull BindingTrace trace,
|
@NotNull BindingTrace trace,
|
||||||
@NotNull JetScope scope,
|
@NotNull JetScope scope,
|
||||||
@@ -62,7 +62,7 @@ public final class CallCandidateResolutionContext<D extends CallableDescriptor>
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static <D extends CallableDescriptor> CallCandidateResolutionContext<D> create(
|
public static <D extends CallableDescriptor> CallCandidateResolutionContext<D> create(
|
||||||
@NotNull ResolvedCallImpl<D> candidateCall, @NotNull CallResolutionContext<?> context, @NotNull BindingTrace trace,
|
@NotNull MutableResolvedCall<D> candidateCall, @NotNull CallResolutionContext<?> context, @NotNull BindingTrace trace,
|
||||||
@NotNull TracingStrategy tracing, @NotNull Call call, @NotNull ReceiverValue explicitExtensionReceiverForInvoke
|
@NotNull TracingStrategy tracing, @NotNull Call call, @NotNull ReceiverValue explicitExtensionReceiverForInvoke
|
||||||
) {
|
) {
|
||||||
candidateCall.setInitialDataFlowInfo(context.dataFlowInfo);
|
candidateCall.setInitialDataFlowInfo(context.dataFlowInfo);
|
||||||
@@ -74,20 +74,20 @@ public final class CallCandidateResolutionContext<D extends CallableDescriptor>
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static <D extends CallableDescriptor> CallCandidateResolutionContext<D> create(
|
public static <D extends CallableDescriptor> CallCandidateResolutionContext<D> create(
|
||||||
@NotNull ResolvedCallImpl<D> candidateCall, @NotNull CallResolutionContext<?> context, @NotNull BindingTrace trace,
|
@NotNull MutableResolvedCall<D> candidateCall, @NotNull CallResolutionContext<?> context, @NotNull BindingTrace trace,
|
||||||
@NotNull TracingStrategy tracing, @NotNull Call call
|
@NotNull TracingStrategy tracing, @NotNull Call call
|
||||||
) {
|
) {
|
||||||
return create(candidateCall, context, trace, tracing, call, ReceiverValue.NO_RECEIVER);
|
return create(candidateCall, context, trace, tracing, call, ReceiverValue.NO_RECEIVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <D extends CallableDescriptor> CallCandidateResolutionContext<D> create(
|
public static <D extends CallableDescriptor> CallCandidateResolutionContext<D> create(
|
||||||
@NotNull ResolvedCallImpl<D> candidateCall, @NotNull CallResolutionContext<?> context, @NotNull BindingTrace trace,
|
@NotNull MutableResolvedCall<D> candidateCall, @NotNull CallResolutionContext<?> context, @NotNull BindingTrace trace,
|
||||||
@NotNull TracingStrategy tracing) {
|
@NotNull TracingStrategy tracing) {
|
||||||
return create(candidateCall, context, trace, tracing, context.call);
|
return create(candidateCall, context, trace, tracing, context.call);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <D extends CallableDescriptor> CallCandidateResolutionContext<D> createForCallBeingAnalyzed(
|
public static <D extends CallableDescriptor> CallCandidateResolutionContext<D> createForCallBeingAnalyzed(
|
||||||
@NotNull ResolvedCallImpl<D> candidateCall, @NotNull BasicCallResolutionContext context, @NotNull TracingStrategy tracing
|
@NotNull MutableResolvedCall<D> candidateCall, @NotNull BasicCallResolutionContext context, @NotNull TracingStrategy tracing
|
||||||
) {
|
) {
|
||||||
return new CallCandidateResolutionContext<D>(
|
return new CallCandidateResolutionContext<D>(
|
||||||
candidateCall, tracing, context.trace, context.scope, context.call, context.expectedType,
|
candidateCall, tracing, context.trace, context.scope, context.call, context.expectedType,
|
||||||
|
|||||||
+46
@@ -17,25 +17,44 @@
|
|||||||
package org.jetbrains.jet.lang.resolve.calls.model;
|
package org.jetbrains.jet.lang.resolve.calls.model;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
|
import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor;
|
||||||
|
import org.jetbrains.jet.lang.psi.ValueArgument;
|
||||||
import org.jetbrains.jet.lang.resolve.DelegatingBindingTrace;
|
import org.jetbrains.jet.lang.resolve.DelegatingBindingTrace;
|
||||||
|
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
|
||||||
|
import org.jetbrains.jet.lang.resolve.calls.inference.ConstraintSystem;
|
||||||
import org.jetbrains.jet.lang.resolve.calls.results.ResolutionStatus;
|
import org.jetbrains.jet.lang.resolve.calls.results.ResolutionStatus;
|
||||||
|
import org.jetbrains.jet.lang.types.TypeSubstitutor;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public interface MutableResolvedCall<D extends CallableDescriptor> extends ResolvedCall<D> {
|
public interface MutableResolvedCall<D extends CallableDescriptor> extends ResolvedCall<D> {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
ResolutionStatus getStatus();
|
ResolutionStatus getStatus();
|
||||||
|
|
||||||
|
void addStatus(@NotNull ResolutionStatus status);
|
||||||
|
|
||||||
|
void setStatusToSuccess();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolved call can have incomplete type parameters
|
* Resolved call can have incomplete type parameters
|
||||||
* if ResolutionStatus is INCOMPLETE_TYPE_INFERENCE (might be completed successfully)
|
* if ResolutionStatus is INCOMPLETE_TYPE_INFERENCE (might be completed successfully)
|
||||||
* or OTHER_ERROR (cannot be completed successfully, but if there's only one candidate, should be completed anyway).
|
* or OTHER_ERROR (cannot be completed successfully, but if there's only one candidate, should be completed anyway).
|
||||||
* @return true if resolved call has unknown type parameters (inference is incomplete)
|
* @return true if resolved call has unknown type parameters (inference is incomplete)
|
||||||
*/
|
*/
|
||||||
|
//todo remove, replace with "typeArguments.isEmpty() && !typeParameters.isEmpty()"
|
||||||
boolean hasIncompleteTypeParameters();
|
boolean hasIncompleteTypeParameters();
|
||||||
|
|
||||||
|
void setHasIncompleteTypeParameters(boolean hasIncompleteTypeParameters);
|
||||||
|
|
||||||
|
//todo remove: use value to parameter map status
|
||||||
boolean isDirty();
|
boolean isDirty();
|
||||||
|
|
||||||
|
void argumentHasNoType();
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
DelegatingBindingTrace getTrace();
|
DelegatingBindingTrace getTrace();
|
||||||
|
|
||||||
@@ -50,4 +69,31 @@ public interface MutableResolvedCall<D extends CallableDescriptor> extends Resol
|
|||||||
void markCallAsCompleted();
|
void markCallAsCompleted();
|
||||||
|
|
||||||
boolean isCompleted();
|
boolean isCompleted();
|
||||||
|
|
||||||
|
|
||||||
|
void recordValueArgument(@NotNull ValueParameterDescriptor valueParameter, @NotNull ResolvedValueArgument valueArgument);
|
||||||
|
|
||||||
|
void recordArgumentMatch(@NotNull ValueArgument valueArgument, @NotNull ValueParameterDescriptor parameter, boolean hasTypeMismatch);
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
Set<ValueArgument> getUnmappedArguments();
|
||||||
|
|
||||||
|
void addUnmappedArguments(@NotNull Collection<? extends ValueArgument> unmappedArguments);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@NotNull
|
||||||
|
MutableDataFlowInfoForArguments getDataFlowInfoForArguments();
|
||||||
|
|
||||||
|
void setInitialDataFlowInfo(@NotNull DataFlowInfo info);
|
||||||
|
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
ConstraintSystem getConstraintSystem();
|
||||||
|
|
||||||
|
void setConstraintSystem(@NotNull ConstraintSystem constraintSystem);
|
||||||
|
|
||||||
|
void setResultingSubstitutor(@NotNull TypeSubstitutor substitutor);
|
||||||
|
|
||||||
|
//todo remove: use value to parameter map status
|
||||||
|
boolean hasInferredReturnType();
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-3
@@ -116,10 +116,12 @@ public class ResolvedCallImpl<D extends CallableDescriptor> implements MutableRe
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addStatus(@NotNull ResolutionStatus status) {
|
public void addStatus(@NotNull ResolutionStatus status) {
|
||||||
this.status = this.status.combine(status);
|
this.status = this.status.combine(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setStatusToSuccess() {
|
public void setStatusToSuccess() {
|
||||||
assert status == INCOMPLETE_TYPE_INFERENCE || status == UNKNOWN_STATUS;
|
assert status == INCOMPLETE_TYPE_INFERENCE || status == UNKNOWN_STATUS;
|
||||||
status = ResolutionStatus.SUCCESS;
|
status = ResolutionStatus.SUCCESS;
|
||||||
@@ -130,8 +132,9 @@ public class ResolvedCallImpl<D extends CallableDescriptor> implements MutableRe
|
|||||||
return hasUnknownTypeParameters;
|
return hasUnknownTypeParameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHasUnknownTypeParameters(boolean hasUnknownTypeParameters) {
|
@Override
|
||||||
this.hasUnknownTypeParameters = hasUnknownTypeParameters;
|
public void setHasIncompleteTypeParameters(boolean hasIncompleteTypeParameters) {
|
||||||
|
this.hasUnknownTypeParameters = hasIncompleteTypeParameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -165,6 +168,7 @@ public class ResolvedCallImpl<D extends CallableDescriptor> implements MutableRe
|
|||||||
return resultingDescriptor == null ? candidateDescriptor : resultingDescriptor;
|
return resultingDescriptor == null ? candidateDescriptor : resultingDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setResultingSubstitutor(@NotNull TypeSubstitutor substitutor) {
|
public void setResultingSubstitutor(@NotNull TypeSubstitutor substitutor) {
|
||||||
resultingDescriptor = (D) candidateDescriptor.substitute(substitutor);
|
resultingDescriptor = (D) candidateDescriptor.substitute(substitutor);
|
||||||
assert resultingDescriptor != null : candidateDescriptor;
|
assert resultingDescriptor != null : candidateDescriptor;
|
||||||
@@ -190,26 +194,31 @@ public class ResolvedCallImpl<D extends CallableDescriptor> implements MutableRe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setConstraintSystem(@NotNull ConstraintSystem constraintSystem) {
|
public void setConstraintSystem(@NotNull ConstraintSystem constraintSystem) {
|
||||||
this.constraintSystem = constraintSystem;
|
this.constraintSystem = constraintSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@Override
|
||||||
public ConstraintSystem getConstraintSystem() {
|
public ConstraintSystem getConstraintSystem() {
|
||||||
assertNotCompleted("ConstraintSystem");
|
assertNotCompleted("ConstraintSystem");
|
||||||
return constraintSystem;
|
return constraintSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void recordValueArgument(@NotNull ValueParameterDescriptor valueParameter, @NotNull ResolvedValueArgument valueArgument) {
|
public void recordValueArgument(@NotNull ValueParameterDescriptor valueParameter, @NotNull ResolvedValueArgument valueArgument) {
|
||||||
assert !valueArguments.containsKey(valueParameter) : valueParameter + " -> " + valueArgument;
|
assert !valueArguments.containsKey(valueParameter) : valueParameter + " -> " + valueArgument;
|
||||||
valueArguments.put(valueParameter, valueArgument);
|
valueArguments.put(valueParameter, valueArgument);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUnmappedArguments(@NotNull Collection<? extends ValueArgument> unmappedArguments) {
|
@Override
|
||||||
|
public void addUnmappedArguments(@NotNull Collection<? extends ValueArgument> unmappedArguments) {
|
||||||
this.unmappedArguments.addAll(unmappedArguments);
|
this.unmappedArguments.addAll(unmappedArguments);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public Set<ValueArgument> getUnmappedArguments() {
|
public Set<ValueArgument> getUnmappedArguments() {
|
||||||
return unmappedArguments;
|
return unmappedArguments;
|
||||||
@@ -266,6 +275,7 @@ public class ResolvedCallImpl<D extends CallableDescriptor> implements MutableRe
|
|||||||
return arguments;
|
return arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void recordArgumentMatch(
|
public void recordArgumentMatch(
|
||||||
@NotNull ValueArgument valueArgument, @NotNull ValueParameterDescriptor parameter, boolean hasTypeMismatch
|
@NotNull ValueArgument valueArgument, @NotNull ValueParameterDescriptor parameter, boolean hasTypeMismatch
|
||||||
) {
|
) {
|
||||||
@@ -282,6 +292,7 @@ public class ResolvedCallImpl<D extends CallableDescriptor> implements MutableRe
|
|||||||
return argumentMatch;
|
return argumentMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void argumentHasNoType() {
|
public void argumentHasNoType() {
|
||||||
this.someArgumentHasNoType = true;
|
this.someArgumentHasNoType = true;
|
||||||
}
|
}
|
||||||
@@ -302,6 +313,7 @@ public class ResolvedCallImpl<D extends CallableDescriptor> implements MutableRe
|
|||||||
return isSafeCall;
|
return isSafeCall;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setInitialDataFlowInfo(@NotNull DataFlowInfo info) {
|
public void setInitialDataFlowInfo(@NotNull DataFlowInfo info) {
|
||||||
dataFlowInfoForArguments.setInitialDataFlowInfo(info);
|
dataFlowInfoForArguments.setInitialDataFlowInfo(info);
|
||||||
}
|
}
|
||||||
@@ -318,6 +330,7 @@ public class ResolvedCallImpl<D extends CallableDescriptor> implements MutableRe
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasInferredReturnType() {
|
public boolean hasInferredReturnType() {
|
||||||
if (!completed) {
|
if (!completed) {
|
||||||
hasInferredReturnType = constraintSystem == null || CallResolverUtil.hasInferredReturnType(candidateDescriptor, constraintSystem);
|
hasInferredReturnType = constraintSystem == null || CallResolverUtil.hasInferredReturnType(candidateDescriptor, constraintSystem);
|
||||||
|
|||||||
Reference in New Issue
Block a user