mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-10 18:09:38 +07:00
new inference: provide incomplete inference results for lambda (IDEA-162035; IDEA-155230)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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;});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user