lambda: infer lambda param types in method call, return statement context

This commit is contained in:
anna
2012-07-19 18:39:37 +02:00
parent 533f276ad4
commit f90fadbd52
8 changed files with 73 additions and 83 deletions

View File

@@ -9,4 +9,10 @@ class Foo {
I ii1 = (final int k)->{
<error descr="Incompatible types. Found: 'int', required: 'java.lang.String'">String s = k;</error>
};
void bazz() {
bar((String s) -> {
System.out.println(s);});
}
void bar(I i){}
}

View File

@@ -1,5 +1,3 @@
import java.lang.String;
interface I {
void m(int i);
}
@@ -19,5 +17,19 @@ class Foo {
String s = ab;
<error descr="Incompatible types. Found: 'java.lang.String', required: 'int'">int i = ab;</error>
};
A<Integer> bazz() {
bar((o) -> {
String s = o;
<error descr="Incompatible types. Found: 'java.lang.String', required: 'int'">int i = o;</error>
});
return (i) -> {
Integer k = i;
int n = i;
<error descr="Incompatible types. Found: 'java.lang.Integer', required: 'java.lang.String'">String s = i;</error>
};
}
void bar(A<String> a){}
}

View File

@@ -15,7 +15,7 @@ class Foo {
void bar() {
foo<error descr="Ambiguous method call: both 'Foo.foo(I)' and 'Foo.foo(K)' match">((p) -> {
System.out.println(p);
System.out.println<error descr="Cannot resolve method 'println(<lambda parameter>)'">(p)</error>;
})</error>;
foo((p, k) -> {