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,7 +1,7 @@
FILE: javaCollector.kt
public final fun foo(): R|kotlin/Unit| {
R|kotlin/collections/listOf|<R|kotlin/String|>(String()).R|SubstitutionOverride<kotlin/collections/List.stream: R|@EnhancedNullability java/util/stream/Stream<@EnhancedNullability kotlin/String>|>|().R|SubstitutionOverride<java/util/stream/Stream.collect: R|ft<R & Any, R?>|>|<R|ft<kotlin/collections/MutableMap<kotlin/String!, kotlin/Int!>, kotlin/collections/Map<kotlin/String!, kotlin/Int!>?>|, R|ft<CapturedType(*), CapturedType(*)?>|>(Q|java/util/stream/Collectors|.R|java/util/stream/Collectors.groupingBy*s|<R|kotlin/String!|, R|kotlin/String!|, R|ft<CapturedType(*), CapturedType(*)?>|, R|kotlin/Int!|>(SAM(groupingBy@fun <anonymous>(it: R|@EnhancedNullability kotlin/String!|): R|@EnhancedNullability kotlin/String!| <inline=NoInline> {
R|kotlin/collections/listOf|<R|kotlin/String|>(String()).R|SubstitutionOverride<kotlin/collections/List.stream: R|@EnhancedNullability java/util/stream/Stream<@EnhancedNullability kotlin/String>|>|().R|SubstitutionOverride<java/util/stream/Stream.collect: R|R!|><Inapplicable(INAPPLICABLE): java/util/stream/Stream.collect>#|<<ERROR TYPE REF: Cannot infer argument for type parameter R>, <ERROR TYPE REF: Cannot infer argument for type parameter A>>(Q|java/util/stream/Collectors|.R|java/util/stream/Collectors.groupingBy*s<CS errors: java/util/stream/Collectors.groupingBy>#|<R|kotlin/String!|, <ERROR TYPE REF: Cannot infer argument for type parameter K>, R|kotlin/Any!|, R|kotlin/Int!|>(SAM(groupingBy@fun <anonymous>(it: R|@EnhancedNullability kotlin/String!|): <ERROR TYPE REF: Cannot infer argument for type parameter K> <inline=NoInline> {
^ R|<local>/it|
}
), Q|java/util/stream/Collectors|.R|java/util/stream/Collectors.collectingAndThen*s|<R|kotlin/String!|, R|ft<CapturedType(*), CapturedType(*)?>|, R|kotlin/Long!|, R|kotlin/Int!|>(Q|java/util/stream/Collectors|.R|java/util/stream/Collectors.counting*s|<R|kotlin/String|>(), SAM(Q|kotlin/Long|::R|kotlin/Long.toInt|))))
), Q|java/util/stream/Collectors|.R|java/util/stream/Collectors.collectingAndThen*s|<R|kotlin/String!|, R|ft<CapturedType(*), CapturedType(*)?>|, R|kotlin/Long!|, R|kotlin/Int!|>(Q|java/util/stream/Collectors|.R|java/util/stream/Collectors.counting*s|<R|kotlin/String!|>(), SAM(Q|kotlin/Long|::R|kotlin/Long.toInt|))))
}