more specific: lambda extended initial fix (IDEA-113357)

This commit is contained in:
Anna Kozlova
2013-09-09 21:42:47 +04:00
parent 0195034704
commit 4cae15713b
6 changed files with 198 additions and 142 deletions
@@ -22,6 +22,6 @@ class AmbiguityRawGenerics {
<Z> void foo(I3<Z> s) { }
void bar() {
foo<error descr="Ambiguous method call: both 'AmbiguityRawGenerics.foo(I)' and 'AmbiguityRawGenerics.foo(I1)' match">(()-> { throw new RuntimeException(); })</error>;
foo<error descr="Ambiguous method call: both 'AmbiguityRawGenerics.foo(I)' and 'AmbiguityRawGenerics.foo(I3<Object>)' match">(()-> { throw new RuntimeException(); })</error>;
}
}
@@ -0,0 +1,45 @@
class A {
private interface AsyncFunction<I, O> {
Promise<O> apply(I input);
}
private interface Function<I, O> {
O apply(I input);
}
private interface Promise<V> {
<T1> Promise<T1> then(Function<? super V, T1> function);
<T2> Promise<T2> then(AsyncFunction<? super V, T2> function);
}
private static Promise<Integer> calculateLength(String word) {
return null;
}
public static void main(Promise<String> helloWorld) {
helloWorld.then(A::calculateLength);
}
}
class AAmbiguous {
private interface AsyncFunction<I, O> {
O apply(I input);
}
private interface Function<I, O> {
O apply(I input);
}
private interface Promise<V> {
<T1> Promise<T1> then(Function<? super V, T1> function);
<T2> Promise<T2> then(AsyncFunction<? super V, T2> function);
}
private static Promise<Integer> calculateLength(String word) {
return null;
}
public static void main(Promise<String> helloWorld) {
helloWorld.then<error descr="Ambiguous method call: both 'Promise.then(Function<? super String,Promise<Integer>>)' and 'Promise.then(AsyncFunction<? super String,Promise<Integer>>)' match">(AAmbiguous::calculateLength)</error>;
}
}