K2: don't make T = Type! substitutions for constructors, including SAM

Without this commit we get some ABI changes and it looks bad.

Related to KT-65596
This commit is contained in:
Mikhail Glukhikh
2024-02-21 13:58:26 +01:00
committed by Space Team
parent 81414d758d
commit 78b6432ced
27 changed files with 159 additions and 76 deletions
@@ -7,7 +7,7 @@ FILE: main.kt
public abstract interface PsiClass : R|kotlin/Any| {
}
public final fun test(): R|kotlin/Unit| {
lval processor: R|AdapterProcessor<PsiMethod!, PsiClass!>| = R|/AdapterProcessor.AdapterProcessor|<R|PsiMethod!|, R|PsiClass!|>(R|/Function|<R|PsiMethod!|, R|PsiClass?|>(<L> = Function@fun <anonymous>(method: R|PsiMethod?|): R|PsiClass?| <inline=NoInline> {
lval processor: R|AdapterProcessor<PsiMethod, PsiClass>| = R|/AdapterProcessor.AdapterProcessor|<R|PsiMethod|, R|PsiClass|>(R|/Function|<R|PsiMethod!|, R|PsiClass?|>(<L> = Function@fun <anonymous>(method: R|PsiMethod?|): R|PsiClass?| <inline=NoInline> {
^ R|<local>/method|?.{ $subj$.R|/PsiMethod.containingClass| }
}
))
@@ -26,13 +26,13 @@ FILE: main.kt
}
public final fun test_1(): R|kotlin/Unit| {
lval map: R|util/HashMap<kotlin/Int!, kotlin/Int!>| = R|util/HashMap.HashMap|<R|kotlin/Int!|, R|kotlin/Int!|>()
lval map: R|util/HashMap<kotlin/Int, kotlin/Int>| = R|util/HashMap.HashMap|<R|kotlin/Int|, R|kotlin/Int|>()
}
public final fun test_2(): R|kotlin/Unit| {
lval set: R|util/HashSet<kotlin/Int>| = R|util/HashSet.HashSet|<R|kotlin/Int|>()
}
public final fun test_3(): R|kotlin/Unit| {
lval list: R|foo/ArrayList<kotlin/Int!>| = R|foo/ArrayList.ArrayList|<R|kotlin/Int!|>()
lval list: R|foo/ArrayList<kotlin/Int>| = R|foo/ArrayList.ArrayList|<R|kotlin/Int|>()
}
public final fun test_4(): R|kotlin/Unit| {
lval list: R|foo/LinkedList<kotlin/Int>| = R|foo/LinkedList.LinkedList|<R|kotlin/Int|>()
@@ -13,8 +13,8 @@ FILE: test.kt
lval element: R|DE| = R|<local>/d|.R|/Diagnostic.element|
R|/Fix.Fix|(R|<local>/element|)
}
private final val DERIVED_FACTORY: R|DiagnosticFactory0<DerivedElement!>| = R|/DiagnosticFactory0.DiagnosticFactory0|<R|DerivedElement!|>()
private get(): R|DiagnosticFactory0<DerivedElement!>|
private final val DERIVED_FACTORY: R|DiagnosticFactory0<DerivedElement>| = R|/DiagnosticFactory0.DiagnosticFactory0|<R|DerivedElement|>()
private get(): R|DiagnosticFactory0<DerivedElement>|
public final fun createViaFactory(d: R|EmptyDiagnostic|): R|kotlin/Unit| {
lval casted: R|Diagnostic<DerivedElement!>| = R|/DERIVED_FACTORY|.R|SubstitutionOverride</DiagnosticFactory0.cast: R|@EnhancedNullability Diagnostic<DerivedElement!>|>|(R|<local>/d|)
lval element: R|DerivedElement| = R|<local>/casted|.R|/Diagnostic.element|
@@ -1,4 +1,4 @@
FILE: main.kt
public final fun main(): R|kotlin/Unit| {
R|/JavaClass.JavaClass|<R|kotlin/String!|>(Null(null)).R|SubstitutionOverride</JavaClass.foo: R|kotlin/String!|>|().R|kotlin/String.length|
R|/JavaClass.JavaClass|<R|kotlin/String|>(Null(null)).R|SubstitutionOverride</JavaClass.foo: R|kotlin/String!|>|().R|kotlin/String.length|
}
@@ -1,6 +1,6 @@
FILE: main.kt
public final fun main(): R|kotlin/Unit| {
R|/MyFunction|<R|kotlin/Int!|, R|kotlin/String!|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Int!|): R|kotlin/String!| <inline=NoInline> {
R|/MyFunction|<R|kotlin/Int|, R|kotlin/String|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Int!|): R|kotlin/String!| <inline=NoInline> {
^ R|<local>/x|.R|kotlin/Int.toInt|().R|kotlin/Int.toString|()
}
)
@@ -1,8 +1,8 @@
FILE: main.kt
private final val anyProperty: R|Property<kotlin/Any!>| = R|/Property.Property|<R|kotlin/Any!|>()
private get(): R|Property<kotlin/Any!>|
private final val boundedProperty: R|Property<kotlin/String!>| = R|/Property.Property|<R|kotlin/String!|>()
private get(): R|Property<kotlin/String!>|
private final val anyProperty: R|Property<kotlin/Any>| = R|/Property.Property|<R|kotlin/Any|>()
private get(): R|Property<kotlin/Any>|
private final val boundedProperty: R|Property<kotlin/String>| = R|/Property.Property|<R|kotlin/String|>()
private get(): R|Property<kotlin/String>|
public final fun test_1(x: R|Property<kotlin/Any>|): R|kotlin/Unit| {
when () {
(R|<local>/x| is R|Reference|) -> {