FIR: Rewrite Java type mapping

Previoisly, there were two places where mapping had happened:
- toConeKotlinTypeWithNullability
- enhancePossiblyFlexible

The first one was used for supertypes and bounds and the second one
was used for other signature parts

The main idea is to perform type mapping once to a flexible type,
and then use it as it's needed (it's lower bound, or for the further ehnancement)

Also, this commit fixes flexibility for type arguments, see the tests
This commit is contained in:
Denis Zharkov
2020-02-18 19:53:40 +03:00
parent 748a326104
commit 2ad8488e6a
42 changed files with 452 additions and 358 deletions
@@ -1,4 +1,4 @@
public abstract interface GenericInterfaceParameterWithSelfBound<T : R|ft<test/GenericInterfaceParameterWithSelfBound<T>, test/GenericInterfaceParameterWithSelfBound<T>?>!|> : R|kotlin/Any| {
public abstract interface GenericInterfaceParameterWithSelfBound<T : R|ft<test/GenericInterfaceParameterWithSelfBound<ft<T, T?>!>, test/GenericInterfaceParameterWithSelfBound<ft<T, T?>!>?>!|> : R|kotlin/Any| {
public abstract operator fun method(t: R|ft<T, T?>!|): R|ft<T, T?>!|
}
@@ -1,4 +1,4 @@
public abstract interface GenericInterfaceParametersWithBounds<A : R|ft<kotlin/Comparable<A>, kotlin/Comparable<A>?>!|, R|ft<kotlin/Cloneable, kotlin/Cloneable?>!|, B : R|ft<kotlin/collections/MutableList<A>, kotlin/collections/MutableList<A>?>!|> : R|kotlin/Any| {
public abstract interface GenericInterfaceParametersWithBounds<A : R|ft<kotlin/Comparable<ft<A, A?>!>, kotlin/Comparable<ft<A, A?>!>?>!|, R|ft<kotlin/Cloneable, kotlin/Cloneable?>!|, B : R|ft<kotlin/collections/MutableList<ft<A, A?>!>, kotlin/collections/List<ft<A, A?>!>?>!|> : R|kotlin/Any| {
public abstract operator fun method(a: R|ft<kotlin/Array<ft<A, A?>!>, kotlin/Array<out ft<A, A?>!>?>!|, b: R|ft<B, B?>!|): R|kotlin/Unit|
}
@@ -1,4 +1,4 @@
public abstract interface GenericMethodParameters : R|kotlin/Any| {
public abstract operator fun <A : R|ft<kotlin/CharSequence, kotlin/CharSequence?>!|, B : R|ft<kotlin/collections/MutableList<A>, kotlin/collections/MutableList<A>?>!|> method(a: R|ft<kotlin/Array<ft<A, A?>!>, kotlin/Array<out ft<A, A?>!>?>!|, b: R|ft<B, B?>!|): R|kotlin/Unit|
public abstract operator fun <A : R|ft<kotlin/CharSequence, kotlin/CharSequence?>!|, B : R|ft<kotlin/collections/MutableList<ft<A, A?>!>, kotlin/collections/List<ft<A, A?>!>?>!|> method(a: R|ft<kotlin/Array<ft<A, A?>!>, kotlin/Array<out ft<A, A?>!>?>!|, b: R|ft<B, B?>!|): R|kotlin/Unit|
}
@@ -5,7 +5,7 @@ public open class NonTrivialFunctionType : R|kotlin/Any| {
public open operator fun wildcardUnbound(comparator: R|ft<java/util/Comparator<*>, java/util/Comparator<*>?>!|): R|kotlin/Unit|
public open operator fun wildcardBound(comparator: R|ft<java/util/Comparator<in kotlin/CharSequence>, java/util/Comparator<in kotlin/CharSequence>?>!|): R|kotlin/Unit|
public open operator fun wildcardBound(comparator: R|ft<java/util/Comparator<in ft<kotlin/CharSequence, kotlin/CharSequence?>!>, java/util/Comparator<in ft<kotlin/CharSequence, kotlin/CharSequence?>!>?>!|): R|kotlin/Unit|
public constructor(): R|test/NonTrivialFunctionType|
@@ -3,7 +3,7 @@ public open class TypeParameterOfMethod : R|kotlin/Any| {
public open static operator fun <T : R|ft<kotlin/CharSequence, kotlin/CharSequence?>!|> max2(comparator: R|ft<java/util/Comparator<ft<T, T?>!>, java/util/Comparator<ft<T, T?>!>?>!|, value1: R|ft<T, T?>!|, value2: R|ft<T, T?>!|): R|ft<T, T?>!|
public open static operator fun <A : R|ft<kotlin/CharSequence, kotlin/CharSequence?>!|, B : R|ft<kotlin/collections/MutableList<A>, kotlin/collections/MutableList<A>?>!|> method(a: R|ft<java/util/Comparator<ft<A, A?>!>, java/util/Comparator<ft<A, A?>!>?>!|, b: R|ft<B, B?>!|): R|kotlin/Unit|
public open static operator fun <A : R|ft<kotlin/CharSequence, kotlin/CharSequence?>!|, B : R|ft<kotlin/collections/MutableList<ft<A, A?>!>, kotlin/collections/List<ft<A, A?>!>?>!|> method(a: R|ft<java/util/Comparator<ft<A, A?>!>, java/util/Comparator<ft<A, A?>!>?>!|, b: R|ft<B, B?>!|): R|kotlin/Unit|
public constructor(): R|test/TypeParameterOfMethod|