mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 13:31:28 +07:00
new inference: lift containing class type parameters for method references
(cherry picked from commit a341be1196484b6e4c33a7d10059d2bec5bdf955)
This commit is contained in:
@@ -154,9 +154,7 @@ public class PsiMethodReferenceCompatibilityConstraint implements ConstraintForm
|
||||
}
|
||||
|
||||
session.initBounds(method.getTypeParameters());
|
||||
if (myExpression.isConstructor()) {
|
||||
session.initBounds(containingClass.getTypeParameters());
|
||||
}
|
||||
session.initBounds(containingClass.getTypeParameters());
|
||||
constraints.add(new TypeCompatibilityConstraint(returnType, referencedMethodReturnType));
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import java.util.List;
|
||||
|
||||
class Test {
|
||||
|
||||
interface Function<X, Y> {
|
||||
Y m(X x);
|
||||
}
|
||||
|
||||
interface Node<E> {
|
||||
List<E> foo();
|
||||
}
|
||||
|
||||
class Data<T, I> {
|
||||
Data(I state, Function<I, List<T>> fun) { }
|
||||
}
|
||||
|
||||
<O> Data<O, Node<O>> test(Node<O> collection) {
|
||||
return new Data<>(collection, Node::foo);
|
||||
}
|
||||
}
|
||||
@@ -120,6 +120,10 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testContainingClassTypeParamsForBounds() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user