switch tests on new inference

(cherry picked from commit d2cbf3f2833104c3a0381059b0d6ef8ac0b3c94c)
This commit is contained in:
anna
2013-11-15 18:33:16 +01:00
parent 23432e3cd7
commit 481bc252f3
44 changed files with 698 additions and 32 deletions

View File

@@ -0,0 +1,16 @@
public class Test<E_OUT> {
final <P_IN_WRAP_SINK> Sink<P_IN_WRAP_SINK> wrapSink(Sink<E_OUT> sink) {
return null;
}
final <P_IN> void wrapAndCopyInto( Sink<E_OUT> sink, Spliterator<P_IN> spliterator) {
copyInto(wrapSink(sink), spliterator);
}
final <P_IN_COPY> void copyInto(Sink<P_IN_COPY> wrappedSink, Spliterator<P_IN_COPY> spliterator) {
}
class Sink<T> {}
interface Spliterator<A>{}
}

View File

@@ -0,0 +1,15 @@
import java.util.List;
abstract class CollectionsExamples<T> {
private List<T> getEvenL() {
return collect( toList());
}
static <TT> Collector<?, List<TT>> toList() {
return null;
}
abstract <R, A> R collect(Collector<A, R> collector);
interface Collector<A, R> {}
}

View File

@@ -0,0 +1,17 @@
import java.util.*;
public class TestInfer
{
static <V, T extends V> List<V> singleton(T item)
{
ArrayList<V> list = new ArrayList<>();
list.add(item);
return list;
}
public List<Number> test()
{
List<Number> ln = singleton(new Long(1));
return singleton(new Long(2));
}
}

View File

@@ -6,4 +6,14 @@ class Main {
Integer i = 1;
long l2 = foo(foo(i));
}
}
}
class Main1 {
static <T> T foo(long t) { return null;}
static <B> B bar(B t) { return null;}
static {
long l = foo(bar(1));
}
}

View File

@@ -0,0 +1,16 @@
class Optional<T> {}
interface TerminalOp<E_IN, R> {}
abstract class AbstractPipeline<E_OUT>{
abstract void evaluate();
abstract <R> R evaluate(TerminalOp<E_OUT, R> terminalOp);
public final Optional<E_OUT> findFirst() {
return evaluate( makeRef(true));
}
public static <T> TerminalOp<T, Optional<T>> makeRef(boolean mustFindFirst) {
return null;
}
}

View File

@@ -3,5 +3,5 @@ import java.util.Map;
public class SOE {
public static <K extends M, M extends Map<K,M>> M foo() {return null;}
public static <K1 extends M1, M1 extends Map<K1,M1>> Map<K1, M1> foo1() {return <error descr="Inferred type 'java.util.Map<K1,M1>' for type parameter 'M' is not within its bound; should implement 'java.util.Map<K1,java.util.Map<K1,M1>>'">foo()</error>;}
public static <K1 extends M1, M1 extends Map<K1,M1>> Map<K1, M1> foo1() {return <error descr="Inferred type 'java.util.Map<K1,M1>' for type parameter 'M' is not within its bound; should implement 'java.util.Map<java.util.Map<K1,M1>,java.util.Map<K1,M1>>'">foo()</error>;}
}