mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
new inference: include additional constraints to check applicability (IDEA-140355)
This commit is contained in:
@@ -261,8 +261,7 @@ public class InferenceSession {
|
||||
return prepareSubstitution();
|
||||
}
|
||||
|
||||
if (parameters != null && args != null &&
|
||||
!MethodCandidateInfo.ourOverloadGuard.currentStack().contains(PsiUtil.skipParenthesizedExprUp(parent.getParent()))) {
|
||||
if (parameters != null && args != null) {
|
||||
final Set<ConstraintFormula> additionalConstraints = new LinkedHashSet<ConstraintFormula>();
|
||||
if (parameters.length > 0) {
|
||||
collectAdditionalConstraints(parameters, args, properties.getMethod(), PsiSubstitutor.EMPTY, additionalConstraints, properties.isVarargs());
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
import java.util.TreeSet;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
class Test {
|
||||
|
||||
void foo() {
|
||||
log(get(TreeSet<String>::new));
|
||||
}
|
||||
|
||||
private void <warning descr="Private method 'log(java.lang.String[])' is never used">log</warning>(String params[]) {
|
||||
System.out.println(params);
|
||||
}
|
||||
private void log(Object params) {
|
||||
System.out.println(params);
|
||||
}
|
||||
|
||||
<C> C get(Supplier<C> s) {
|
||||
return s.get();
|
||||
}
|
||||
}
|
||||
@@ -114,6 +114,10 @@ public class OverloadResolutionTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testMethodReferenceWithTypeArgs() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user