get rid of redundant space in error message

This commit is contained in:
Anna.Kozlova
2018-11-20 13:40:02 +01:00
parent 06daef817b
commit b015644d7a
14 changed files with 23 additions and 22 deletions

View File

@@ -1310,7 +1310,8 @@ public class InferenceSession {
variables = new ArrayList<>(variables);
((ArrayList<InferenceVariable>)variables).sort((v1, v2) -> Comparing.compare(v1.getName(), v2.getName()));
final String variablesEnumeration = StringUtil.join(variables, variable -> variable.getParameter().getName(), ", ");
registerIncompatibleErrorMessage("no instance(s) of type variable(s) " + variablesEnumeration + " exist so that " + incompatibleTypesMessage);
registerIncompatibleErrorMessage("no instance(s) of type variable(s) " + variablesEnumeration +
(variablesEnumeration.isEmpty() ? "" : " ") + "exist so that " + incompatibleTypesMessage);
}
public void registerIncompatibleErrorMessage(@NotNull String incompatibleBoundsMessage) {

View File

@@ -18,7 +18,7 @@ class MyTest {
void m(int i) {
String s = foo(switch (i) {default -> "str";});
String s1 = <error descr="Incompatible types. Required String but 'foo' was inferred to T:
no instance(s) of type variable(s) exist so that Object conforms to String">foo(switch (i) {case 1 -> new Object(); default -> "str";});</error>
no instance(s) of type variable(s) exist so that Object conforms to String">foo(switch (i) {case 1 -> new Object(); default -> "str";});</error>
String s2 = foo(() -> switch (i) {
default -> "str";
});

View File

@@ -8,6 +8,6 @@ abstract class Test {
private void call(){
String s = <error descr="Incompatible types. Required String but 'test' was inferred to T:
no instance(s) of type variable(s) exist so that String[] conforms to String">test(String[].class);</error>
no instance(s) of type variable(s) exist so that String[] conforms to String">test(String[].class);</error>
}
}

View File

@@ -3,7 +3,7 @@ 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
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>
@@ -11,14 +11,14 @@ lower bounds: Holder">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
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> 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
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>

View File

@@ -7,7 +7,7 @@ class Test {
final Class<? extends ClassB> bClass = null;
ClassB b = factory.create(bClass);
String str = <error descr="Incompatible types. Required String but 'create' was inferred to T:
no instance(s) of type variable(s) exist so that capture of ? extends ClassB conforms to String">factory.create(bClass);</error>
no instance(s) of type variable(s) exist so that capture of ? extends ClassB conforms to String">factory.create(bClass);</error>
}
public static class Factory {

View File

@@ -38,7 +38,7 @@ class Test1 {
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
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>

View File

@@ -12,7 +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
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>);
@@ -46,7 +46,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
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>);

View File

@@ -23,7 +23,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>
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()

View File

@@ -10,7 +10,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>);
no instance(s) of type variable(s) exist so that String conforms to Number">() -> new Foo<>()</error>);
SuperFoo<Integer> li = foo(() -> new Foo<>());
SuperFoo<?> lw = foo(() -> new Foo<>());
}

View File

@@ -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="no instance(s) of type variable(s) exist so that Object conforms to Integer">a -> zip(text -> text)</error>);
}
}

View File

@@ -29,14 +29,14 @@ class Test {
static void meth4(I3 s) { }
static {
meth1(Foo::<error descr="no instance(s) of type variable(s) exist so that String conforms to Number">new</error>);
meth1(Foo::<error descr="no instance(s) of type variable(s) exist so that String conforms to Number">new</error>);
meth2(Foo::new);
meth3(Foo::<error descr="no instance(s) of type variable(s) exist so that Object conforms to Number">new</error>);
meth3(Foo::<error descr="no instance(s) of type variable(s) exist so that Object conforms to Number">new</error>);
meth4<error descr="Ambiguous method call: both 'Test.meth4(I1)' and 'Test.meth4(I2)' match">(Foo::new)</error>;
meth1(Test::<error descr="no instance(s) of type variable(s) exist so that String conforms to Number">foo</error>);
meth1(Test::<error descr="no instance(s) of type variable(s) exist so that String conforms to Number">foo</error>);
meth2(Test::foo);
meth3(Test::<error descr="no instance(s) of type variable(s) exist so that Object conforms to Number">foo</error>);
meth3(Test::<error descr="no instance(s) of type variable(s) exist so that Object conforms to Number">foo</error>);
meth4<error descr="Ambiguous method call: both 'Test.meth4(I1)' and 'Test.meth4(I2)' match">(Test::foo)</error>;
}
@@ -55,8 +55,8 @@ class Test {
}
void test() {
II1 i1 = this::<error descr="no instance(s) of type variable(s) exist so that X conforms to Number">fooInstance</error>;
II1 i1 = this::<error descr="no instance(s) of type variable(s) exist so that X conforms to Number">fooInstance</error>;
II2 i2 = this::fooInstance;
II3 i3 = this::<error descr="no instance(s) of type variable(s) exist so that X conforms to Number">fooInstance</error>;
II3 i3 = this::<error descr="no instance(s) of type variable(s) exist so that X conforms to Number">fooInstance</error>;
}
}

View File

@@ -38,7 +38,7 @@ interface SimplifiedTest<B> {
<FB extends Functor<B>> FB apply(Supplier<? extends FB> fn);
static <A> SimplifiedTest<A> simple(final SimplifiedTest<? super A> regression) {
return regression::<error descr="no instance(s) of type variable(s) exist so that capture of ? extends FB conforms to Functor<capture of ? super A>">apply</error>;
return regression::<error descr="no instance(s) of type variable(s) exist so that capture of ? extends FB conforms to Functor<capture of ? super A>">apply</error>;
}
interface Functor<X> { }

View File

@@ -12,7 +12,7 @@ import java.util.function.Function;
class Test {
{
valueOf(processFirst(<error descr="no instance(s) of type variable(s) exist so that Integer conforms to char[]">x -> x</error>));
valueOf(processFirst(<error descr="no instance(s) of type variable(s) exist so that Integer conforms to char[]">x -> x</error>));
}
public static <V> V processFirst(Function<Integer,V> f){

View File

@@ -6,7 +6,7 @@ import java.util.stream.Stream;
class Test {
void foo() {
log(<error descr="no instance(s) of type variable(s) exist so that TreeSet<String> conforms to String[]">get(TreeSet<String>::new)</error>);
log(<error descr="no instance(s) of type variable(s) exist so that TreeSet<String> conforms to String[]">get(TreeSet<String>::new)</error>);
}
private void log(String params[]) {