mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
new overload resolution: most specific check on invalid class exceptions fixed
This commit is contained in:
@@ -1070,7 +1070,7 @@ public class InferenceSession {
|
||||
session.addConstraint(new StrictSubtypingConstraint(tReturnType, sReturnType));
|
||||
return true;
|
||||
} else {
|
||||
return TypeConversionUtil.isAssignable(sReturnType, tReturnType);
|
||||
return sReturnType != null && tReturnType != null && TypeConversionUtil.isAssignable(sReturnType, tReturnType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1115,7 +1115,7 @@ public class InferenceSession {
|
||||
session.addConstraint(new StrictSubtypingConstraint(tReturnType, sReturnType));
|
||||
return true;
|
||||
} else {
|
||||
return TypeConversionUtil.isAssignable(sReturnType, tReturnType);
|
||||
return sReturnType != null && tReturnType != null && TypeConversionUtil.isAssignable(sReturnType, tReturnType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
class Test {
|
||||
interface I { Object in<EOLError descr="';' expected"></EOLError>
|
||||
<error descr="Invalid method declaration; return type required">voke</error>(); }
|
||||
interface IStr { String foo(); }
|
||||
|
||||
public static void call(IStr str) {}
|
||||
public static void call(I i) { }
|
||||
|
||||
public static void main(String[] args) {
|
||||
call<error descr="Ambiguous method call: both 'Test.call(IStr)' and 'Test.call(I)' match">(()-> null)</error>;
|
||||
}
|
||||
}
|
||||
@@ -75,6 +75,10 @@ public class MostSpecificResolutionTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testIncompleteMethodInInterface() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user