inference errors: make applicability error thread safe so multiple threads can perform overload resolution of parent method calls independently, save presentable error when substitutor cached only

This commit is contained in:
Anna Kozlova
2017-05-08 12:12:13 +03:00
parent fa07225451
commit 77f4894aae
36 changed files with 145 additions and 136 deletions
@@ -7,6 +7,6 @@ class Test2 {
}
{
foo (bar<error descr="'bar(java.lang.Class<T>)' in 'Test2' cannot be applied to '(java.lang.Class<java.lang.String>)'">(String.class)</error>, "");
foo (bar(String.class), <error descr="'foo(java.lang.String, java.lang.Integer)' in 'Test2' cannot be applied to '(T, java.lang.String)'">""</error>);
}
}
@@ -20,10 +20,10 @@ class TestIDEA128101 {
public static void test() {
construct(String.class, createPath(integerAttribute), createPath(stringAttribute));
construct1(String.class, createPath<error descr="'createPath(TestIDEA128101.Attribute<Y>)' in 'TestIDEA128101' cannot be applied to '(TestIDEA128101.Attribute<java.lang.Integer>)'">(integerAttribute)</error>, createPath(stringAttribute));
construct1<error descr="'construct1(java.lang.Class<T>, TestIDEA128101.Path<K>...)' in 'TestIDEA128101' cannot be applied to '(java.lang.Class<java.lang.String>, TestIDEA128101.Path<Y>, TestIDEA128101.Path<java.lang.String>)'">(String.class, createPath(integerAttribute), createPath(stringAttribute))</error>;
construct2(String.class, createPath(integerAttribute), createPath(stringAttribute));
construct3(String.class, createPath<error descr="'createPath(TestIDEA128101.Attribute<Y>)' in 'TestIDEA128101' cannot be applied to '(TestIDEA128101.Attribute<java.lang.Integer>)'">(integerAttribute)</error>, createPath<error descr="'createPath(TestIDEA128101.Attribute<Y>)' in 'TestIDEA128101' cannot be applied to '(TestIDEA128101.Attribute<java.lang.String>)'">(stringAttribute)</error>);
construct4(String.class, createPath<error descr="'createPath(TestIDEA128101.Attribute<Y>)' in 'TestIDEA128101' cannot be applied to '(TestIDEA128101.Attribute<java.lang.Integer>)'">(integerAttribute)</error>, createPath<error descr="'createPath(TestIDEA128101.Attribute<Y>)' in 'TestIDEA128101' cannot be applied to '(TestIDEA128101.Attribute<java.lang.String>)'">(stringAttribute)</error>);
construct3<error descr="'construct3(java.lang.Class<java.lang.String>, TestIDEA128101.Path<? super K>...)' in 'TestIDEA128101' cannot be applied to '(java.lang.Class<java.lang.String>, TestIDEA128101.Path<Y>, TestIDEA128101.Path<Y>)'">(String.class, createPath(integerAttribute), createPath(stringAttribute))</error>;
construct4<error descr="'construct4(java.lang.Class<java.lang.String>, TestIDEA128101.Path<? super K>, TestIDEA128101.Path<? super K>)' in 'TestIDEA128101' cannot be applied to '(java.lang.Class<java.lang.String>, TestIDEA128101.Path<Y>, TestIDEA128101.Path<Y>)'">(String.class, createPath(integerAttribute), createPath(stringAttribute))</error>;
}
}
@@ -3,10 +3,14 @@ import java.util.Map;
class Test {
public static void main(String[] args) {
Map<Object, Object> b = newMapTrie<error descr="'newMapTrie()' in 'Test' cannot be applied to '()'">()</error>;
Map<Object, Map<Object, Object>> c = newMapTrie<error descr="'newMapTrie()' in 'Test' cannot be applied to '()'">()</error>;
Map<Object, Map<Object, Map<Object, Object>>> d = newMapTrie<error descr="'newMapTrie()' in 'Test' cannot be applied to '()'">()</error>;
Map<Object, Map<Object, Map<Object, Map<Object, Object>>>> e = newMapTrie<error descr="'newMapTrie()' in 'Test' cannot be applied to '()'">()</error>;
Map<Object, Object> b = <error descr="Incompatible types. Required Map<Object, Object> but 'newMapTrie' was inferred to T:
Incompatible equality constraint: Byte and Object">newMapTrie();</error>
Map<Object, Map<Object, Object>> c = <error descr="Incompatible types. Required Map<Object, Map<Object, Object>> but 'newMapTrie' was inferred to T:
Incompatible equality constraint: Byte and Object">newMapTrie();</error>
Map<Object, Map<Object, Map<Object, Object>>> d = <error descr="Incompatible types. Required Map<Object, Map<Object, Map<Object, Object>>> but 'newMapTrie' was inferred to T:
Incompatible equality constraint: Byte and Object">newMapTrie();</error>
Map<Object, Map<Object, Map<Object, Map<Object, Object>>>> e = <error descr="Incompatible types. Required Map<Object, Map<Object, Map<Object, Map<Object, Object>>>> but 'newMapTrie' was inferred to T:
Incompatible equality constraint: Byte and Object">newMapTrie();</error>
}
public static <T extends Map<Byte, T>> T newMapTrie() {
@@ -6,7 +6,11 @@ class Test {
Factory factory = new Factory();
final Class<? extends ClassB> bClass = null;
ClassB b = factory.create(bClass);
String str = factory.create<error descr="'create(java.lang.Class<T>)' in 'Test.Factory' cannot be applied to '(java.lang.Class<capture<? extends Test.ClassB>>)'">(bClass)</error>;
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
inference variable T has incompatible bounds:
equality constraints: capture of ? extends ClassB
upper bounds: ClassA<I>, Object, String">factory.create(bClass);</error>
}
public static class Factory {
@@ -29,7 +29,8 @@ public class ConcurrentCollectors {
static <T, K, D, M1 extends Map<K, D>> C<T, M1> groupingBy(F<M1> f,
C<T, D> c,
BiConsumer<M1, T> consumer) {
return new CImpl<error descr="Cannot infer arguments"><></error>(f, consumer, arg<error descr="'arg(ConcurrentCollectors.BiOp<V>)' in 'ConcurrentCollectors.Test3' cannot be applied to '(ConcurrentCollectors.BiOp<D>)'">(c.getOp())</error>);
return new CImpl<error descr="Cannot infer arguments"><></error>(f, consumer, <error descr="Incompatible types. Required BiOp<R> but 'arg' was inferred to BiOp<M2>:
no instance(s) of type variable(s) K, V exist so that R conforms to ConcurrentMap<K, V>">arg(c.getOp())</error>);
}
static <K, V, M2 extends ConcurrentMap<K, V>> BiOp<M2> arg(BiOp<V> op) {
@@ -6,7 +6,9 @@ class Test {
}
void m(List l){
boolean foo = foo<error descr="'foo(java.util.List<T>)' in 'Test' cannot be applied to '(java.util.List)'">(l)</error>;
String s = foo<error descr="'foo(java.util.List<T>)' in 'Test' cannot be applied to '(java.util.List)'">(l)</error>;
boolean foo = <error descr="Incompatible types. Required boolean but 'foo' was inferred to T:
Incompatible types: Object is not convertible to boolean">foo(l);</error>
String s = <error descr="Incompatible types. Required String but 'foo' was inferred to T:
Incompatible types: Object is not convertible to String">foo(l);</error>
}
}