K2: repeat K1 representation for flexible type parameters

This commit changes the behavior of KT-59138 effectively declining it in 2.0.
However, we plan to implement KT-59138 behavior under a feature
flag in 2.0 (see KT-66447), and switch this feature on version 2.x.

Also, this commit implements the LC resolution about postponing
KT-57014 change. We don't have KT-57014 described behavior in 2.0 anymore.
However, we plan to implement a deprecation warning here, see KT-65578.

After this commit, 6 diagnostic tests become incorrectly broken:
- 5 tests from PurelyImplementedCollection group
- a test platformTypes/nullableTypeArgument.kt

This commit also breaks currently fixed-in-k2 KT-50134
(it is fixed again in the following commits),
as well as KT-58933 (it will remain not fixed till we enable KT-59138
behavior again).

#KT-65596 In Progress
#KT-57014 In Progress
#KT-58933 Submitted
This commit is contained in:
Denis.Zharkov
2024-02-06 15:33:03 +01:00
committed by Space Team
parent 7fd46f1450
commit 81414d758d
160 changed files with 343 additions and 479 deletions
@@ -1,4 +1,4 @@
public abstract interface Comparator<T : R|kotlin/Any!|> : R|kotlin/Any| {
public abstract fun compare(o1: R|ft<T & Any, T?>|, o2: R|ft<T & Any, T?>|): R|kotlin/Int|
public abstract fun compare(o1: R|T!|, o2: R|T!|): R|kotlin/Int|
}
@@ -1,4 +1,4 @@
public abstract interface GenericInterfaceParameterWithSelfBound<T : R|ft<test/GenericInterfaceParameterWithSelfBound<ft<T & Any, T?>>, test/GenericInterfaceParameterWithSelfBound<ft<T & Any, T?>>?>|> : R|kotlin/Any| {
public abstract fun method(t: R|ft<T & Any, T?>|): R|ft<T & Any, T?>|
public abstract interface GenericInterfaceParameterWithSelfBound<T : R|ft<test/GenericInterfaceParameterWithSelfBound<T!>, test/GenericInterfaceParameterWithSelfBound<T!>?>|> : R|kotlin/Any| {
public abstract fun method(t: R|T!|): R|T!|
}
@@ -1,4 +1,4 @@
public abstract interface GenericInterfaceParametersWithBounds<A : R|ft<kotlin/Comparable<ft<A & Any, A?>>, kotlin/Comparable<ft<A & Any, A?>>?>|, R|kotlin/Cloneable!|, B : R|ft<kotlin/collections/MutableList<ft<A & Any, A?>>, kotlin/collections/List<ft<A & Any, A?>>?>|> : R|kotlin/Any| {
public abstract fun method(a: R|ft<kotlin/Array<ft<A & Any, A?>>, kotlin/Array<out ft<A & Any, A?>>?>|, b: R|ft<B & Any, B?>|): R|kotlin/Unit|
public abstract interface GenericInterfaceParametersWithBounds<A : R|ft<kotlin/Comparable<A!>, kotlin/Comparable<A!>?>|, R|kotlin/Cloneable!|, B : R|ft<kotlin/collections/MutableList<A!>, kotlin/collections/List<A!>?>|> : R|kotlin/Any| {
public abstract fun method(a: R|ft<kotlin/Array<A!>, kotlin/Array<out A!>?>|, b: R|B!|): R|kotlin/Unit|
}
@@ -1,4 +1,4 @@
public abstract interface GenericMethodParameters : R|kotlin/Any| {
public abstract fun <A : R|kotlin/CharSequence!|, B : R|ft<kotlin/collections/MutableList<ft<A & Any, A?>>, kotlin/collections/List<ft<A & Any, A?>>?>|> method(a: R|ft<kotlin/Array<ft<A & Any, A?>>, kotlin/Array<out ft<A & Any, A?>>?>|, b: R|ft<B & Any, B?>|): R|kotlin/Unit|
public abstract fun <A : R|kotlin/CharSequence!|, B : R|ft<kotlin/collections/MutableList<A!>, kotlin/collections/List<A!>?>|> method(a: R|ft<kotlin/Array<A!>, kotlin/Array<out A!>?>|, b: R|B!|): R|kotlin/Unit|
}
@@ -6,7 +6,7 @@ public abstract interface SamSubinterfaceOfTwo : R|kotlin/Any| {
}
public abstract interface Super2<T : R|kotlin/Any!|> : R|kotlin/Any| {
public abstract fun f(): R|ft<T & Any, T?>|
public abstract fun f(): R|T!|
}
}
@@ -1,5 +1,5 @@
public open class TypeParameterOfClass<T : R|kotlin/Any!|> : R|kotlin/Any| {
public open fun foo(comparator: R|ft<java/util/Comparator<ft<T & Any, T?>>, java/util/Comparator<ft<T & Any, T?>>?>|): R|kotlin/Unit|
public open fun foo(comparator: R|ft<java/util/Comparator<T!>, java/util/Comparator<T!>?>|): R|kotlin/Unit|
public constructor<T : R|kotlin/Any!|>(): R|test/TypeParameterOfClass<T>|
@@ -1,9 +1,9 @@
public open class TypeParameterOfMethod : R|kotlin/Any| {
public open static fun <T : R|kotlin/Any!|> max(comparator: R|ft<java/util/Comparator<ft<T & Any, T?>>, java/util/Comparator<ft<T & Any, T?>>?>|, value1: R|ft<T & Any, T?>|, value2: R|ft<T & Any, T?>|): R|ft<T & Any, T?>|
public open static fun <T : R|kotlin/Any!|> max(comparator: R|ft<java/util/Comparator<T!>, java/util/Comparator<T!>?>|, value1: R|T!|, value2: R|T!|): R|T!|
public open static fun <T : R|kotlin/CharSequence!|> max2(comparator: R|ft<java/util/Comparator<ft<T & Any, T?>>, java/util/Comparator<ft<T & Any, T?>>?>|, value1: R|ft<T & Any, T?>|, value2: R|ft<T & Any, T?>|): R|ft<T & Any, T?>|
public open static fun <T : R|kotlin/CharSequence!|> max2(comparator: R|ft<java/util/Comparator<T!>, java/util/Comparator<T!>?>|, value1: R|T!|, value2: R|T!|): R|T!|
public open static fun <A : R|kotlin/CharSequence!|, B : R|ft<kotlin/collections/MutableList<ft<A & Any, A?>>, kotlin/collections/List<ft<A & Any, A?>>?>|> method(a: R|ft<java/util/Comparator<ft<A & Any, A?>>, java/util/Comparator<ft<A & Any, A?>>?>|, b: R|ft<B & Any, B?>|): R|kotlin/Unit|
public open static fun <A : R|kotlin/CharSequence!|, B : R|ft<kotlin/collections/MutableList<A!>, kotlin/collections/List<A!>?>|> method(a: R|ft<java/util/Comparator<A!>, java/util/Comparator<A!>?>|, b: R|B!|): R|kotlin/Unit|
public constructor(): R|test/TypeParameterOfMethod|
@@ -2,7 +2,7 @@ public open class TypeParameterOfOuterClass<T : R|kotlin/Any!|> : R|kotlin/Any|
public constructor<T : R|kotlin/Any!|>(): R|test/TypeParameterOfOuterClass<T>|
public open inner class Inner<Outer(T) : R|kotlin/Any!|> : R|kotlin/Any| {
public open fun foo(comparator: R|ft<java/util/Comparator<ft<T & Any, T?>>, java/util/Comparator<ft<T & Any, T?>>?>|): R|kotlin/Unit|
public open fun foo(comparator: R|ft<java/util/Comparator<T!>, java/util/Comparator<T!>?>|): R|kotlin/Unit|
public test/TypeParameterOfOuterClass<T>.constructor(): R|test/TypeParameterOfOuterClass.Inner<T>|
@@ -6,7 +6,7 @@ public abstract interface InheritedSameAdaptersWithSubstitution : R|kotlin/Any|
}
public abstract interface Super2<T : R|kotlin/Any!|> : R|kotlin/Any| {
public abstract fun foo(r: R|ft<java/util/Comparator<ft<T & Any, T?>>, java/util/Comparator<ft<T & Any, T?>>?>|): R|kotlin/Unit|
public abstract fun foo(r: R|ft<java/util/Comparator<T!>, java/util/Comparator<T!>?>|): R|kotlin/Unit|
}
public abstract interface Super2Substituted : R|test/InheritedSameAdaptersWithSubstitution.Super2<kotlin/String!>| {