mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
composition of extends/super wildcard reworked (IDEA-96721)
This commit is contained in:
@@ -159,7 +159,13 @@ public class PsiSubstitutorImpl implements PsiSubstitutor {
|
||||
if (newBound instanceof PsiCapturedWildcardType) {
|
||||
final PsiWildcardType wildcard = ((PsiCapturedWildcardType)newBound).getWildcard();
|
||||
if (wildcardType.isExtends() != wildcard.isExtends()) {
|
||||
return wildcard.isBounded() ? wildcard.getBound() : newBound;
|
||||
if (wildcard.isBounded()) {
|
||||
return wildcardType.isExtends() ? PsiWildcardType.createExtends(wildcardType.getManager(), newBound)
|
||||
: PsiWildcardType.createSuper(wildcardType.getManager(), newBound);
|
||||
}
|
||||
else {
|
||||
return newBound;
|
||||
}
|
||||
}
|
||||
if (!wildcard.isBounded()) return PsiWildcardType.createUnbounded(wildcardType.getManager());
|
||||
}
|
||||
|
||||
+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<NodeType,java.lang.Integer>)' 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>;
|
||||
}
|
||||
}
|
||||
@@ -152,6 +152,6 @@ public class TypeInferenceTest extends Resolve15TestCase {
|
||||
}
|
||||
|
||||
public void testBoundComposition() throws Exception {
|
||||
checkResolvesTo("java.lang.Class<?>");
|
||||
checkResolvesTo("java.lang.Class<? super ? extends java.lang.Object>");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user