inference: allow child session inference if containing method is not generics

This commit is contained in:
Anna.Kozlova
2018-10-19 14:46:04 +02:00
parent 11fd315bc5
commit 9aa64b30d9
7 changed files with 30 additions and 6 deletions

View File

@@ -150,7 +150,7 @@ public class InferenceSessionContainer {
return properties.getInfo().getSubstitutor(false);
}
}
return childSession.prepareSubstitution();
return null;
}
return childSession.collectAdditionalAndInfer(parameters, arguments, properties, compoundInitialState.getInitialSubstitutor());
}

View File

@@ -7,6 +7,6 @@ class Test2 {
}
{
foo (bar(String.class), <error descr="'foo(java.lang.String, java.lang.Integer)' in 'Test2' cannot be applied to '(T, java.lang.String)'">""</error>);
foo (bar(String.class), <error descr="'foo(java.lang.String, java.lang.Integer)' in 'Test2' cannot be applied to '(java.lang.String, java.lang.String)'">""</error>);
}
}

View File

@@ -12,7 +12,7 @@ import java.util.function.Function;
class Test {
{
valueOf(processFirst(x -> <error descr="Bad return type in lambda expression: Integer cannot be converted to V">x</error>));
valueOf(processFirst(<error descr="no instance(s) of type variable(s) exist so that Integer conforms to char[]">x -> x</error>));
}
public static <V> V processFirst(Function<Integer,V> f){

View File

@@ -6,7 +6,7 @@ import java.util.stream.Stream;
class Test {
void foo() {
log(get(<error descr="Bad return type in method reference: cannot convert java.util.TreeSet<java.lang.String> to C">TreeSet<String>::new</error>));
log(<error descr="no instance(s) of type variable(s) exist so that TreeSet<String> conforms to String[]">get(TreeSet<String>::new)</error>);
}
private void log(String params[]) {

View File

@@ -0,0 +1,12 @@
// "Add explicit type arguments" "true"
import java.util.*;
class MyTest {
void foo(List<String> list1, List<String> list2) {}
void bar() {
foo(Collections.<String>singletonList("x"), unresolved());
}
}

View File

@@ -0,0 +1,12 @@
// "Add explicit type arguments" "true"
import java.util.*;
class MyTest {
void foo(List<String> list1, List<String> list2) {}
void bar() {
foo(Collections.single<caret>tonList("x"), unresolved());
}
}

View File

@@ -26,7 +26,7 @@ public class AddTypeArgumentsTest extends LightQuickFixParameterizedTestCase {
}
@Override
protected LanguageLevel getLanguageLevel() {
protected LanguageLevel getDefaultLanguageLevel() {
return LanguageLevel.JDK_1_5;
}
}
}