mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
new overload resolution: covariant comparison of return types
This commit is contained in:
+2
-2
@@ -1070,7 +1070,7 @@ public class InferenceSession {
|
||||
session.addConstraint(new StrictSubtypingConstraint(tReturnType, sReturnType));
|
||||
return true;
|
||||
} else {
|
||||
return sReturnType != null && tReturnType != null && TypeConversionUtil.isAssignable(sReturnType, tReturnType);
|
||||
return sReturnType != null && tReturnType != null && TypeConversionUtil.isAssignable(tReturnType, sReturnType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1115,7 +1115,7 @@ public class InferenceSession {
|
||||
session.addConstraint(new StrictSubtypingConstraint(tReturnType, sReturnType));
|
||||
return true;
|
||||
} else {
|
||||
return sReturnType != null && tReturnType != null && TypeConversionUtil.isAssignable(sReturnType, tReturnType);
|
||||
return sReturnType != null && tReturnType != null && TypeConversionUtil.isAssignable(tReturnType, sReturnType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -624,11 +624,11 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
|
||||
}
|
||||
|
||||
if (!applicable12ignoreFunctionalType && applicable21ignoreFunctionalType) {
|
||||
return specifics == Specifics.SECOND ? Specifics.SECOND : Specifics.NEITHER;
|
||||
return specifics == Specifics.FIRST ? Specifics.FIRST : Specifics.NEITHER;
|
||||
}
|
||||
|
||||
if (!applicable21ignoreFunctionalType && applicable12ignoreFunctionalType) {
|
||||
return specifics == Specifics.FIRST ? Specifics.FIRST : Specifics.NEITHER;
|
||||
return specifics == Specifics.SECOND ? Specifics.SECOND : Specifics.NEITHER;
|
||||
}
|
||||
|
||||
return specifics;
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
class Test {
|
||||
interface I { Object invoke(); }
|
||||
interface IStr { String foo(); }
|
||||
|
||||
private static void call(IStr str) {
|
||||
System.out.println(str);
|
||||
}
|
||||
|
||||
private static void <warning descr="Private method 'call(Test.I)' is never used">call</warning>(I i) {
|
||||
System.out.println(i);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
call(()-> null);
|
||||
}
|
||||
}
|
||||
+4
@@ -79,6 +79,10 @@ public class MostSpecificResolutionTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
public void testMostSpecificByReturnType() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user