mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-04 08:51:02 +07:00
lambda: infer lambda param types in method call, return statement context
This commit is contained in:
@@ -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){}
|
||||
}
|
||||
@@ -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){}
|
||||
}
|
||||
|
||||
|
||||
@@ -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) -> {
|
||||
|
||||
Reference in New Issue
Block a user