mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 10:21:05 +07:00
lambda: return type checks initial
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import java.lang.Integer;
|
||||
|
||||
interface I {
|
||||
void m(int i);
|
||||
}
|
||||
@@ -18,6 +20,14 @@ class Foo {
|
||||
<error descr="Incompatible types. Found: 'java.lang.String', required: 'int'">int i = ab;</error>
|
||||
};
|
||||
|
||||
{
|
||||
A<String> a1;
|
||||
a1 = (ab)->{
|
||||
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;
|
||||
@@ -33,3 +43,18 @@ class Foo {
|
||||
void bar(A<String> a){}
|
||||
}
|
||||
|
||||
class CastInference {
|
||||
public interface I1<X> {
|
||||
X m();
|
||||
}
|
||||
public interface I2<X> {
|
||||
X m();
|
||||
}
|
||||
public static <X> void foo(I1<X> s) {}
|
||||
public static <X> void foo(I2<X> s) {}
|
||||
|
||||
public static void main(String[] args) {
|
||||
foo((I1<Integer>)() -> 42);
|
||||
I1<Integer> i1 = (I1<Integer>)() -> 42;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user