check resulting type for inner call
while completeValueArgumentsInference
This commit is contained in:
@@ -342,7 +342,7 @@ public class CallResolver {
|
|||||||
ResolvedCallImpl<D> copy = CallResolverUtil.copy((ResolvedCallImpl<D>) resolvedCall, context);
|
ResolvedCallImpl<D> copy = CallResolverUtil.copy((ResolvedCallImpl<D>) resolvedCall, context);
|
||||||
CallCandidateResolutionContext<D> callCandidateResolutionContext =
|
CallCandidateResolutionContext<D> callCandidateResolutionContext =
|
||||||
CallCandidateResolutionContext.createForCallBeingAnalyzed(copy, context, tracing);
|
CallCandidateResolutionContext.createForCallBeingAnalyzed(copy, context, tracing);
|
||||||
candidateResolver.completeTypeInferenceDependentOnExpectedTypeForCall(callCandidateResolutionContext);
|
candidateResolver.completeTypeInferenceDependentOnExpectedTypeForCall(callCandidateResolutionContext, false);
|
||||||
|
|
||||||
if (copy.getStatus().isSuccess()) {
|
if (copy.getStatus().isSuccess()) {
|
||||||
return OverloadResolutionResultsImpl.success(copy);
|
return OverloadResolutionResultsImpl.success(copy);
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import com.google.common.collect.Lists;
|
|||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.intellij.openapi.progress.ProgressIndicatorProvider;
|
import com.intellij.openapi.progress.ProgressIndicatorProvider;
|
||||||
|
import com.intellij.psi.PsiElement;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.lang.descriptors.*;
|
import org.jetbrains.jet.lang.descriptors.*;
|
||||||
@@ -42,6 +43,7 @@ import org.jetbrains.jet.lang.resolve.calls.tasks.TaskPrioritizer;
|
|||||||
import org.jetbrains.jet.lang.resolve.scopes.receivers.ExpressionReceiver;
|
import org.jetbrains.jet.lang.resolve.scopes.receivers.ExpressionReceiver;
|
||||||
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue;
|
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue;
|
||||||
import org.jetbrains.jet.lang.types.*;
|
import org.jetbrains.jet.lang.types.*;
|
||||||
|
import org.jetbrains.jet.lang.types.expressions.DataFlowUtils;
|
||||||
import org.jetbrains.jet.lang.types.expressions.ExpressionTypingUtils;
|
import org.jetbrains.jet.lang.types.expressions.ExpressionTypingUtils;
|
||||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||||
|
|
||||||
@@ -213,7 +215,8 @@ public class CandidateResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public <D extends CallableDescriptor> void completeTypeInferenceDependentOnExpectedTypeForCall(
|
public <D extends CallableDescriptor> void completeTypeInferenceDependentOnExpectedTypeForCall(
|
||||||
CallCandidateResolutionContext<D> context
|
@NotNull CallCandidateResolutionContext<D> context,
|
||||||
|
boolean isInnerCall
|
||||||
) {
|
) {
|
||||||
ResolvedCallImpl<D> resolvedCall = context.candidateCall;
|
ResolvedCallImpl<D> resolvedCall = context.candidateCall;
|
||||||
assert resolvedCall.hasUnknownTypeParameters();
|
assert resolvedCall.hasUnknownTypeParameters();
|
||||||
@@ -264,6 +267,12 @@ public class CandidateResolver {
|
|||||||
if (status == ResolutionStatus.UNKNOWN_STATUS || status == ResolutionStatus.INCOMPLETE_TYPE_INFERENCE) {
|
if (status == ResolutionStatus.UNKNOWN_STATUS || status == ResolutionStatus.INCOMPLETE_TYPE_INFERENCE) {
|
||||||
resolvedCall.setStatusToSuccess();
|
resolvedCall.setStatusToSuccess();
|
||||||
}
|
}
|
||||||
|
if (isInnerCall) {
|
||||||
|
PsiElement callElement = context.call.getCallElement();
|
||||||
|
if (callElement instanceof JetCallExpression) {
|
||||||
|
DataFlowUtils.checkType(resolvedCall.getResultingDescriptor().getReturnType(), (JetCallExpression) callElement, context, context.dataFlowInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public <D extends CallableDescriptor> void completeValueArgumentsInference(
|
public <D extends CallableDescriptor> void completeValueArgumentsInference(
|
||||||
@@ -291,7 +300,7 @@ public class CandidateResolver {
|
|||||||
CallCandidateResolutionContext<FunctionDescriptor> contextForArgument =
|
CallCandidateResolutionContext<FunctionDescriptor> contextForArgument =
|
||||||
storedContextForArgument.replaceResolveMode(ResolveMode.NORMAL).replaceBindingTrace(context.trace).replaceExpectedType(expectedType);
|
storedContextForArgument.replaceResolveMode(ResolveMode.NORMAL).replaceBindingTrace(context.trace).replaceExpectedType(expectedType);
|
||||||
if (contextForArgument.candidateCall.hasUnknownTypeParameters()) {
|
if (contextForArgument.candidateCall.hasUnknownTypeParameters()) {
|
||||||
completeTypeInferenceDependentOnExpectedTypeForCall(contextForArgument);
|
completeTypeInferenceDependentOnExpectedTypeForCall(contextForArgument, true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
completeValueArgumentsInference(contextForArgument);
|
completeValueArgumentsInference(contextForArgument);
|
||||||
|
|||||||
Reference in New Issue
Block a user