lambda: redundant lambda param types

This commit is contained in:
Anna Kozlova
2012-08-22 14:08:27 +04:00
parent b38334d55c
commit 9a4e0f00d0
16 changed files with 342 additions and 34 deletions
@@ -0,0 +1,6 @@
// "Remove redundant types" "true"
class Test {
{
Comparable<String> r = o-> 1;
}
}
@@ -0,0 +1,16 @@
// "Remove redundant types" "true"
class Test2 {
class Y<T>{
T t;
}
interface I<X> {
X foo(Y<X> list);
}
static <T> I<T> bar(I<T> i){return i;}
{
Test2.<String>bar(y-> y.t);
}
}
@@ -0,0 +1,15 @@
// "Remove redundant types" "true"
class ReturnTypeCompatibility {
interface I1<L> {
L m(L x);
}
static <P> void call(P p, I1<P> i2) {
i2.m(null);
}
public static void main(String[] args) {
call("", i-> "");
}
}
@@ -0,0 +1,6 @@
// "Remove redundant types" "true"
class Test {
{
Comparable<String> r = (St<caret>ring o) -> 1;
}
}
@@ -0,0 +1,6 @@
// "Remove redundant types" "false"
class Test {
{
Runnable r = (<caret>) -> {};
}
}
@@ -0,0 +1,6 @@
// "Remove redundant types" "false"
class Test {
{
Comparable<String> r = <caret>o -> 1;
}
}
@@ -0,0 +1,16 @@
// "Remove redundant types" "false"
class Test2 {
class Y<T>{
T t;
}
interface I<X> {
X foo(Y<X> list);
}
static <T> I<T> bar(I<T> i){return i;}
{
Test2.bar((Y<St<caret>ring> y) -> y.t);
}
}
@@ -0,0 +1,13 @@
// "Remove redundant types" "false"
class NoInferenceResult {
interface I<A, B> {
B foo(A a);
}
<A, B> I<A, B> m(I<A, B> f) { return null; }
void test() {
m((Stri<caret>ng s1) -> s1.length());
m((String s1) -> s1);
}
}
@@ -0,0 +1,16 @@
// "Remove redundant types" "true"
class Test2 {
class Y<T>{
T t;
}
interface I<X> {
X foo(Y<X> list);
}
static <T> I<T> bar(I<T> i){return i;}
{
Test2.<String>bar((Y<St<caret>ring> y) -> y.t);
}
}
@@ -0,0 +1,15 @@
// "Remove redundant types" "true"
class ReturnTypeCompatibility {
interface I1<L> {
L m(L x);
}
static <P> void call(P p, I1<P> i2) {
i2.m(null);
}
public static void main(String[] args) {
call("", (Str<caret>ing i) -> "");
}
}