eliminateWildcards -> GenericsUtil; lambda: eliminate wildcards before formal types declaration (IDEA-90578)

This commit is contained in:
Anna Kozlova
2012-08-24 21:09:48 +04:00
parent 7b7399e020
commit cf4b4e6831
16 changed files with 144 additions and 48 deletions

View File

@@ -7,7 +7,7 @@ class NoInferenceResult {
<T> void m1(T t) { }
void test() {
m(<error descr="Cyclic inference">(String s1) -> (String s2) -> s1 + s2</error>);
m(<error descr="Incompatible return type <lambda expression> in lambda expression">(String s1) -> (String s2) -> s1 + s2</error>);
m((String s1) -> s1.length());
m((String s1) -> s1);

View File

@@ -0,0 +1,48 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class Test1 {
{
Comparable<? extends Integer> c = (Integer o)->{
return 0;
};
Comparable<? super Integer> c1 = (Integer o)->{
return 0;
};
}
}
class Test2<U> {
interface I<T> {
void m(T t);
}
private void foo(I<? super U> i1) {}
private void bar() {
foo((U u) -> {});
foo(u -> {});
}
interface I1<T> {}
private <A extends I1<? super U>> A bar(A a) {
foo((U u)->{});
foo(u->{});
return a;
}
}