new inference: overload resolution: check return types when method refs are exact

(cherry picked from commit ccacf897e97a121f795a079e485249842c95c273)
This commit is contained in:
anna
2013-11-25 16:47:59 +01:00
parent 82fd892ec5
commit a6c82625be
3 changed files with 43 additions and 12 deletions
@@ -0,0 +1,25 @@
class Test {
interface A<X> {
X m();
}
interface B<X> extends A<X> {}
interface C<X> {}
int integerRes() { return new Integer(42); }
int intRes() { return 42; }
void m(A<Integer> a) {}
void m(B<String> b) {}
void m(C<CharSequence> b) {}
void test(boolean flag) {
m(this::integerRes);
m(flag ? this::integerRes : this::integerRes);
m(this::intRes);
m(flag ? this::intRes : this::intRes);
}
}