mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
lambda: inference param types for assignment and cast context
This commit is contained in:
+3
-3
@@ -27,13 +27,13 @@ class C {
|
||||
}
|
||||
|
||||
void test() {
|
||||
Simplest simplest = <weak_warning descr="Lambda expressions type check is not yet implemented">() -> { }</weak_warning>;
|
||||
Simplest simplest = () -> { };
|
||||
use(<weak_warning descr="Lambda expressions type check is not yet implemented">() -> { }</weak_warning>);
|
||||
|
||||
IntParser intParser = <weak_warning descr="Lambda expressions type check is not yet implemented">(String s) -> Integer.parseInt(s)</weak_warning>;
|
||||
IntParser intParser = (String s) -> Integer.parseInt(s);
|
||||
}
|
||||
|
||||
Runnable foo() {
|
||||
return <weak_warning descr="Lambda expressions type check is not yet implemented">() -> { System.out.println("foo"); }</weak_warning>;
|
||||
return () -> { System.out.println("foo"); };
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
interface I {
|
||||
void m(int i);
|
||||
}
|
||||
|
||||
class Foo {
|
||||
I ii = (@<error descr="'@Override' not applicable to type use">Override</error> final int k)->{
|
||||
int j = k;
|
||||
};
|
||||
I ii1 = (final int k)->{
|
||||
<error descr="Incompatible types. Found: 'int', required: 'java.lang.String'">String s = k;</error>
|
||||
};
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
import java.lang.String;
|
||||
|
||||
interface I {
|
||||
void m(int i);
|
||||
}
|
||||
|
||||
interface A<B> {
|
||||
void foo(B b);
|
||||
}
|
||||
|
||||
class Foo {
|
||||
I ii = (final <error descr="Cannot resolve symbol 'k'">k</error><error descr="Identifier expected">)</error>->{};
|
||||
I ii1 = (k)->{
|
||||
int i = k;
|
||||
<error descr="Incompatible types. Found: 'int', required: 'java.lang.String'">String s = k;</error>
|
||||
};
|
||||
|
||||
A<String> a = (ab) -> {
|
||||
String s = ab;
|
||||
<error descr="Incompatible types. Found: 'java.lang.String', required: 'int'">int i = ab;</error>
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user