lambda: preserve partial substitutor data during substitute

This commit is contained in:
anna
2013-02-12 17:28:28 +01:00
parent c496660a79
commit b0a04ac5d2
6 changed files with 29 additions and 21 deletions

View File

@@ -22,7 +22,7 @@ class InferenceFromArgs {
bar(b, (k, v) -> {Integer i = k; return v;});
bazz(<error descr="Cyclic inference">(k, v) -> v</error>);
bazz((k, v) -> {<error descr="Incompatible types. Found: '<lambda parameter>', required: 'int'">int i = k;</error> return v;});
bazz((k, v) -> {<error descr="Incompatible types. Found: 'java.lang.Object', required: 'int'">int i = k;</error> return v;});
}
public static <T> SameArgsI<T> max() {

View File

@@ -57,7 +57,7 @@ class ReturnTypeCompatibility {
}
public static void main(String[] args) {
<error descr="Cannot resolve method 'call(<lambda expression>)'">call</error>(i-> {return i;});
call<error descr="Ambiguous method call: both 'ReturnTypeCompatibility.call(I1)' and 'ReturnTypeCompatibility.call(I2)' match">(i-> {return i;})</error>;
}
}

View File

@@ -29,8 +29,8 @@ class TypeArgsConsistency1 {
{
I<Integer> i1 = (i, j) -> i + j;
foo((i, j) -> i + j);
I<Integer> i2 =bar(<error descr="Cyclic inference">(i, j) -> i</error>) ;
I<Integer> i3 = bar(<error descr="Cyclic inference">(i, j) -> "" + i + j</error>);
I<Integer> i2 =bar((i, j) -> i) ;
I<Integer> i3 = bar(<error descr="Incompatible return type String in lambda expression">(i, j) -> "" + i + j</error>);
}
}
@@ -40,8 +40,8 @@ class TypeArgsConsistency2 {
static <T> I2<T> bar2(I2<T> i) {return i;}
public static void main(String[] args) {
I<Integer> i1 = bar(<error descr="Cyclic inference">x -> x</error>);
I1<Integer> i2 = bar1(<error descr="Cyclic inference">x -> 1</error>);
I<Integer> i1 = bar(x -> x);
I1<Integer> i2 = bar1(x -> 1);
I2<String> aI2 = bar2(x -> "");
<error descr="Incompatible types. Found: 'TypeArgsConsistency2.I2<java.lang.String>', required: 'TypeArgsConsistency2.I2<java.lang.Integer>'">I2<Integer> aI28 = bar2( x-> "");</error>
I2<Integer> i3 = bar2(x -> x);