[FIR] Consider variance of type parameters during java type enhancement

#KT-41940 Fixed
This commit is contained in:
Dmitriy Novozhilov
2020-09-24 12:46:47 +03:00
parent a0db510e49
commit 4ef57c120f
10 changed files with 88 additions and 24 deletions
@@ -0,0 +1,23 @@
// ISSUE: KT-41940
// FILE: Matcher.java
public interface Matcher<T> {}
// FILE: Matchers.java
public class Matchers {
public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(T item) {
return null;
}
public static <T> void assertThat(T actual, Matcher<? super T> matcher) {}
}
// FILE: main.kt
import Matchers.*
fun test(list: List<String>, string: String) {
assertThat(list, <!DEBUG_INFO_EXPRESSION_TYPE("Matcher<kotlin.collections.MutableIterable<*>..kotlin.collections.Iterable<*>?!>..Matcher<kotlin.collections.MutableIterable<*>..kotlin.collections.Iterable<*>?!>?!")!>hasItem(string)<!>)
}
@@ -0,0 +1,4 @@
FILE: main.kt
public final fun test(list: R|kotlin/collections/List<kotlin/String>|, string: R|kotlin/String|): R|kotlin/Unit| {
R|/Matchers.assertThat|<R|ft<kotlin/collections/List<kotlin/String>, kotlin/collections/List<kotlin/String>?>!|>(R|<local>/list|, R|/Matchers.hasItem|<R|ft<kotlin/String, kotlin/String?>!|>(R|<local>/string|))
}