mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
inference: ensure nested methods lift their bounds (IDEA-122681)
This commit is contained in:
@@ -245,12 +245,12 @@ public class InferenceSession {
|
||||
return prepareSubstitution();
|
||||
}
|
||||
|
||||
private static void collectAdditionalConstraints(PsiParameter[] parameters,
|
||||
PsiExpression[] args,
|
||||
PsiMethod parentMethod,
|
||||
PsiSubstitutor siteSubstitutor,
|
||||
Set<ConstraintFormula> additionalConstraints,
|
||||
boolean varargs) {
|
||||
private void collectAdditionalConstraints(PsiParameter[] parameters,
|
||||
PsiExpression[] args,
|
||||
PsiMethod parentMethod,
|
||||
PsiSubstitutor siteSubstitutor,
|
||||
Set<ConstraintFormula> additionalConstraints,
|
||||
boolean varargs) {
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
if (args[i] != null) {
|
||||
PsiType parameterType = getParameterType(parameters, i, siteSubstitutor, varargs);
|
||||
@@ -267,7 +267,8 @@ public class InferenceSession {
|
||||
final JavaResolveResult result = callExpression.resolveMethodGenerics();
|
||||
if (result instanceof MethodCandidateInfo) {
|
||||
final PsiMethod method = ((MethodCandidateInfo)result).getElement();
|
||||
LOG.assertTrue(method != null);
|
||||
//need to get type parameters for 2 level nested expressions (they won't be covered by expression constraints on this level?!)
|
||||
initBounds(method.getTypeParameters());
|
||||
final PsiExpression[] newArgs = argumentList.getExpressions();
|
||||
final PsiParameter[] newParams = method.getParameterList().getParameters();
|
||||
if (newParams.length > 0) {
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
class IDEA122681 {
|
||||
private static <E> Set<E> getSet(E element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static <T> T getObject(Supplier<T> supplier) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Object getObjectFromString(String string) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void callGetSet() {
|
||||
getSet(getObjectFromString(getObject(String ::new)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -205,6 +205,10 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testIDEA122681() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user