java inference: allow unresolved type parameters during potential compatibility check (IDEA-268866)

GitOrigin-RevId: f38e13385d534b025f8072e29a3558b0f2ecf4e7
This commit is contained in:
Anna Kozlova
2021-05-23 20:48:07 +02:00
committed by intellij-monorepo-bot
parent e2b495f4d2
commit 358f9086ce
2 changed files with 22 additions and 1 deletions

View File

@@ -54,4 +54,17 @@ class IDEA106973 {
<error descr="Incompatible types. Found: '<method reference>', required: 'IDEA106973.Function<java.lang.String,java.lang.String[]>'">Function<String, String[]> a1 = String[] :: new;</error>
Function<Short, String[]> a2 = String[] :: new;
}
}
class IDEA268866 {
interface Function<A, B> {
B apply(A a);
}
private static <T, K, U> void m(Function<? super T, ? extends K> keyMapper,
Function<? super T, ? extends U> valueMapper) {
}
private static void main(Function<Integer, Integer> identity) {
m(identity, int[]::new);
}
}