mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
new inference: most specific check according to spec, fixed testdata after JDK-8043734
This commit is contained in:
-7
@@ -1205,9 +1205,6 @@ public class InferenceSession {
|
||||
}
|
||||
|
||||
final List<PsiExpression> returnExpressions = LambdaUtil.getReturnExpressions((PsiLambdaExpression)arg);
|
||||
if (sReturnType == PsiType.VOID) {
|
||||
return returnExpressions.isEmpty() && session == null;
|
||||
}
|
||||
|
||||
if (LambdaUtil.isFunctionalType(sReturnType) && LambdaUtil.isFunctionalType(tReturnType) &&
|
||||
!TypeConversionUtil.isAssignable(TypeConversionUtil.erasure(sReturnType), TypeConversionUtil.erasure(tReturnType)) &&
|
||||
@@ -1263,10 +1260,6 @@ public class InferenceSession {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sReturnType == PsiType.VOID && session != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final boolean sPrimitive = sReturnType instanceof PsiPrimitiveType && sReturnType != PsiType.VOID;
|
||||
final boolean tPrimitive = tReturnType instanceof PsiPrimitiveType && tReturnType != PsiType.VOID;
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ class Ambiguity1 {
|
||||
static <T> void m(I2<T> i2) {}
|
||||
|
||||
{
|
||||
m<error descr="Ambiguous method call: both 'Ambiguity1.m(I1)' and 'Ambiguity1.m(I2<Object>)' match">(()->{throw new AssertionError();})</error>;
|
||||
m(()->{throw new AssertionError();});
|
||||
m(() -> {});
|
||||
m(() -> {
|
||||
if (false) return;
|
||||
|
||||
+1
-1
@@ -22,6 +22,6 @@ class AmbiguityRawGenerics {
|
||||
<Z> void foo(I3<Z> s) { }
|
||||
|
||||
void bar() {
|
||||
foo<error descr="Ambiguous method call: both 'AmbiguityRawGenerics.foo(I)' and 'AmbiguityRawGenerics.foo(I1)' match">(()-> { throw new RuntimeException(); })</error>;
|
||||
foo<error descr="Ambiguous method call: both 'AmbiguityRawGenerics.foo(I1)' and 'AmbiguityRawGenerics.foo(I2)' match">(()-> { throw new RuntimeException(); })</error>;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -7,7 +7,7 @@ class Test {
|
||||
void call(I2 p) { }
|
||||
|
||||
void test() {
|
||||
call<error descr="Ambiguous method call: both 'Test.call(I1)' and 'Test.call(I2)' match">(() -> { throw new RuntimeException(); })</error>;
|
||||
call(() -> { throw new RuntimeException(); });
|
||||
call(() -> { if (true) return ""; throw new RuntimeException(); });
|
||||
call(() -> { if (true) return; throw new RuntimeException(); });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user