analyze all arguments with unknown expected type
in the beginning of call resolution process
This commit is contained in:
@@ -29,6 +29,7 @@ import org.jetbrains.jet.lang.resolve.calls.context.CallResolutionContext;
|
||||
import org.jetbrains.jet.lang.resolve.calls.context.CheckValueArgumentsMode;
|
||||
import org.jetbrains.jet.lang.resolve.calls.context.ResolutionContext;
|
||||
import org.jetbrains.jet.lang.resolve.calls.context.ContextDependency;
|
||||
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.ResolvedValueArgument;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||
@@ -231,4 +232,20 @@ public class ArgumentTypeResolver {
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public <D extends CallableDescriptor> void analyzeArgumentsAndRecordTypes(
|
||||
@NotNull CallResolutionContext<?> context
|
||||
) {
|
||||
MutableDataFlowInfoForArguments infoForArguments = context.dataFlowInfoForArguments;
|
||||
infoForArguments.setInitialDataFlowInfo(context.dataFlowInfo);
|
||||
|
||||
for (ValueArgument argument : context.call.getValueArguments()) {
|
||||
JetExpression expression = argument.getArgumentExpression();
|
||||
if (expression == null) continue;
|
||||
|
||||
CallResolutionContext<?> newContext = context.replaceDataFlowInfo(infoForArguments.getInfo(argument));
|
||||
JetTypeInfo typeInfoForCall = getArgumentTypeInfo(expression, newContext, SKIP_FUNCTION_ARGUMENTS);
|
||||
infoForArguments.updateInfo(argument, typeInfoForCall.getDataFlowInfo());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,6 +426,10 @@ public class CallResolver {
|
||||
|
||||
debugInfo.set(ResolutionDebugInfo.TASKS, prioritizedTasks);
|
||||
|
||||
if (context.checkArguments == CheckValueArgumentsMode.ENABLED) {
|
||||
argumentTypeResolver.analyzeArgumentsAndRecordTypes(context);
|
||||
}
|
||||
|
||||
TemporaryBindingTrace traceForFirstNonemptyCandidateSet = null;
|
||||
OverloadResolutionResultsImpl<F> resultsForFirstNonemptyCandidateSet = null;
|
||||
for (ResolutionTask<D, F> task : prioritizedTasks) {
|
||||
|
||||
Reference in New Issue
Block a user