K2: Fix false-positive UNSAFE_CALL on safe call with flexible type alias

The idea of the fix is just unwrapping flexible version of type alias,
before creating a not-nullable version for safe-call subject.

Otherwise, it was remained to be JsExpressionResult after applying
makeConeTypeDefinitelyNotNullOrNotNull (and the type is still nullable)

^KT-57190 Fixed
This commit is contained in:
Denis.Zharkov
2023-03-15 15:52:14 +01:00
committed by Space Team
parent bf977d4262
commit 823c60a7dc
6 changed files with 88 additions and 1 deletions
@@ -27811,6 +27811,22 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/safeCalls")
@TestDataPath("$PROJECT_ROOT")
public class SafeCalls {
@Test
public void testAllFilesPresentInSafeCalls() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/safeCalls"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(fir|ll)\\.kts?$"), true);
}
@Test
@TestMetadata("safeCallOnFlexibleTypeAlias.kt")
public void testSafeCallOnFlexibleTypeAlias() throws Exception {
runTest("compiler/testData/diagnostics/tests/safeCalls/safeCallOnFlexibleTypeAlias.kt");
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/samConversions")
@TestDataPath("$PROJECT_ROOT")