mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 21:11:28 +07:00
new inference: reject varargs as method reference target
(cherry picked from commit 77017d7790b78c5bb20c591e2588c1eccd0f96d7)
This commit is contained in:
@@ -706,7 +706,7 @@ public class TypeConversionUtil {
|
||||
final PsiType lType = ((PsiMethodReferenceType)left).getExpression().getFunctionalInterfaceType();
|
||||
return Comparing.equal(rType, lType);
|
||||
}
|
||||
return methodReferenceExpression.isAcceptable(left);
|
||||
return !(left instanceof PsiArrayType) && methodReferenceExpression.isAcceptable(left);
|
||||
}
|
||||
if (right instanceof PsiLambdaExpressionType) {
|
||||
final PsiLambdaExpression rLambdaExpression = ((PsiLambdaExpressionType)right).getExpression();
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
class Test {
|
||||
|
||||
interface IntMapper {
|
||||
int map();
|
||||
}
|
||||
|
||||
interface LongMapper {
|
||||
long map();
|
||||
}
|
||||
|
||||
void m(IntMapper im1, IntMapper... im) { }
|
||||
void m(LongMapper... lm) { }
|
||||
|
||||
{
|
||||
m<error descr="Ambiguous method call: both 'Test.m(IntMapper, IntMapper...)' and 'Test.m(LongMapper...)' match">(this ::ii)</error>;
|
||||
}
|
||||
|
||||
int ii() {return 0;}
|
||||
|
||||
}
|
||||
@@ -189,6 +189,10 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testAmbiguityVarargs() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user