Substitute captured types with inner intersection one (NewTypeSubstitutor)
^KT-44651 Fixed
This commit is contained in:
+6
@@ -16666,6 +16666,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/inference/specialCallsWithCallableReferences.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("substituteIntersectionTypeInsideCapType.kt")
|
||||
public void testSubstituteIntersectionTypeInsideCapType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/substituteIntersectionTypeInsideCapType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("subtypingOfIntersectionIltInsideFlexible.kt")
|
||||
public void testSubtypingOfIntersectionIltInsideFlexible() throws Exception {
|
||||
|
||||
+1
-1
@@ -105,7 +105,7 @@ interface NewTypeSubstitutor : TypeSubstitutorMarker {
|
||||
val substitutedInnerType = substitute(innerType, keepAnnotation, runCapturedChecks = false)
|
||||
|
||||
if (substitutedInnerType != null) {
|
||||
if (innerType is StubType || substitutedInnerType is StubType) {
|
||||
if (innerType is StubType || substitutedInnerType is StubType || innerType.constructor is IntersectionTypeConstructor) {
|
||||
return NewCapturedType(
|
||||
capturedType.captureStatus,
|
||||
NewCapturedTypeConstructor(
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
|
||||
class X<T: Number>(val y: Any, val x: T)
|
||||
|
||||
fun box(): String {
|
||||
val num: Long = -10
|
||||
val num2: Int = 20
|
||||
val obj = if (true)
|
||||
X(Any(), if (true) num else num2)
|
||||
else
|
||||
X(Any(), -25)
|
||||
val f = obj.y
|
||||
return "OK"
|
||||
}
|
||||
+6
@@ -16666,6 +16666,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/inference/specialCallsWithCallableReferences.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("substituteIntersectionTypeInsideCapType.kt")
|
||||
public void testSubstituteIntersectionTypeInsideCapType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/substituteIntersectionTypeInsideCapType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("subtypingOfIntersectionIltInsideFlexible.kt")
|
||||
public void testSubtypingOfIntersectionIltInsideFlexible() throws Exception {
|
||||
|
||||
+6
@@ -16666,6 +16666,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/inference/specialCallsWithCallableReferences.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("substituteIntersectionTypeInsideCapType.kt")
|
||||
public void testSubstituteIntersectionTypeInsideCapType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/substituteIntersectionTypeInsideCapType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("subtypingOfIntersectionIltInsideFlexible.kt")
|
||||
public void testSubtypingOfIntersectionIltInsideFlexible() throws Exception {
|
||||
|
||||
+5
@@ -13855,6 +13855,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/inference/specialCallsWithCallableReferences.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("substituteIntersectionTypeInsideCapType.kt")
|
||||
public void testSubstituteIntersectionTypeInsideCapType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/substituteIntersectionTypeInsideCapType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("subtypingOfIntersectionIltInsideFlexible.kt")
|
||||
public void testSubtypingOfIntersectionIltInsideFlexible() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/subtypingOfIntersectionIltInsideFlexible.kt");
|
||||
|
||||
Reference in New Issue
Block a user