new inference: restore cache after use

This commit is contained in:
Anna Kozlova
2014-08-06 12:28:03 +02:00
parent b878d04288
commit 5f361c8614
3 changed files with 31 additions and 5 deletions

View File

@@ -143,7 +143,11 @@ public class MethodCandidateInfo extends CandidateInfo{
return applicabilityLevel;
}
finally {
if (alreadyThere == null) map.remove(getMarkerList());
if (alreadyThere == null) {
map.remove(getMarkerList());
} else {
map.put(getMarkerList(), alreadyThere);
}
}
}
return getApplicabilityLevelInner();
@@ -269,10 +273,8 @@ public class MethodCandidateInfo extends CandidateInfo{
CURRENT_CANDIDATE.set(map);
}
final PsiMethod method = getElement();
final CurrentCandidateProperties alreadyThere = map.get(getMarkerList());
if (alreadyThere == null) {
final CurrentCandidateProperties alreadyThere =
map.put(getMarkerList(), new CurrentCandidateProperties(method, super.getSubstitutor(), isVarargs(), !includeReturnConstraint));
}
try {
PsiTypeParameter[] typeParameters = method.getTypeParameters();
@@ -293,7 +295,11 @@ public class MethodCandidateInfo extends CandidateInfo{
.inferTypeArguments(typeParameters, method.getParameterList().getParameters(), arguments, mySubstitutor, parent, policy, myLanguageLevel);
}
finally {
if (alreadyThere == null) map.remove(getMarkerList());
if (alreadyThere == null) {
map.remove(getMarkerList());
} else {
map.put(getMarkerList(), alreadyThere);
}
}
}

View File

@@ -0,0 +1,16 @@
import java.util.List;
import java.util.Set;
abstract class Overloadsss {
abstract <T> List<T> foo(List<T> l);
abstract <T> Set<T> foo(Set<T> s);
abstract <K> List<K> bar(List<K> l);
abstract <K> List<K> bar1(List<K> l);
abstract <K> Set<K> bar1(Set<K> s);
{
List<String> l = foo(bar (null));
List<String> l1 = foo(bar1<error descr="Ambiguous method call: both 'Overloadsss.bar1(List<Object>)' and 'Overloadsss.bar1(Set<Object>)' match">(null)</error>);
}
}

View File

@@ -204,6 +204,10 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
doTest();
}
public void testOuterCallOverloads() throws Exception {
doTest();
}
private void doTest() throws Exception {
doTest(false);
}