method refs: missed qualifier substitution for return type (IDEA-140539)

This commit is contained in:
Anna Kozlova
2015-05-21 14:11:26 +02:00
parent a4030467cc
commit db72cccc97
3 changed files with 15 additions and 1 deletions
@@ -184,7 +184,7 @@ public class PsiMethodReferenceCompatibilityConstraint implements ConstraintForm
//the constraint reduces to the bound set B3 which would be used to determine the method reference's invocation type
//when targeting the return type of the function type, as defined in 18.5.2.
session.collectApplicabilityConstraints(myExpression, ((MethodCandidateInfo)resolve), groundTargetType);
session.registerReturnTypeConstraints(referencedMethodReturnType, returnType);
session.registerReturnTypeConstraints(psiSubstitutor.substitute(referencedMethodReturnType), returnType);
return true;
}
}
@@ -0,0 +1,10 @@
import java.util.function.Function;
class Test {
private void foo(final Function<String, String> steps) {
map(steps::compose);
}
<U> void map(Function<Function<String, String>, U> mapper) {}
}
@@ -402,6 +402,10 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
doTest();
}
public void testSubstitutionForReturnTypeConstraintsForTargetGenericMethod() throws Exception {
doTest();
}
private void doTest() {
doTest(false);
}