Don't do new captured type specific checks for old ones in the type checker

^KT-47143 Fixed
This commit is contained in:
Victor Petukhov
2021-06-08 14:22:39 +03:00
parent 02a56a3077
commit 1b82227308
11 changed files with 62 additions and 2 deletions
@@ -12944,6 +12944,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/capturingFromArgumentOfFlexibleType.kt");
}
@Test
@TestMetadata("dontCheckNewCapturedTypeSpecificChecksForOldOnes.kt")
public void testDontCheckNewCapturedTypeSpecificChecksForOldOnes() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/dontCheckNewCapturedTypeSpecificChecksForOldOnes.kt");
}
@Test
@TestMetadata("expectedTypeMismatchWithInVariance.kt")
public void testExpectedTypeMismatchWithInVariance() throws Exception {
@@ -12944,6 +12944,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/capturingFromArgumentOfFlexibleType.kt");
}
@Test
@TestMetadata("dontCheckNewCapturedTypeSpecificChecksForOldOnes.kt")
public void testDontCheckNewCapturedTypeSpecificChecksForOldOnes() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/dontCheckNewCapturedTypeSpecificChecksForOldOnes.kt");
}
@Test
@TestMetadata("expectedTypeMismatchWithInVariance.kt")
public void testExpectedTypeMismatchWithInVariance() throws Exception {
@@ -358,6 +358,8 @@ interface ConeInferenceContext : TypeSystemInferenceExtensionContext, ConeTypeCo
return this.captureStatus
}
override fun CapturedTypeMarker.isOldCapturedType(): Boolean = false
override fun TypeConstructorMarker.isCapturedTypeConstructor(): Boolean {
return this is ConeCapturedTypeConstructor
}
@@ -157,6 +157,8 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
return this.captureStatus
}
override fun CapturedTypeMarker.isOldCapturedType(): Boolean = false
override fun CapturedTypeConstructorMarker.projection(): TypeArgumentMarker {
require(this is ConeCapturedTypeConstructor)
return this.projection
@@ -106,6 +106,8 @@ interface IrTypeSystemContext : TypeSystemContext, TypeSystemCommonSuperTypesCon
override fun CapturedTypeMarker.captureStatus(): CaptureStatus =
(this as IrCapturedType).captureStatus
override fun CapturedTypeMarker.isOldCapturedType(): Boolean = false
override fun CapturedTypeConstructorMarker.projection(): TypeArgumentMarker =
(this as IrCapturedType.Constructor).argument
@@ -0,0 +1,14 @@
// FIR_IDENTICAL
// WITH_RUNTIME
// KT-47143
interface Container<PARAM: Any>
interface ContainerType<PARAM: Any, CONT: Container<PARAM>>
fun <R: Any> doGet(ep: ContainerType<*, *>): String = TODO()
@JvmName("name")
fun <R: Any, PARAM: Any, CONT: Container<PARAM>> doGet(ep: ContainerType<PARAM, CONT>): String = TODO()
fun main() {}
@@ -0,0 +1,17 @@
package
public fun </*0*/ R : kotlin.Any> doGet(/*0*/ ep: ContainerType<*, *>): kotlin.String
@kotlin.jvm.JvmName(name = "name") public fun </*0*/ R : kotlin.Any, /*1*/ PARAM : kotlin.Any, /*2*/ CONT : Container<PARAM>> doGet(/*0*/ ep: ContainerType<PARAM, CONT>): kotlin.String
public fun main(): kotlin.Unit
public interface Container</*0*/ PARAM : kotlin.Any> {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface ContainerType</*0*/ PARAM : kotlin.Any, /*1*/ CONT : Container<PARAM>> {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -12950,6 +12950,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/capturingFromArgumentOfFlexibleType.kt");
}
@Test
@TestMetadata("dontCheckNewCapturedTypeSpecificChecksForOldOnes.kt")
public void testDontCheckNewCapturedTypeSpecificChecksForOldOnes() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/dontCheckNewCapturedTypeSpecificChecksForOldOnes.kt");
}
@Test
@TestMetadata("expectedTypeMismatchWithInVariance.kt")
public void testExpectedTypeMismatchWithInVariance() throws Exception {