mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
new inference: processing of compound bounds
This commit is contained in:
+5
-1
@@ -66,11 +66,15 @@ public class SubtypingConstraint implements ConstraintFormula {
|
||||
@Override
|
||||
public boolean reduce(InferenceSession session, List<ConstraintFormula> constraints) {
|
||||
if (myT instanceof PsiWildcardType) {
|
||||
final PsiType tBound = ((PsiWildcardType)myT).getBound();
|
||||
PsiType tBound = ((PsiWildcardType)myT).getBound();
|
||||
if (tBound == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tBound instanceof PsiCapturedWildcardType) {
|
||||
tBound = ((PsiWildcardType)myT).isExtends() ? ((PsiCapturedWildcardType)tBound).getUpperBound()
|
||||
: ((PsiCapturedWildcardType)tBound).getLowerBound();
|
||||
}
|
||||
if (myS instanceof PsiCapturedWildcardType) {
|
||||
myS = ((PsiCapturedWildcardType)myS).getWildcard();
|
||||
}
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
class NachCollections<K,V> {
|
||||
<K1, V1> Consumer<Map.Entry<K1, V1>> consumer(Consumer<Map.Entry<K1, V1>> c) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void forEach(Collection<? extends Map.Entry<K,V>> c1,
|
||||
Collection<? super Map.Entry<K,V>> c2,
|
||||
Consumer<Map.Entry<K, V>> a) {
|
||||
c1.forEach(consumer(a));
|
||||
c2.forEach(consumer<error descr="'consumer(java.util.function.Consumer<java.util.Map.Entry<K1,V1>>)' in 'NachCollections' cannot be applied to '(java.util.function.Consumer<java.util.Map.Entry<K,V>>)'">(a)</error>);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -10,6 +10,6 @@ class Node<NodeTypeT extends NodeType> {
|
||||
|
||||
class Main {
|
||||
public static void main(NodeProperty<NumberExpression, Integer> nval, Node<? extends NodeType> expr) {
|
||||
int val = expr.get<error descr="'get(NodeProperty<? super capture<? extends NodeType>,java.lang.Object>)' in 'Node' cannot be applied to '(NodeProperty<NumberExpression,java.lang.Integer>)'">(nval)</error>;
|
||||
int val = expr.get<error descr="'get(NodeProperty<? super capture<? extends NodeType>,java.lang.Integer>)' in 'Node' cannot be applied to '(NodeProperty<NumberExpression,java.lang.Integer>)'">(nval)</error>;
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -755,6 +755,10 @@ public class GenericsHighlighting8Test extends LightDaemonAnalyzerTestCase {
|
||||
|
||||
public void testErasure() throws Exception { doTest(); }
|
||||
|
||||
public void testWildcardBoundsCombination() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user