java highlighting: provide better incompatible types message on failed inference

GitOrigin-RevId: 5f97ec808f753d9ca40c417704ec93a802512745
This commit is contained in:
Anna Kozlova
2019-07-08 12:04:21 +03:00
committed by intellij-monorepo-bot
parent 6a7856d5c6
commit afa0706bfc
28 changed files with 87 additions and 101 deletions
@@ -2,26 +2,14 @@ class Test {
{
Holder h = null;
Result<String> r1 = new Result<error descr="Cannot infer arguments"><></error>(h);
Result<String> r2 = <error descr="Incompatible types. Required Result<String> but 'create' was inferred to Result<K>:
no instance(s) of type variable(s) exist so that Holder conforms to String
inference variable K has incompatible bounds:
equality constraints: String
lower bounds: Holder">Result.create(h);</error>
Result<String> r2 = <error descr="Incompatible types. Found: 'Result<Holder>', required: 'Result<java.lang.String>'">Result.create(h);</error>
Holder dataHolder = null;
Result<String> r3 = new Result<error descr="Cannot infer arguments"><></error>(new Holder<>(dataHolder));
Result<String> r4 = <error descr="Incompatible types. Required Result<String> but 'create' was inferred to Result<K>:
no instance(s) of type variable(s) exist so that Holder conforms to String
inference variable K has incompatible bounds:
equality constraints: String
lower bounds: Holder">Result.create(new Holder<>(dataHolder));</error>
Result<String> r4 = <error descr="Incompatible types. Found: 'Result<Holder>', required: 'Result<java.lang.String>'">Result.create(new Holder<>(dataHolder));</error>
Result<String> r5 = new Result<error descr="Cannot infer arguments"><></error>(Holder.create(dataHolder));
Result<String> r6 = <error descr="Incompatible types. Required Result<String> but 'create' was inferred to Result<K>:
no instance(s) of type variable(s) exist so that Holder conforms to String
inference variable K has incompatible bounds:
equality constraints: String
lower bounds: Holder">Result.create(Holder.create(dataHolder));</error>
Result<String> r6 = <error descr="Incompatible types. Found: 'Result<Holder>', required: 'Result<java.lang.String>'">Result.create(Holder.create(dataHolder));</error>
}
}