mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
new inference: don't process expressions after param.length for non-varargs (IDEA-149489)
This commit is contained in:
@@ -156,6 +156,11 @@ public class InferenceSession {
|
||||
}
|
||||
if (parameters.length > 0) {
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
//don't infer anything if number of parameters differ and method is not vararg
|
||||
if (!varargs && i >= parameters.length) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (args[i] != null && isPertinentToApplicability(args[i], method)) {
|
||||
PsiType parameterType = getParameterType(parameters, i, mySiteSubstitutor, varargs);
|
||||
addConstraint(new ExpressionCompatibilityConstraint(args[i], substituteWithInferenceVariables(parameterType)));
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Add 'String' as 2nd parameter to method 'get'" "true"
|
||||
import java.util.List;
|
||||
class Test<T> {
|
||||
|
||||
public LazyVal(final List<T> ts) {
|
||||
get(ts, "");
|
||||
}
|
||||
public static <T1> void get(List<T1> l, String s) {}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Add 'String' as 2nd parameter to method 'get'" "true"
|
||||
import java.util.List;
|
||||
class Test<T> {
|
||||
|
||||
public LazyVal(final List<T> ts) {
|
||||
get(t<caret>s, "");
|
||||
}
|
||||
public static <T1> void get(List<T1> l) {}
|
||||
}
|
||||
Reference in New Issue
Block a user