incompatible types: highlight parent call instead of lambda when the error isn't related to lambda (IDEA-218801)

GitOrigin-RevId: 17a2f1f62f7703930aa25a8cfd6dfd4a918e1fe7
This commit is contained in:
Anna.Kozlova
2019-10-10 07:01:11 +00:00
committed by intellij-monorepo-bot
parent 0edaac849d
commit 87deef960c
11 changed files with 15 additions and 21 deletions
@@ -6,7 +6,7 @@ import java.util.function.Function;
class Test {
{
final Map<Comparable, List<Collection<?>>> families = sortingMerge(<error descr="Incompatible types. Found: 'java.util.Map<C,java.util.List<java.lang.Object>>', required: 'java.util.Map<java.lang.Comparable,java.util.List<java.util.Collection<?>>>'">(s) -> 0</error>);
final Map<Comparable, List<Collection<?>>> families = <error descr="Incompatible types. Found: 'java.util.Map<C,java.util.List<java.lang.Object>>', required: 'java.util.Map<java.lang.Comparable,java.util.List<java.util.Collection<?>>>'">sortingMerge((s) -> 0);</error>
}
private <C extends Comparable<C>, T> Map<C, List<T>> sortingMerge(Function<T, C> keyFunction) {
@@ -5,6 +5,6 @@ class Test {
public static <T> void execute(Callable<T>[] cmds) { }
public static void main(String[] args) throws Exception{
execute(<error descr="Callable<T>[] is not a functional interface">() -> null</error>);
execute<error descr="'execute(java.util.concurrent.Callable<T>[])' in 'Test' cannot be applied to '(<lambda expression>)'">(() -> null)</error>;
}
}
@@ -9,7 +9,7 @@ class A {
<error descr="Missing return statement">}</error>);
Map<Integer, Integer> map = Stream.iterate(5, <error descr="Incompatible types. Found: 'java.util.stream.Stream<java.lang.Integer>', required: 'java.util.Map<java.lang.Integer,java.lang.Integer>'">t -> t + 5</error>);
Map<Integer, Integer> map = <error descr="Incompatible types. Found: 'java.util.stream.Stream<java.lang.Integer>', required: 'java.util.Map<java.lang.Integer,java.lang.Integer>'">Stream.iterate(5, t -> t + 5);</error>
}
@@ -26,7 +26,7 @@ abstract class NoFormalParamTypeInferenceNeeded {
{
map(a -> zip(text -> text));
zip(a -> zip(text -> text));
Integer zip = zip(<error descr="Incompatible types. Found: 'java.lang.Object', required: 'java.lang.Integer'">a -> zip(text -> text)</error>);
Integer zip = <error descr="Incompatible types. Found: 'java.lang.Object', required: 'java.lang.Integer'">zip(a -> zip(text -> text));</error>
}
}