[FIR] KT-57095: Allow X? -> * assignments in unification
^KT-57095 Fixed Merge-request: KT-MR-9180 Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
9de86c03b7
commit
d639215084
+12
@@ -783,6 +783,18 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/QualifiedExpressions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("rawCastToStarProjection_Fail.kt")
|
||||
public void testRawCastToStarProjection_Fail() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/rawCastToStarProjection_Fail.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("rawCastToStarProjection_Ok.kt")
|
||||
public void testRawCastToStarProjection_Ok() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/rawCastToStarProjection_Ok.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("RecursiveResolve.kt")
|
||||
public void testRecursiveResolve() throws Exception {
|
||||
|
||||
+12
@@ -783,6 +783,18 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/tests/QualifiedExpressions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("rawCastToStarProjection_Fail.kt")
|
||||
public void testRawCastToStarProjection_Fail() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/rawCastToStarProjection_Fail.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("rawCastToStarProjection_Ok.kt")
|
||||
public void testRawCastToStarProjection_Ok() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/rawCastToStarProjection_Ok.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("RecursiveResolve.kt")
|
||||
public void testRecursiveResolve() throws Exception {
|
||||
|
||||
+12
@@ -783,6 +783,18 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/tests/QualifiedExpressions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("rawCastToStarProjection_Fail.kt")
|
||||
public void testRawCastToStarProjection_Fail() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/rawCastToStarProjection_Fail.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("rawCastToStarProjection_Ok.kt")
|
||||
public void testRawCastToStarProjection_Ok() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/rawCastToStarProjection_Ok.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("RecursiveResolve.kt")
|
||||
public void testRecursiveResolve() throws Exception {
|
||||
|
||||
@@ -78,7 +78,11 @@ fun FirSession.doUnify(
|
||||
}
|
||||
|
||||
// Foo ~ X? => fail
|
||||
if (originalType?.nullability != ConeNullability.NULLABLE && typeWithParameters?.nullability == ConeNullability.NULLABLE) {
|
||||
if (
|
||||
originalTypeProjection !is ConeStarProjection &&
|
||||
originalType?.nullability != ConeNullability.NULLABLE &&
|
||||
typeWithParameters?.nullability == ConeNullability.NULLABLE
|
||||
) {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// FIR_IDENTICAL
|
||||
// ISSUE: KT-57095
|
||||
|
||||
open class ValueType<T> {
|
||||
class Optional<T>: ValueType<T?>()
|
||||
}
|
||||
private fun checkType(type: ValueType<*>) {
|
||||
type as ValueType.Optional // K1: ok, K2: NO_TYPE_ARGUMENTS_ON_RHS
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// FIR_IDENTICAL
|
||||
// ISSUE: KT-57095
|
||||
|
||||
open class ValueType<T> {
|
||||
class Optional<T>: ValueType<T?>()
|
||||
}
|
||||
|
||||
private fun checkType(type: ValueType<out Any?>) {
|
||||
type as ValueType.Optional // K1 & K2: ok
|
||||
}
|
||||
Generated
+12
@@ -783,6 +783,18 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/QualifiedExpressions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("rawCastToStarProjection_Fail.kt")
|
||||
public void testRawCastToStarProjection_Fail() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/rawCastToStarProjection_Fail.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("rawCastToStarProjection_Ok.kt")
|
||||
public void testRawCastToStarProjection_Ok() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/rawCastToStarProjection_Ok.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("RecursiveResolve.kt")
|
||||
public void testRecursiveResolve() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user