mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
method refs: don't ignore applicability errors (IDEA-191467)
This commit is contained in:
+1
@@ -301,6 +301,7 @@ public class MethodReferenceResolver implements ResolveCache.PolyVariantContextR
|
||||
final PsiMethod psiMethod = ((MethodCandidateInfo)conflict).getElement();
|
||||
|
||||
final PsiSubstitutor substitutor = ((MethodCandidateInfo)conflict).getSubstitutor(false);
|
||||
if (((MethodCandidateInfo)conflict).getInferenceErrorMessage() != null) return null;
|
||||
final PsiType[] parameterTypes = psiMethod.getSignature(substitutor).getParameterTypes();
|
||||
|
||||
final boolean varargs = ((MethodCandidateInfo)conflict).isVarargs();
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
import java.util.*;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
class MyTest {
|
||||
{
|
||||
Stream<String> stream = Stream.of("a", "b", "c", "d");
|
||||
Set<Integer> set = stream.collect(<error descr="No compile-time declaration for the method reference is found">()->new TreeSet<Integer>()</error>, TreeSet::<error descr="Incompatible types: String is not convertible to Integer">add</error>, TreeSet::addAll);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class Simplified {
|
||||
void m(final BiConsumer<TreeSet<Integer>, TreeSet<Integer>> addAll) {
|
||||
Set<Integer> set = collect(TreeSet:: <error descr="Incompatible types: String is not convertible to Integer">add</error>, addAll);
|
||||
}
|
||||
|
||||
abstract <R> R collect(BiConsumer<R, String> accumulator, BiConsumer<R, R> combiner);
|
||||
|
||||
}
|
||||
+1
@@ -183,6 +183,7 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testRegisterVariablesForNonFoundParameterizations() { doTest(); }
|
||||
|
||||
public void testPreferErrorOnTopLevelToFailedSubstitutorOnNestedLevel() { doTest(); }
|
||||
public void testDontIgnoreIncompatibilitiesDuringFirstApplicabilityCheck() { doTest(); }
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
|
||||
Reference in New Issue
Block a user