mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 21:55:01 +07:00
good code is red: upper bound should move up if next parameter requires (IDEA-56696)
This commit is contained in:
@@ -175,7 +175,7 @@ public class PsiResolveHelperImpl implements PsiResolveHelper {
|
||||
}
|
||||
break;
|
||||
case SUBTYPE:
|
||||
if (PsiType.NULL.equals(upperBound)) {
|
||||
if (PsiType.NULL.equals(upperBound) || TypeConversionUtil.isAssignable(upperBound, type)) {
|
||||
upperBound = type;
|
||||
}
|
||||
}
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
|
||||
public class NestedGenericGoodCodeIsRed {
|
||||
|
||||
public void main( String[] args ) {
|
||||
satisfiesAllOf(isPositive(), isEqualTo(10.9));
|
||||
satisfiesAllOf(isPositive(), isEqualTo(10));
|
||||
|
||||
Number num = null;
|
||||
satisfiesAllOf(isPositive(), isEqualTo(num));
|
||||
|
||||
this.<Number>satisfiesAllOf<error descr="'satisfiesAllOf(NestedGenericGoodCodeIsRed.Predicate<? super java.lang.Number>, NestedGenericGoodCodeIsRed.Predicate<? super java.lang.Number>)' in 'NestedGenericGoodCodeIsRed' cannot be applied to '(NestedGenericGoodCodeIsRed.Predicate<java.lang.Number>, NestedGenericGoodCodeIsRed.Predicate<java.lang.Integer>)'">(isPositive(), isEqualTo(10))</error>;
|
||||
}
|
||||
|
||||
|
||||
public interface Predicate<T> {
|
||||
|
||||
}
|
||||
|
||||
public <ALL> void satisfiesAllOf( Predicate<? super ALL> first, Predicate<? super ALL> second ) {
|
||||
}
|
||||
|
||||
public <POSITIVE extends Number> Predicate<POSITIVE> isPositive() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <EQUALTO extends Number> Predicate<EQUALTO> isEqualTo( EQUALTO target ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -50,6 +50,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testExplicitMethodParameters1() throws Exception { doTest(false); }
|
||||
public void testInferenceWithBounds() throws Exception {doTest(false);}
|
||||
public void testInferenceWithSuperBounds() throws Exception {doTest(false);}
|
||||
public void testInferenceWithUpperBoundPromotion() throws Exception {doTest(false);}
|
||||
public void testVariance() throws Exception {doTest(false);}
|
||||
public void testForeachTypes() throws Exception {doTest(false);}
|
||||
public void testRawOverridingMethods() throws Exception {doTest(false);}
|
||||
|
||||
Reference in New Issue
Block a user