mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-17 12:51:04 +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
-5
@@ -37,11 +37,7 @@ class Test1 {
|
||||
if (s.equals("1")) {
|
||||
return Option.option(1);
|
||||
} else {
|
||||
return <error descr="Incompatible types. Required Option<Integer> but 'option' was inferred to Option<T>:
|
||||
no instance(s) of type variable(s) exist so that String conforms to Integer
|
||||
inference variable T has incompatible bounds:
|
||||
equality constraints: Integer
|
||||
lower bounds: String">Option.option("2");</error>
|
||||
return <error descr="Incompatible types. Found: 'Test1.Option<java.lang.String>', required: 'Test1.Option<java.lang.Integer>'">Option.option("2");</error>
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
+2
-8
@@ -12,10 +12,7 @@ class TypeArgsConsistency {
|
||||
I<Integer> i1 = (i, j) -> i + j;
|
||||
foo((i, j) -> i + j);
|
||||
I<Integer> i2 = bar((i, j) -> i + j);
|
||||
I<Integer> i3 = bar(<error descr="no instance(s) of type variable(s) exist so that String conforms to Integer
|
||||
inference variable X has incompatible bounds:
|
||||
equality constraints: Integer
|
||||
lower bounds: String">(i, j) -> "" + i + j</error>);
|
||||
I<Integer> i3 = bar(<error descr="Incompatible types. Found: 'TypeArgsConsistency.I<java.lang.Object>', required: 'TypeArgsConsistency.I<java.lang.Integer>'">(i, j) -> "" + i + j</error>);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,10 +43,7 @@ class TypeArgsConsistency2 {
|
||||
I<Integer> i1 = bar(x -> x);
|
||||
I1<Integer> i2 = bar1(x -> 1);
|
||||
I2<String> aI2 = bar2(x -> "");
|
||||
I2<Integer> aI28 = bar2( <error descr="no instance(s) of type variable(s) exist so that String conforms to Integer
|
||||
inference variable T has incompatible bounds:
|
||||
equality constraints: Integer
|
||||
lower bounds: String">x-> ""</error>);
|
||||
I2<Integer> aI28 = bar2( <error descr="Incompatible types. Found: 'TypeArgsConsistency2.I2<java.lang.Object>', required: 'TypeArgsConsistency2.I2<java.lang.Integer>'">x-> ""</error>);
|
||||
I2<Integer> i3 = bar2(x -> x);
|
||||
I2<Integer> i4 = bar2(x -> foooI());
|
||||
System.out.println(i4.foo(2));
|
||||
|
||||
Reference in New Issue
Block a user