Fixed bug: do not lose all candidates when updating status
to success
This commit is contained in:
@@ -406,7 +406,7 @@ public class CallResolver {
|
|||||||
candidateResolver.completeTypeInferenceForAllCandidates(context, results);
|
candidateResolver.completeTypeInferenceForAllCandidates(context, results);
|
||||||
|
|
||||||
if (resolvedCall.getStatus().isSuccess()) {
|
if (resolvedCall.getStatus().isSuccess()) {
|
||||||
return OverloadResolutionResultsImpl.success(resolvedCall);
|
return results.changeStatusToSuccess();
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|||||||
+11
@@ -140,4 +140,15 @@ public class OverloadResolutionResultsImpl<D extends CallableDescriptor> impleme
|
|||||||
public Collection<ResolvedCall<D>> getAllCandidates() {
|
public Collection<ResolvedCall<D>> getAllCandidates() {
|
||||||
return allCandidates;
|
return allCandidates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OverloadResolutionResultsImpl<D> changeStatusToSuccess() {
|
||||||
|
if (getResultCode() == Code.SUCCESS) return this;
|
||||||
|
|
||||||
|
assert isSingleResult() && getResultCode() == Code.INCOMPLETE_TYPE_INFERENCE :
|
||||||
|
"Only incomplete type inference status with one candidate can be changed to success: " +
|
||||||
|
getResultCode() + "\n" + getResultingCalls();
|
||||||
|
OverloadResolutionResultsImpl<D> newResults = new OverloadResolutionResultsImpl<D>(Code.SUCCESS, getResultingCalls());
|
||||||
|
newResults.setAllCandidates(getAllCandidates());
|
||||||
|
return newResults;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user