mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 21:11:28 +07:00
[java-highlighting] Do not report incompatible type problems when operand is lambda parameter having unknown type
Such kind of error is induced by lambda resolution error, and in most of the cases the resolution error should be fixed first Fixes IDEA-361893 "Introduce local variable" should suggest for Function expression GitOrigin-RevId: 352d0f9040dd3e153e7d5b15ae61699b8c890194
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5378001c87
commit
f592c31876
@@ -14,7 +14,7 @@ class Test {
|
||||
}
|
||||
|
||||
void fooBar(IntStream1 instr){
|
||||
Supplier<Stream<Integer>> si = () -> instr.<error descr="Ambiguous method call: both 'IntStream1.map(IntFunction<Integer>)' and 'IntStream1.map(IntUnaryOperator)' match">map</error> ((i) -> (( <error descr="Operator '%' cannot be applied to '<lambda parameter>', 'int'">i % 2</error>) == 0) ? i : <error descr="Operator '-' cannot be applied to '<lambda parameter>'">-i</error>).boxed();
|
||||
Supplier<Stream<Integer>> si = () -> instr.<error descr="Ambiguous method call: both 'IntStream1.map(IntFunction<Integer>)' and 'IntStream1.map(IntUnaryOperator)' match">map</error> ((i) -> (( i % 2) == 0) ? i : -i).boxed();
|
||||
System.out.println(si);
|
||||
Supplier<Stream<Integer>> si1 = () -> instr.map <error descr="Ambiguous method call: both 'IntStream1.map(IntFunction<Integer>)' and 'IntStream1.map(IntUnaryOperator)' match">(null)</error>.boxed();
|
||||
System.out.println(si1);
|
||||
|
||||
@@ -14,10 +14,10 @@ abstract class Test {
|
||||
foo(x -> {
|
||||
return x += 1;
|
||||
});
|
||||
<error descr="Ambiguous method call: both 'Test.foo(A)' and 'Test.foo(B)' match">foo</error>(x -> <error descr="Incompatible types. Found: 'int', required: '<lambda parameter>'">x += 1</error>);
|
||||
<error descr="Ambiguous method call: both 'Test.foo(A)' and 'Test.foo(B)' match">foo</error>(x -> x += 1);
|
||||
foo(<warning descr="Parameter 'x' is never used">x</warning> -> 1);
|
||||
foo(x -> <error descr="Operator '!' cannot be applied to 'int'">!x</error>);
|
||||
<error descr="Ambiguous method call: both 'Test.foo(A)' and 'Test.foo(B)' match">foo</error>(x -> <error descr="Operator '++' cannot be applied to '<lambda parameter>'">++x</error>);
|
||||
<error descr="Ambiguous method call: both 'Test.foo(A)' and 'Test.foo(B)' match">foo</error>(x -> ++x);
|
||||
foo(<warning descr="Parameter 'x' is never used">x</warning> -> o instanceof String ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user