mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
lambda highlighting: if return statement has problem, try to highlight only corresponding return even if containing inference failed
This commit is contained in:
+12
-1
@@ -1,4 +1,5 @@
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
class Test {
|
||||
@@ -12,4 +13,14 @@ class Test {
|
||||
}
|
||||
|
||||
public static void foo(Supplier<String> consumer) {}
|
||||
|
||||
private void foo(List<String> descriptions) {
|
||||
Collections.sort(descriptions, (o1, o2) -> {
|
||||
final int elementsDiff = o1.length() - o2.length();
|
||||
if (elementsDiff == 0) {
|
||||
return <error descr="Bad return type in lambda expression: boolean cannot be converted to int">o1.equals(o2)</error>;
|
||||
}
|
||||
return -elementsDiff;
|
||||
});
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -13,7 +13,7 @@ class Test {
|
||||
}
|
||||
|
||||
void bar(C c) {
|
||||
foo(c, <error descr="Bad return type in lambda expression: A cannot be converted to C">x -> x.f()</error>);
|
||||
foo(c, x -> <error descr="Bad return type in lambda expression: A cannot be converted to C">x.f()</error>);
|
||||
foo(c, x -> x);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user