Drop unneeded condition that leads to error

This check is obsolete but leads to problems.

It appears when resolving recursive calls (see sameTypeParameterUse.kt):

`foo<R>(x: R, y: R)` within call `foo<R>(x, "")` after substitution
has R as type of it's second argument, and when checking value arguments,
x is not checked because supposed to be dependent on type parameter of candidate
(that is effectively false), so there are two successful candidates
in resolution results and wrong OVERLOAD_RESOLUTION_AMBIGUITY error.
This commit is contained in:
Denis Zharkov
2015-03-15 18:34:58 +03:00
parent 682f8a3110
commit 9cecd69a9e
4 changed files with 34 additions and 3 deletions
@@ -516,9 +516,6 @@ public class CandidateResolver {
if (expression == null) continue;
JetType expectedType = getEffectiveExpectedType(parameterDescriptor, argument);
if (TypeUtils.dependsOnTypeParameters(expectedType, candidateCall.getCandidateDescriptor().getTypeParameters())) {
expectedType = NO_EXPECTED_TYPE;
}
CallResolutionContext<?> newContext = context.replaceDataFlowInfo(infoForArguments.getInfo(argument))
.replaceBindingTrace(trace).replaceExpectedType(expectedType);