analyze all arguments with unknown expected type

in the beginning of call resolution process
This commit is contained in:
Svetlana Isakova
2013-08-16 18:32:20 +04:00
parent c8fc2c882d
commit 30b0a72c6b
5 changed files with 25 additions and 4 deletions
@@ -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) {