[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:
Nikolay Lunyak
2023-03-15 13:56:51 +00:00
committed by Space Team
parent 9de86c03b7
commit d639215084
7 changed files with 72 additions and 1 deletions
@@ -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 {
@@ -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
}