method ref: ensure top substitutor is not overridden with raw replacement from second method ref search (IDEA-158636)

This commit is contained in:
Anna.Kozlova
2016-07-18 14:57:04 +02:00
parent e032fa974a
commit 3ee60dba1d
3 changed files with 18 additions and 1 deletions
@@ -1599,7 +1599,7 @@ public class InferenceSession {
return receiverSubstitutor;
}
}
mySiteSubstitutor = receiverSubstitutor;
mySiteSubstitutor = mySiteSubstitutor.putAll(receiverSubstitutor);
if (methodContainingClass != null) {
final PsiSubstitutor superSubstitutor = TypeConversionUtil.getClassSubstitutor(methodContainingClass, containingClass, receiverSubstitutor);
@@ -0,0 +1,13 @@
package pi;
import java.util.stream.Stream;
abstract class Foo<T> {
public abstract <X> Foo<X> getAssociatedFoo();
public abstract static class Bar<Z> {
public Stream<Foo<Object>> getAssociatedFoos(Stream<Foo<Z>> stream) {
return stream.map(Foo::getAssociatedFoo);
}
}
}
@@ -518,6 +518,10 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
doTest();
}
public void testMethodReferenceSecondSearchDontInfluenceTopSiteSubstitutor() throws Exception {
doTest();
}
private void doTest() {
doTest(false);
}