mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
method refs: check first parameter if it could be a receiver for varargs methods (IDEA-127506)
This commit is contained in:
+2
-1
@@ -970,7 +970,8 @@ public class InferenceSession {
|
||||
addConstraint(new TypeCompatibilityConstraint(getParameterType(parameters, i, PsiSubstitutor.EMPTY, varargs), pType));
|
||||
}
|
||||
}
|
||||
else if (parameters.length + 1 == functionalMethodParameters.length && !varargs || !isStatic && varargs && functionalMethodParameters.length > 0) { //instance methods
|
||||
else if (parameters.length + 1 == functionalMethodParameters.length && !varargs ||
|
||||
!isStatic && varargs && functionalMethodParameters.length > 0 && PsiMethodReferenceUtil.hasReceiver(reference, method)) { //instance methods
|
||||
initBounds(containingClass.getTypeParameters());
|
||||
|
||||
final PsiType pType = signature.getParameterTypes()[0];
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
class Validator {
|
||||
static boolean thereAreConstraintViolationsIn1(final Stream<Object> objectStream, Validator validator) {
|
||||
Stream<Set<List<Object>>> rStream = objectStream
|
||||
.map(validator::validate);
|
||||
return rStream
|
||||
.flatMap(set -> set.stream())
|
||||
.findAny()
|
||||
.isPresent();
|
||||
}
|
||||
|
||||
static void thereAreConstraintViolationsIn(final Stream<Object> objectStream, Validator validator) {
|
||||
Stream<Set<List<Object>>> rStream = objectStream.map(validator ::validate);
|
||||
|
||||
Stream<Set<List<Object>>> lStream = objectStream.map((a) -> validator.validate(a));
|
||||
}
|
||||
|
||||
<T> Set<List<T>> validate(T var1, Class<?> ... var2) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+4
@@ -277,6 +277,10 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testIDEA127506() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user