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,6 +1,6 @@
public abstract interface DeeplySubstitutedClassParameter : R|kotlin/Any| {
public abstract interface Middle<E : R|kotlin/Any!|> : R|test/DeeplySubstitutedClassParameter.Super<ft<E & Any, E?>>| {
public abstract fun foo(p: R|ft<E & Any, E?>|): R|kotlin/Unit|
public abstract interface Middle<E : R|kotlin/Any!|> : R|test/DeeplySubstitutedClassParameter.Super<E!>| {
public abstract fun foo(p: R|E!|): R|kotlin/Unit|
}
public abstract interface Sub : R|test/DeeplySubstitutedClassParameter.Middle<kotlin/String!>| {
@@ -8,7 +8,7 @@ public abstract interface DeeplySubstitutedClassParameter : R|kotlin/Any| {
}
public abstract interface Super<T : R|kotlin/Any!|> : R|kotlin/Any| {
public abstract fun foo(p: R|ft<T & Any, T?>|): R|kotlin/Unit|
public abstract fun foo(p: R|T!|): R|kotlin/Unit|
public abstract fun dummy(): R|kotlin/Unit|
@@ -1,12 +1,12 @@
public abstract interface DeeplySubstitutedClassParameter2 : R|kotlin/Any| {
public abstract interface Middle<E : R|kotlin/Any!|> : R|test/DeeplySubstitutedClassParameter2.Super<ft<E & Any, E?>>| {
public abstract interface Middle<E : R|kotlin/Any!|> : R|test/DeeplySubstitutedClassParameter2.Super<E!>| {
}
public abstract interface Sub : R|test/DeeplySubstitutedClassParameter2.Middle<kotlin/String!>| {
public abstract fun foo(p: R|kotlin/String!|): R|kotlin/Unit|
}
public abstract interface Super<T : R|kotlin/Any!|> : R|kotlin/Any| {
public abstract fun foo(p: R|ft<T & Any, T?>|): R|kotlin/Unit|
public abstract fun foo(p: R|T!|): R|kotlin/Unit|
public abstract fun dummy(): R|kotlin/Unit|
@@ -10,7 +10,7 @@ public abstract interface Kt3302 : R|kotlin/Any| {
}
public abstract interface LinkedHashMap<K : R|kotlin/Any!|, V : R|kotlin/Any!|> : R|kotlin/Any| {
public abstract fun put(key: R|ft<K & Any, K?>|, value: R|ft<V & Any, V?>|): R|ft<V & Any, V?>|
public abstract fun put(key: R|K!|, value: R|V!|): R|V!|
public abstract fun dummy(): R|kotlin/Unit|
@@ -1,10 +1,10 @@
public abstract interface OverrideWithErasedParameter : R|kotlin/Any| {
public abstract interface Sub<T : R|kotlin/Any!|> : R|test/OverrideWithErasedParameter.Super<ft<T & Any, T?>>| {
public abstract interface Sub<T : R|kotlin/Any!|> : R|test/OverrideWithErasedParameter.Super<T!>| {
public abstract fun foo(o: R|kotlin/Any!|): R|kotlin/Unit|
}
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|
@@ -1,6 +1,6 @@
public abstract interface SubclassFromGenericAndNot : R|kotlin/Any| {
public abstract interface Generic<T : R|kotlin/Any!|> : R|kotlin/Any| {
public abstract fun foo(key: R|ft<T & Any, T?>|): R|kotlin/Unit|
public abstract fun foo(key: R|T!|): R|kotlin/Unit|
public abstract fun dummy(): R|kotlin/Unit|
@@ -4,7 +4,7 @@ public abstract interface SubstitutedClassParameter : R|kotlin/Any| {
}
public abstract interface Super<T : R|kotlin/Any!|> : R|kotlin/Any| {
public abstract fun foo(p: R|ft<T & Any, T?>|): R|kotlin/Unit|
public abstract fun foo(p: R|T!|): R|kotlin/Unit|
public abstract fun dummy(): R|kotlin/Unit|
@@ -4,13 +4,13 @@ public abstract interface SubstitutedClassParameters : R|kotlin/Any| {
}
public abstract interface Super1<T : R|kotlin/Any!|> : R|kotlin/Any| {
public abstract fun foo(p: R|ft<T & Any, T?>|): R|kotlin/Unit|
public abstract fun foo(p: R|T!|): R|kotlin/Unit|
public abstract fun dummy(): R|kotlin/Unit|
}
public abstract interface Super2<E : R|kotlin/Any!|> : R|kotlin/Any| {
public abstract fun foo(p: R|ft<E & Any, E?>|): R|kotlin/Unit|
public abstract fun foo(p: R|E!|): R|kotlin/Unit|
public abstract fun dummy(): R|kotlin/Unit|
@@ -1,6 +1,6 @@
public abstract interface DeeplySubstitutedClassParameter : R|kotlin/Any| {
public abstract interface Middle<E : R|kotlin/Any!|> : R|test/DeeplySubstitutedClassParameter.Super<ft<E & Any, E?>>| {
public abstract fun foo(): R|ft<E & Any, E?>|
public abstract interface Middle<E : R|kotlin/Any!|> : R|test/DeeplySubstitutedClassParameter.Super<E!>| {
public abstract fun foo(): R|E!|
}
public abstract interface Sub : R|test/DeeplySubstitutedClassParameter.Middle<kotlin/String!>| {
@@ -8,7 +8,7 @@ public abstract interface DeeplySubstitutedClassParameter : R|kotlin/Any| {
}
public abstract interface Super<T : R|kotlin/Any!|> : R|kotlin/Any| {
public abstract fun foo(): R|ft<T & Any, T?>|
public abstract fun foo(): R|T!|
public abstract fun dummy(): R|kotlin/Unit|
@@ -1,12 +1,12 @@
public abstract interface DeeplySubstitutedClassParameter2 : R|kotlin/Any| {
public abstract interface Middle<E : R|kotlin/Any!|> : R|test/DeeplySubstitutedClassParameter2.Super<ft<E & Any, E?>>| {
public abstract interface Middle<E : R|kotlin/Any!|> : R|test/DeeplySubstitutedClassParameter2.Super<E!>| {
}
public abstract interface Sub : R|test/DeeplySubstitutedClassParameter2.Middle<kotlin/String!>| {
public abstract fun foo(): R|kotlin/String!|
}
public abstract interface Super<T : R|kotlin/Any!|> : R|kotlin/Any| {
public abstract fun foo(): R|ft<T & Any, T?>|
public abstract fun foo(): R|T!|
public abstract fun dummy(): R|kotlin/Unit|
@@ -9,6 +9,6 @@ public abstract interface HalfSubstitutedTypeParameters : R|kotlin/Any| {
public abstract fun dummy(): R|kotlin/Unit|
}
public abstract interface TrickyList<X : R|kotlin/Any!|, E : R|kotlin/Any!|> : R|kotlin/collections/MutableList<ft<E & Any, E?>>| {
public abstract interface TrickyList<X : R|kotlin/Any!|, E : R|kotlin/Any!|> : R|kotlin/collections/MutableList<E!>| {
}
}
@@ -1,6 +1,6 @@
public abstract interface SubclassFromGenericAndNot : R|kotlin/Any| {
public abstract interface Generic<T : R|kotlin/Any!|> : R|kotlin/Any| {
public abstract fun foo(): R|ft<T & Any, T?>|
public abstract fun foo(): R|T!|
public abstract fun dummy(): R|kotlin/Unit|
@@ -1,4 +1,4 @@
public abstract interface SubclassOfCollection<E : R|kotlin/Any!|> : R|kotlin/collections/MutableCollection<ft<E & Any, E?>>| {
public abstract operator fun iterator(): R|@EnhancedNullability kotlin/collections/MutableIterator<ft<E & Any, E?>>|
public abstract interface SubclassOfCollection<E : R|kotlin/Any!|> : R|kotlin/collections/MutableCollection<E!>| {
public abstract operator fun iterator(): R|@EnhancedNullability kotlin/collections/MutableIterator<E!>|
}
@@ -1,4 +1,4 @@
public abstract interface SubclassOfMapEntry<K : R|kotlin/Any!|, V : R|kotlin/Any!|> : R|kotlin/collections/MutableMap.MutableEntry<ft<K & Any, K?>, ft<V & Any, V?>>| {
public abstract fun setValue(value: R|ft<V & Any, V?>|): R|ft<V & Any, V?>|
public abstract interface SubclassOfMapEntry<K : R|kotlin/Any!|, V : R|kotlin/Any!|> : R|kotlin/collections/MutableMap.MutableEntry<K!, V!>| {
public abstract fun setValue(value: R|V!|): R|V!|
}
@@ -4,7 +4,7 @@ public abstract interface SubstitutedClassParameter : R|kotlin/Any| {
}
public abstract interface Super<T : R|kotlin/Any!|> : R|kotlin/Any| {
public abstract fun foo(): R|ft<T & Any, T?>|
public abstract fun foo(): R|T!|
public abstract fun dummy(): R|kotlin/Unit|
@@ -4,13 +4,13 @@ public abstract interface SubstitutedClassParameters : R|kotlin/Any| {
}
public abstract interface Super1<T : R|kotlin/Any!|> : R|kotlin/Any| {
public abstract fun foo(): R|ft<T & Any, T?>|
public abstract fun foo(): R|T!|
public abstract fun dummy(): R|kotlin/Unit|
}
public abstract interface Super2<E : R|kotlin/Any!|> : R|kotlin/Any| {
public abstract fun foo(): R|ft<E & Any, E?>|
public abstract fun foo(): R|E!|
public abstract fun dummy(): R|kotlin/Unit|
@@ -1,5 +1,5 @@
public abstract interface TypeParamOfClass : R|kotlin/Any| {
public abstract interface Sub<T : R|kotlin/Any!|> : R|test/TypeParamOfClass.Super<ft<T & Any, T?>>| {
public abstract interface Sub<T : R|kotlin/Any!|> : R|test/TypeParamOfClass.Super<T!>| {
public abstract fun foo(): R|@EnhancedNullability T & Any|
}
@@ -1,10 +1,10 @@
public abstract interface InheritNullability : R|kotlin/Any| {
public abstract interface Sub : R|test/InheritNullability.Super| {
public abstract fun <B : R|kotlin/CharSequence!|> foo(b: R|ft<B & Any, B?>|): R|kotlin/Unit|
public abstract fun <B : R|kotlin/CharSequence!|> foo(b: R|B!|): R|kotlin/Unit|
}
public abstract interface Super : R|kotlin/Any| {
public abstract fun <A : R|kotlin/CharSequence!|> foo(a: R|ft<A & Any, A?>|): R|kotlin/Unit|
public abstract fun <A : R|kotlin/CharSequence!|> foo(a: R|A!|): R|kotlin/Unit|
}
}
@@ -1,10 +1,10 @@
public abstract interface TwoBounds : R|kotlin/Any| {
public abstract interface Sub : R|test/TwoBounds.Super| {
public abstract fun <B : R|kotlin/CharSequence!|, R|kotlin/Cloneable!|> foo(b: R|ft<B & Any, B?>|): R|kotlin/Unit|
public abstract fun <B : R|kotlin/CharSequence!|, R|kotlin/Cloneable!|> foo(b: R|B!|): R|kotlin/Unit|
}
public abstract interface Super : R|kotlin/Any| {
public abstract fun <A : R|kotlin/CharSequence!|, R|kotlin/Cloneable!|> foo(a: R|ft<A & Any, A?>|): R|kotlin/Unit|
public abstract fun <A : R|kotlin/CharSequence!|, R|kotlin/Cloneable!|> foo(a: R|A!|): R|kotlin/Unit|
}
}
@@ -1,14 +1,14 @@
public abstract interface TwoSuperclasses : R|kotlin/Any| {
public abstract interface Sub : R|test/TwoSuperclasses.Super1|, R|test/TwoSuperclasses.Super2| {
public abstract fun <C : R|kotlin/CharSequence!|> foo(c: R|ft<C & Any, C?>|): R|kotlin/Unit|
public abstract fun <C : R|kotlin/CharSequence!|> foo(c: R|C!|): R|kotlin/Unit|
}
public abstract interface Super1 : R|kotlin/Any| {
public abstract fun <A : R|kotlin/CharSequence!|> foo(a: R|ft<A & Any, A?>|): R|kotlin/Unit|
public abstract fun <A : R|kotlin/CharSequence!|> foo(a: R|A!|): R|kotlin/Unit|
}
public abstract interface Super2 : R|kotlin/Any| {
public abstract fun <B : R|kotlin/CharSequence!|> foo(a: R|ft<B & Any, B?>|): R|kotlin/Unit|
public abstract fun <B : R|kotlin/CharSequence!|> foo(a: R|B!|): R|kotlin/Unit|
}
}
@@ -1,10 +1,10 @@
public abstract interface TwoTypeParameters : R|kotlin/Any| {
public abstract interface Sub : R|test/TwoTypeParameters.Super| {
public abstract fun <B : R|kotlin/CharSequence!|, A : R|kotlin/Cloneable!|> foo(b: R|ft<B & Any, B?>|, a: R|ft<A & Any, A?>|): R|kotlin/Unit|
public abstract fun <B : R|kotlin/CharSequence!|, A : R|kotlin/Cloneable!|> foo(b: R|B!|, a: R|A!|): R|kotlin/Unit|
}
public abstract interface Super : R|kotlin/Any| {
public abstract fun <A : R|kotlin/CharSequence!|, B : R|kotlin/Cloneable!|> foo(a: R|ft<A & Any, A?>|, b: R|ft<B & Any, B?>|): R|kotlin/Unit|
public abstract fun <A : R|kotlin/CharSequence!|, B : R|kotlin/Cloneable!|> foo(a: R|A!|, b: R|B!|): R|kotlin/Unit|
}
}
@@ -1,12 +1,12 @@
public abstract interface UseParameterAsUpperBound : R|kotlin/Any| {
public abstract interface Sub : R|test/UseParameterAsUpperBound.Super| {
public abstract fun <B : R|kotlin/Any!|, A : R|ft<B & Any, B?>|> foo(b: R|ft<B & Any, B?>|, a: R|ft<A & Any, A?>|): R|kotlin/Unit|
public abstract fun <B : R|kotlin/Any!|, A : R|B!|> foo(b: R|B!|, a: R|A!|): R|kotlin/Unit|
public abstract fun <A : R|kotlin/Any!|, B : R|ft<A & Any, A?>|> foo(a: R|ft<A & Any, A?>|, b: R|ft<B & Any, B?>|): R|kotlin/Unit|
public abstract fun <A : R|kotlin/Any!|, B : R|A!|> foo(a: R|A!|, b: R|B!|): R|kotlin/Unit|
}
public abstract interface Super : R|kotlin/Any| {
public abstract fun <A : R|kotlin/Any!|, B : R|ft<A & Any, A?>|> foo(a: R|ft<A & Any, A?>|, b: R|ft<B & Any, B?>|): R|kotlin/Unit|
public abstract fun <A : R|kotlin/Any!|, B : R|A!|> foo(a: R|A!|, b: R|B!|): R|kotlin/Unit|
}
}
@@ -1,10 +1,10 @@
public abstract interface UseParameterInUpperBound : R|kotlin/Any| {
public abstract interface Sub : R|test/UseParameterInUpperBound.Super| {
public abstract fun <B : R|kotlin/Any!|, A : R|ft<kotlin/collections/MutableList<ft<B & Any, B?>>, kotlin/collections/List<ft<B & Any, B?>>?>|> foo(b: R|ft<B & Any, B?>|, a: R|ft<A & Any, A?>|): R|kotlin/Unit|
public abstract fun <B : R|kotlin/Any!|, A : R|ft<kotlin/collections/MutableList<B!>, kotlin/collections/List<B!>?>|> foo(b: R|B!|, a: R|A!|): R|kotlin/Unit|
}
public abstract interface Super : R|kotlin/Any| {
public abstract fun <A : R|kotlin/Any!|, B : R|ft<kotlin/collections/MutableList<ft<A & Any, A?>>, kotlin/collections/List<ft<A & Any, A?>>?>|> foo(a: R|ft<A & Any, A?>|, b: R|ft<B & Any, B?>|): R|kotlin/Unit|
public abstract fun <A : R|kotlin/Any!|, B : R|ft<kotlin/collections/MutableList<A!>, kotlin/collections/List<A!>?>|> foo(a: R|A!|, b: R|B!|): R|kotlin/Unit|
}
}
@@ -1,10 +1,10 @@
public abstract interface UseParameterInUpperBoundWithKotlinSignature : R|kotlin/Any| {
public abstract interface Sub : R|test/UseParameterInUpperBoundWithKotlinSignature.Super| {
public abstract fun <B : R|kotlin/Any!|, A : R|ft<kotlin/collections/MutableList<ft<B & Any, B?>>, kotlin/collections/List<ft<B & Any, B?>>?>|> foo(b: R|ft<B & Any, B?>|, a: R|ft<A & Any, A?>|): R|kotlin/Unit|
public abstract fun <B : R|kotlin/Any!|, A : R|ft<kotlin/collections/MutableList<B!>, kotlin/collections/List<B!>?>|> foo(b: R|B!|, a: R|A!|): R|kotlin/Unit|
}
public abstract interface Super : R|kotlin/Any| {
public abstract fun <A : R|kotlin/Any!|, B : R|ft<kotlin/collections/MutableList<ft<A & Any, A?>>, kotlin/collections/List<ft<A & Any, A?>>?>|> foo(a: R|ft<A & Any, A?>|, b: R|ft<B & Any, B?>|): R|kotlin/Unit|
public abstract fun <A : R|kotlin/Any!|, B : R|ft<kotlin/collections/MutableList<A!>, kotlin/collections/List<A!>?>|> foo(a: R|A!|, b: R|B!|): R|kotlin/Unit|
}
}