lambda: initial is assignable check; effectively final; acceptable context

This commit is contained in:
anna
2012-07-19 21:18:30 +02:00
parent 714b565acd
commit 812b9a72ea
15 changed files with 303 additions and 24 deletions
@@ -0,0 +1,18 @@
interface I {
void m(int x);
}
class Test {
void foo(Object x) {}
void bar() {
foo(<error descr="Operator '!' cannot be applied to '<lambda expression>'">!(int x)-> {}</error>);
foo(<error descr="Lambda expression is not expected here">(int x)-> { } instanceof Object</error> );
}
I bazz() {
foo((I)(int x)-> { });
I o = (I)(int x)-> { };
return (int x) -> {};
}
}