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
@@ -4,7 +4,7 @@ public abstract interface ArraysInSubtypes : R|kotlin/Any| {
public abstract fun listOfArray(): R|ft<kotlin/collections/MutableList<out ft<kotlin/Array<kotlin/String!>, kotlin/Array<out kotlin/String!>?>>, kotlin/collections/List<out ft<kotlin/Array<kotlin/String!>, kotlin/Array<out kotlin/String!>?>>?>|
public abstract fun objArray(): R|ft<kotlin/Array<ft<T & Any, T?>>, kotlin/Array<out ft<T & Any, T?>>?>|
public abstract fun objArray(): R|ft<kotlin/Array<T!>, kotlin/Array<out T!>?>|
}
public abstract interface Super : R|kotlin/Any| {
@@ -1,6 +1,6 @@
public abstract interface MethodTypeParameterErased : R|kotlin/Any| {
public abstract interface Bug<T : R|kotlin/Any!|> : R|kotlin/Any| {
public abstract fun <RET : R|ft<test/MethodTypeParameterErased.Bug<ft<T & Any, T?>>, test/MethodTypeParameterErased.Bug<ft<T & Any, T?>>?>|> save(): R|ft<RET & Any, RET?>|
public abstract fun <RET : R|ft<test/MethodTypeParameterErased.Bug<T!>, test/MethodTypeParameterErased.Bug<T!>?>|> save(): R|RET!|
}
public open class SubBug : R|kotlin/Any|, R|test/MethodTypeParameterErased.Bug<kotlin/Any!>| {
@@ -10,7 +10,7 @@ public open class RawSuperType : R|kotlin/Any| {
}
public abstract interface Super<T : R|kotlin/Any!|> : R|kotlin/Any| {
public abstract fun foo(t: R|ft<T & Any, T?>|): R|kotlin/Unit|
public abstract fun foo(t: R|T!|): R|kotlin/Unit|
public abstract fun dummy(): R|kotlin/Unit|
@@ -14,7 +14,7 @@ public open class RawSuperTypeWithBound : R|kotlin/Any| {
}
public abstract interface Super<T : R|test/RawSuperTypeWithBound.Bound!|> : R|kotlin/Any| {
public abstract fun foo(t: R|ft<T & Any, T?>|): R|kotlin/Unit|
public abstract fun foo(t: R|T!|): R|kotlin/Unit|
public abstract fun dummy(): R|kotlin/Unit|
@@ -11,8 +11,8 @@ public open class RawSuperTypeWithRecursiveBound : R|kotlin/Any| {
public test/RawSuperTypeWithRecursiveBound.constructor(): R|test/RawSuperTypeWithRecursiveBound.Derived|
}
public abstract interface Super<T : R|ft<test/RawSuperTypeWithRecursiveBound.Super<ft<T & Any, T?>>, test/RawSuperTypeWithRecursiveBound.Super<ft<T & Any, T?>>?>|> : R|kotlin/Any| {
public abstract fun foo(t: R|ft<T & Any, T?>|): R|kotlin/Unit|
public abstract interface Super<T : R|ft<test/RawSuperTypeWithRecursiveBound.Super<T!>, test/RawSuperTypeWithRecursiveBound.Super<T!>?>|> : R|kotlin/Any| {
public abstract fun foo(t: R|T!|): R|kotlin/Unit|
public abstract fun dummy(): R|kotlin/Unit|
@@ -11,8 +11,8 @@ public open class RawSuperTypeWithRecursiveBoundMultipleParameters : R|kotlin/An
public test/RawSuperTypeWithRecursiveBoundMultipleParameters.constructor(): R|test/RawSuperTypeWithRecursiveBoundMultipleParameters.Derived|
}
public abstract interface Super<R : R|kotlin/Any!|, T : R|ft<test/RawSuperTypeWithRecursiveBoundMultipleParameters.Super<ft<R & Any, R?>, ft<T & Any, T?>>, test/RawSuperTypeWithRecursiveBoundMultipleParameters.Super<ft<R & Any, R?>, ft<T & Any, T?>>?>|> : R|kotlin/Any| {
public abstract fun foo(r: R|ft<R & Any, R?>|, t: R|ft<T & Any, T?>|): R|kotlin/Unit|
public abstract interface Super<R : R|kotlin/Any!|, T : R|ft<test/RawSuperTypeWithRecursiveBoundMultipleParameters.Super<R!, T!>, test/RawSuperTypeWithRecursiveBoundMultipleParameters.Super<R!, T!>?>|> : R|kotlin/Any| {
public abstract fun foo(r: R|R!|, t: R|T!|): R|kotlin/Unit|
public abstract fun dummy(): R|kotlin/Unit|
@@ -1,9 +1,9 @@
public abstract interface ReturnInnerSubclassOfSupersInner : R|kotlin/Any| {
public open class Sub<B : R|kotlin/Any!|> : R|test/ReturnInnerSubclassOfSupersInner.Super<ft<B & Any, B?>>| {
public open class Sub<B : R|kotlin/Any!|> : R|test/ReturnInnerSubclassOfSupersInner.Super<B!>| {
public constructor<B : R|kotlin/Any!|>(): R|test/ReturnInnerSubclassOfSupersInner.Sub<B>|
public/*package*/ open inner class Inner<Outer(B) : R|kotlin/Any!|> : R|test/ReturnInnerSubclassOfSupersInner.Super.Inner<ft<B & Any, B?>>| {
public/*package*/ open fun get(): R|ft<test/ReturnInnerSubclassOfSupersInner.Sub<ft<B & Any, B?>>, test/ReturnInnerSubclassOfSupersInner.Sub<ft<B & Any, B?>>?>|
public/*package*/ open inner class Inner<Outer(B) : R|kotlin/Any!|> : R|test/ReturnInnerSubclassOfSupersInner.Super.Inner<B!>| {
public/*package*/ open fun get(): R|ft<test/ReturnInnerSubclassOfSupersInner.Sub<B!>, test/ReturnInnerSubclassOfSupersInner.Sub<B!>?>|
public/*package*/ test/ReturnInnerSubclassOfSupersInner.Sub<B>.constructor(): R|test/ReturnInnerSubclassOfSupersInner.Sub.Inner<B>|
@@ -13,7 +13,7 @@ public abstract interface ReturnInnerSubclassOfSupersInner : R|kotlin/Any| {
public constructor<A : R|kotlin/Any!|>(): R|test/ReturnInnerSubclassOfSupersInner.Super<A>|
public/*package*/ open inner class Inner<Outer(A) : R|kotlin/Any!|> : R|kotlin/Any| {
public/*package*/ open fun get(): R|ft<test/ReturnInnerSubclassOfSupersInner.Super<ft<A & Any, A?>>, test/ReturnInnerSubclassOfSupersInner.Super<ft<A & Any, A?>>?>|
public/*package*/ open fun get(): R|ft<test/ReturnInnerSubclassOfSupersInner.Super<A!>, test/ReturnInnerSubclassOfSupersInner.Super<A!>?>|
public/*package*/ test/ReturnInnerSubclassOfSupersInner.Super<A>.constructor(): R|test/ReturnInnerSubclassOfSupersInner.Super.Inner<A>|