mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 03:13:40 +07:00
lambda: check formal params for equality, eliminate wildcards during inference according to 15.27.3
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
||||
public class Test {
|
||||
interface Predicate<T> {
|
||||
boolean test(T t);
|
||||
}
|
||||
|
||||
{
|
||||
Predicate<? super Integer> p = (Number n) -> n.equals(23);
|
||||
Predicate<Integer> p1 = (<error descr="Incompatible parameter types in lambda expression">Number n</error>) -> n.equals(23);
|
||||
Predicate<Number> p2 = (Number n) -> n.equals(23);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -32,6 +32,6 @@ class ReturnTypeCompatibility {
|
||||
call((String i)->{ return i;});
|
||||
call(<error descr="Cyclic inference">i->{ return i;}</error>);
|
||||
call(<error descr="Cyclic inference">i->""</error>);
|
||||
call<error descr="'call(ReturnTypeCompatibility.I1<java.lang.Integer>)' in 'ReturnTypeCompatibility' cannot be applied to '(<lambda expression>)'">((int i)->{ return i;})</error>;
|
||||
call((<error descr="Incompatible parameter types in lambda expression">int i</error>)->{ return i;});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user