mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
java highlighting: provide better incompatible types message on failed inference
GitOrigin-RevId: 5f97ec808f753d9ca40c417704ec93a802512745
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6a7856d5c6
commit
afa0706bfc
+1
-1
@@ -6,7 +6,7 @@ import java.util.function.Function;
|
||||
|
||||
class Test {
|
||||
{
|
||||
final Map<Comparable, List<Collection<?>>> families = sortingMerge(<error descr="Incompatible equality constraint: Integer and Comparable">(s) -> 0</error>);
|
||||
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>);
|
||||
}
|
||||
|
||||
private <C extends Comparable<C>, T> Map<C, List<T>> sortingMerge(Function<T, C> keyFunction) {
|
||||
|
||||
+1
-5
@@ -22,11 +22,7 @@ abstract class FooBar<M> {
|
||||
}
|
||||
class Test {
|
||||
<T> List<List<Object>> foo(List<T> objects, Function<T, ?>... functions) {
|
||||
return <error descr="Incompatible types. Required List<List<Object>> but 'collect' was inferred to R:
|
||||
no instance(s) of type variable(s) exist so that List<capture of ?> conforms to List<Object>
|
||||
inference variable T has incompatible bounds:
|
||||
equality constraints: List<Object>
|
||||
lower bounds: List<capture of ?>">objects.stream()
|
||||
return <error descr="Incompatible types. Found: 'java.util.List<java.util.List<capture<?>>>', required: 'java.util.List<java.util.List<java.lang.Object>>'">objects.stream()
|
||||
.map(object -> Arrays.stream(functions)
|
||||
.map(fn -> fn.apply(object))
|
||||
.collect(toList()))
|
||||
|
||||
+1
-2
@@ -9,8 +9,7 @@ class Test {
|
||||
|
||||
<R> SuperFoo<R> foo(I<R> ax) { return null; }
|
||||
|
||||
SuperFoo<String> ls = foo(<error descr="Incompatible types. Required SuperFoo<String> but 'foo' was inferred to SuperFoo<R>:
|
||||
no instance(s) of type variable(s) exist so that String conforms to Number">() -> new Foo<>()</error>);
|
||||
SuperFoo<String> ls = foo(<error descr="Incompatible types. Found: 'Test.SuperFoo<java.lang.Number>', required: 'Test.SuperFoo<java.lang.String>'">() -> new Foo<>()</error>);
|
||||
SuperFoo<Integer> li = foo(() -> new Foo<>());
|
||||
SuperFoo<?> lw = foo(() -> new Foo<>());
|
||||
}
|
||||
+1
-2
@@ -9,8 +9,7 @@ class A {
|
||||
<error descr="Missing return statement">}</error>);
|
||||
|
||||
|
||||
Map<Integer, Integer> map = Stream.iterate(5, <error descr="Incompatible types. Required Map<Integer, Integer> but 'iterate' was inferred to Stream<T>:
|
||||
no instance(s) of type variable(s) T exist so that Stream<T> conforms to Map<Integer, Integer>">t -> t + 5</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>);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ abstract class NoFormalParamTypeInferenceNeeded {
|
||||
{
|
||||
map(a -> zip(text -> text));
|
||||
zip(a -> zip(text -> text));
|
||||
Integer zip = zip(<error descr="no instance(s) of type variable(s) exist so that Object conforms to Integer">a -> zip(text -> text)</error>);
|
||||
Integer zip = zip(<error descr="Incompatible types. Found: 'java.lang.Object', required: 'java.lang.Integer'">a -> zip(text -> text)</error>);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user