new inference: provide incomplete inference results for lambda (IDEA-162035; IDEA-155230)

This commit is contained in:
Anna.Kozlova
2016-10-06 15:59:21 +02:00
parent a0ea0d7eda
commit 62d25f9d05
7 changed files with 82 additions and 36 deletions

View File

@@ -3,8 +3,8 @@ import java.util.*;
class Main {
void foo(List<Integer> list) {
bar(list, i -> <error descr="Bad return type in lambda expression: int cannot be converted to S_OUT">i.intValue()</error>, i -> i.<error descr="Cannot resolve method 'unknown()'">unknown</error>());
bar1(list, i -> <error descr="Bad return type in lambda expression: int cannot be converted to S_OUT">i.intValue()</error>, i -> i.<error descr="Cannot resolve method 'unknown()'">unknown</error>());
bar(list, i -> i.intValue(), i -> i.<error descr="Cannot resolve method 'unknown()'">unknown</error>());
bar1(list, i -> i.intValue(), i -> i.<error descr="Cannot resolve method 'unknown()'">unknown</error>());
}
<U, S_IN, S_OUT, R> R bar(List<S_IN> list,

View File

@@ -57,7 +57,7 @@ class ReturnTypeCompatibility {
}
public static void main(String[] args) {
<error descr="Ambiguous method call: both 'ReturnTypeCompatibility.call(I1<Number>)' and 'ReturnTypeCompatibility.call(I2<P>)' match">call</error>(i-> {return i;});
<error descr="Ambiguous method call: both 'ReturnTypeCompatibility.call(I1<Number>)' and 'ReturnTypeCompatibility.call(I2<String>)' match">call</error>(i-> {return i;});
}
}

View File

@@ -0,0 +1,21 @@
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Stream;
class A {
{
run(A.class, this, (o) -> {
o.meth();
<error descr="Missing return statement">}</error>);
Map<Integer, Integer> map = Stream.iterate(5, <error descr="no instance(s) of type variable(s) T exist so that Stream<T> conforms to Map<Integer, Integer>">t -> t + 5</error>);
}
void meth() {}
<T> T run(Class<T> c, T t, Function<T, T> f) {
return f.apply(t);
}
}