lambda: correct error reporting according to b.50

This commit is contained in:
Anna Kozlova
2012-08-20 15:26:47 +04:00
parent 05c0cfbb5e
commit 122cccf567
2 changed files with 11 additions and 9 deletions
@@ -4,9 +4,9 @@ class Test1 {
void foo();
}
{
VoidReturnType aI = <error descr="Incompatible return type void in lambda expression">() -> System.out.println()</error>;
VoidReturnType aI = () -> System.out.println();
VoidReturnType aI1 = () -> {System.out.println();};
VoidReturnType aI2 = <error descr="Cannot return a value from method whose result type is void">() -> {return 1;}</error>;
VoidReturnType aI2 = <error descr="Unexpected return value">() -> {return 1;}</error>;
VoidReturnType aI3 = <error descr="Incompatible return type int in lambda expression">() -> 1</error>;
VoidReturnType aI4 = () -> {return;};
}
@@ -18,7 +18,7 @@ class Test2 {
}
{
IntReturnType aI = <error descr="Incompatible return type void in lambda expression">() -> System.out.println()</error>;
IntReturnType aI1 = <error descr="Incompatible return type void in lambda expression">() -> {System.out.println();}</error>;
IntReturnType aI1 = <error descr="Missing return value">() -> {System.out.println();}</error>;
IntReturnType aI2 = () -> {return 1;};
IntReturnType aI3 = () -> 1;
}
@@ -32,10 +32,10 @@ class Test3 {
}
{
XReturnType<Object> aI = <error descr="Incompatible return type void in lambda expression">() -> System.out.println()</error>;
XReturnType<Object> aI1 = <error descr="Incompatible return type void in lambda expression">() -> {System.out.println();}</error>;
XReturnType<Object> aI1 = <error descr="Missing return value">() -> {System.out.println();}</error>;
XReturnType<Object> aI2 = () -> {return 1;};
XReturnType<Object> aI3 = () -> 1;
XReturnType<Object> aI4 = <error descr="Incompatible return type void in lambda expression">() -> {}</error>;
XReturnType<Object> aI4 = <error descr="Missing return value">() -> {}</error>;
}
}
@@ -48,7 +48,7 @@ class Test4 {
{
YXReturnType<Object> aI = <error descr="Incompatible return type void in lambda expression">() -> System.out.println()</error>;
YXReturnType<Object> aI1 = <error descr="Incompatible return type void in lambda expression">() -> {System.out.println();}</error>;
YXReturnType<Object> aI1 = <error descr="Missing return value">() -> {System.out.println();}</error>;
YXReturnType<Object> aI2 = <error descr="Incompatible return type int in lambda expression">() -> {return 1;}</error>;
YXReturnType<Object> aI3 = <error descr="Incompatible return type int in lambda expression">() -> 1</error>;
YXReturnType<Object> aI4 = () -> new Y<Object>(){};