new inference: move test

This commit is contained in:
anna
2013-09-26 19:16:12 +02:00
parent 4cb7d5c950
commit 2ea47e35b1
12 changed files with 15 additions and 14 deletions
@@ -2,6 +2,6 @@ class A<T> {
<T extends A<T>> void foo(T x){}
void bar(A<?> x){
foo<error descr="'foo(T)' in 'A' cannot be applied to '(A<capture<?>>)'">(x)</error>;
<error descr="Inferred type 'capture<?>' for type parameter 'T' is not within its bound; should extend 'A<capture<? extends A<capture<?>>>>'">foo(x)</error>;
}
}
@@ -22,8 +22,8 @@ class B<T> extends A<A<T>> {
foo3<error descr="'foo3(A<A<?>>)' in 'B' cannot be applied to '(B<capture<? super java.lang.String>>)'">(sb)</error>;
foo3<error descr="'foo3(A<A<? extends java.lang.String>>)' in 'B' cannot be applied to '(B<java.lang.String>)'">(s)</error>;
foo4<error descr="'foo4(A<A<? super T>>)' in 'B' cannot be applied to '(B<capture<?>>)'">(b)</error>;
foo4<error descr="'foo4(A<A<? super T>>)' in 'B' cannot be applied to '(B<capture<? extends java.lang.String>>)'">(eb)</error>;
foo4<error descr="'foo4(A<A<? super java.lang.Object>>)' in 'B' cannot be applied to '(B<capture<?>>)'">(b)</error>;
foo4<error descr="'foo4(A<A<? super java.lang.Object>>)' in 'B' cannot be applied to '(B<capture<? extends java.lang.String>>)'">(eb)</error>;
foo4<error descr="'foo4(A<A<? super java.lang.String>>)' in 'B' cannot be applied to '(B<capture<? super java.lang.String>>)'">(sb)</error>;
foo4<error descr="'foo4(A<A<? super java.lang.String>>)' in 'B' cannot be applied to '(B<java.lang.String>)'">(s)</error>;
@@ -3,7 +3,7 @@ abstract class A<T>{
<S extends Number & Comparable<? extends Number>> void baz(A<S> a){}
void bar(A<Long> x, A<Integer> y){
baz<error descr="'baz(A<S>)' in 'A' cannot be applied to '(A<capture<? extends java.lang.Number & java.lang.Comparable<? extends java.lang.Comparable<?>>>>)'">(foo(x, y))</error>;
<error descr="Inferred type 'capture<? extends java.lang.Number & java.lang.Comparable<? extends java.lang.Comparable<?>>>' for type parameter 'S' is not within its bound; should implement 'java.lang.Comparable<? extends java.lang.Number>'">baz(foo(x, y))</error>;
}
}
@@ -12,6 +12,6 @@ abstract class A1<T>{
<T extends Number & Comparable<?>, S extends Number & Comparable<? extends T>> void baz(A1<S> a){}
void bar(A1<Long> x, A1<Integer> y){
baz<error descr="'baz(A1<S>)' in 'A1' cannot be applied to '(A1<capture<? extends java.lang.Number & java.lang.Comparable<? extends java.lang.Comparable<?>>>>)'">(foo(x, y))</error>;
<error descr="Inferred type 'capture<? extends java.lang.Number & java.lang.Comparable<? extends java.lang.Comparable<?>>>' for type parameter 'S' is not within its bound; should implement 'java.lang.Comparable<? extends java.lang.Number & java.lang.Comparable<?>>'">baz(foo(x, y))</error>;
}
}
@@ -11,6 +11,6 @@ abstract class A1{
abstract <T> T baz(List<? super T> a);
void bar(List<?> x){
String o = baz<error descr="'baz(java.util.List<? super T>)' in 'A1' cannot be applied to '(java.util.List<capture<?>>)'">(x)</error>;
String o = baz<error descr="'baz(java.util.List<? super java.lang.String>)' in 'A1' cannot be applied to '(java.util.List<capture<?>>)'">(x)</error>;
}
}
@@ -4,6 +4,6 @@ abstract class A {
abstract <T> T baz(List<? super List<? super T>> a);
void bar(C<?> x){
baz<error descr="'baz(java.util.List<? super java.util.List<? super T>>)' in 'A' cannot be applied to '(C<capture<?>>)'">(x)</error>;
baz<error descr="'baz(java.util.List<? super java.util.List<? super java.lang.Object>>)' in 'A' cannot be applied to '(C<capture<?>>)'">(x)</error>;
}
}
@@ -1,6 +1,6 @@
class C<T extends C<? extends C<? extends T>>>{
void foo(C<?> x){
bar<error descr="'bar(C<T>)' in 'C' cannot be applied to '(C<capture<?>>)'">(x)</error>;
<error descr="Inferred type 'capture<? extends C<? extends C<capture<?>>>>' for type parameter 'T' is not within its bound; should extend 'C<capture<? extends C<? extends C<capture<?>>>>>'">bar(x)</error>;
}
<T extends C<? extends T>> void bar(C<T> x){}
}
@@ -8,7 +8,7 @@ abstract class B {
void bar(List<List<?>> x, List<List<List<?>>> y){
foo(x) [0] = "";
foo1<error descr="'foo1(java.util.List<? extends java.util.List<T>>)' in 'B' cannot be applied to '(java.util.List<java.util.List<?>>)'">(x)</error> [0] = "";
foo1<error descr="'foo1(java.util.List<? extends java.util.List<java.lang.Object>>)' in 'B' cannot be applied to '(java.util.List<java.util.List<?>>)'">(x)</error> [0] = "";
foo2<error descr="'foo2(java.util.List<java.util.List<? super java.util.List<java.lang.Object>>>)' in 'B' cannot be applied to '(java.util.List<java.util.List<java.util.List<?>>>)'">(y)</error> [0] = "";
String s = foo0(x);
@@ -10,7 +10,7 @@ class Test {
public void test(Set<MyConsumer> set) {
@SuppressWarnings("unchecked")
Map<Parent, MyConsumer<Parent>> map = create<error descr="'create(java.util.Set<T>)' in 'Test' cannot be applied to '(java.util.Set<Test.MyConsumer>)'">(set)</error>;
<error descr="Incompatible types. Found: 'java.util.Map<Test.Parent,Test.MyConsumer>', required: 'java.util.Map<Test.Parent,Test.MyConsumer<Test.Parent>>'">Map<Parent, MyConsumer<Parent>> map = create(set);</error>
}
@@ -8,7 +8,7 @@ public class GenericsTest98 {
List<Movable<? extends Serializable>> list = new ArrayList<Movable<? extends Serializable>> ();
Factory factory = Factory.newInstance();
// Doesn't compile, but Idea doesn't complain
Mover<? extends Serializable> mover = factory.getNew<error descr="'getNew(java.util.List<? extends Movable<T>>)' in 'Factory' cannot be applied to '(java.util.List<Movable<? extends java.io.Serializable>>)'">(list)</error>;
Mover<? extends Serializable> mover = factory.getNew<error descr="'getNew(java.util.List<? extends Movable<java.io.Serializable>>)' in 'Factory' cannot be applied to '(java.util.List<Movable<? extends java.io.Serializable>>)'">(list)</error>;
}
}
@@ -1,6 +1,6 @@
class D<T> {
void foo(D<?> x){
bar<error descr="'bar(D<? extends T>, D<? super T>)' in 'D' cannot be applied to '(D<capture<?>>, D<capture<?>>)'">(x,x)</error>;
bar<error descr="'bar(D<?>, D<? super java.lang.Object>)' in 'D' cannot be applied to '(D<capture<?>>, D<capture<?>>)'">(x,x)</error>;
}
<T> void bar(D<? extends T> x, D<? super T> y){}
}
@@ -10,6 +10,6 @@ class Node<NodeTypeT extends NodeType> {
class Main {
public static void main(NodeProperty<NumberExpression, Integer> nval, Node<? extends NodeType> expr) {
int val = expr.get<error descr="'get(NodeProperty<? super capture<? extends NodeType>,ValueT>)' in 'Node' cannot be applied to '(NodeProperty<NumberExpression,java.lang.Integer>)'">(nval)</error>;
int val = expr.get<error descr="'get(NodeProperty<? super capture<? extends NodeType>,java.lang.Integer>)' in 'Node' cannot be applied to '(NodeProperty<NumberExpression,java.lang.Integer>)'">(nval)</error>;
}
}