Proper resolved calls in loop ranges

This commit is contained in:
Andrey Breslav
2012-08-23 18:46:16 +04:00
parent 784bf31a3e
commit e13fa067cc
3 changed files with 8 additions and 7 deletions
@@ -1132,6 +1132,7 @@ public class CallResolver {
}
}
@Deprecated // Creates wrong resolved calls, should be removed
@NotNull
public OverloadResolutionResults<FunctionDescriptor> resolveExactSignature(@NotNull JetScope scope, @NotNull ReceiverDescriptor receiver, @NotNull Name name, @NotNull List<JetType> parameterTypes) {
List<ResolutionCandidate<FunctionDescriptor>> candidates = findCandidatesByExactSignature(scope, receiver, name, parameterTypes);
@@ -384,11 +384,10 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor {
@NotNull String name,
@NotNull SimpleDiagnosticFactory<JetExpression> ambiguity,
@NotNull SimpleDiagnosticFactory<JetExpression> missing,
@NotNull WritableSlice<JetExpression, ResolvedCall<FunctionDescriptor>> call
@NotNull WritableSlice<JetExpression, ResolvedCall<FunctionDescriptor>> resolvedCallKey
) {
OverloadResolutionResults<FunctionDescriptor>
nextResolutionResults = context.resolveExactSignature(new TransientReceiver(iteratorType), Name.identifier(name), Collections
.<JetType>emptyList());
OverloadResolutionResults<FunctionDescriptor> nextResolutionResults = resolveFakeCall(
new TransientReceiver(iteratorType), context, Name.identifier(name));
if (nextResolutionResults.isAmbiguity()) {
context.trace.report(ambiguity.on(loopRangeExpression));
}
@@ -396,9 +395,9 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor {
context.trace.report(missing.on(loopRangeExpression));
}
else {
ResolvedCall<FunctionDescriptor> nextCall = nextResolutionResults.getResultingCall();
context.trace.record(call, loopRangeExpression, nextCall);
return nextCall.getResultingDescriptor().getReturnType();
ResolvedCall<FunctionDescriptor> resolvedCall = nextResolutionResults.getResultingCall();
context.trace.record(resolvedCallKey, loopRangeExpression, resolvedCall);
return resolvedCall.getResultingDescriptor().getReturnType();
}
return null;
}
@@ -174,6 +174,7 @@ public class ExpressionTypingContext {
return expressionTypingServices.getCallResolver().resolveSimpleProperty(makeResolutionContext(call));
}
@Deprecated // Builds wrong resolved calls, should be removed
@NotNull
public OverloadResolutionResults<FunctionDescriptor> resolveExactSignature(@NotNull ReceiverDescriptor receiver, @NotNull Name name, @NotNull List<JetType> parameterTypes) {
return expressionTypingServices.getCallResolver().resolveExactSignature(scope, receiver, name, parameterTypes);