[FIR] support flexible types in ConeKotlinType#independentInstance
^KT-60580 Fixed
This commit is contained in:
committed by
Space Team
parent
dc56c5cf9e
commit
8820867341
+6
@@ -20156,6 +20156,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/tests/j+k/kt36856.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt60580.kt")
|
||||
public void testKt60580() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/j+k/kt60580.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt6720_abstractProperty.kt")
|
||||
public void testKt6720_abstractProperty() throws Exception {
|
||||
|
||||
+6
@@ -20162,6 +20162,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/tests/j+k/kt36856.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt60580.kt")
|
||||
public void testKt60580() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/j+k/kt60580.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt6720_abstractProperty.kt")
|
||||
public void testKt6720_abstractProperty() throws Exception {
|
||||
|
||||
@@ -136,7 +136,22 @@ fun ConeDynamicType.Companion.create(session: FirSession): ConeDynamicType =
|
||||
*
|
||||
* @see CustomAnnotationTypeAttribute.independentInstance
|
||||
*/
|
||||
fun ConeKotlinType.independentInstance(): ConeKotlinType = instanceWithIndependentArguments().instanceWithIndependentAnnotations()
|
||||
@OptIn(DynamicTypeConstructor::class)
|
||||
fun ConeKotlinType.independentInstance(): ConeKotlinType = if (this is ConeFlexibleType) {
|
||||
val newLowerBound = lowerBound.independentInstance() as ConeSimpleKotlinType
|
||||
val newUpperBound = upperBound.independentInstance() as ConeSimpleKotlinType
|
||||
if (newLowerBound !== lowerBound || newUpperBound !== upperBound) {
|
||||
when (this) {
|
||||
is ConeRawType -> ConeRawType.create(newLowerBound, newUpperBound)
|
||||
is ConeDynamicType -> ConeDynamicType(newLowerBound, newUpperBound)
|
||||
else -> ConeFlexibleType(newLowerBound, newUpperBound)
|
||||
}
|
||||
} else {
|
||||
this
|
||||
}
|
||||
} else {
|
||||
instanceWithIndependentArguments().instanceWithIndependentAnnotations()
|
||||
}
|
||||
|
||||
private fun ConeKotlinType.instanceWithIndependentArguments(): ConeKotlinType {
|
||||
val typeProjections = typeArguments
|
||||
|
||||
Reference in New Issue
Block a user