FIR: Fix bare type case with flexible supertypes

This commit is contained in:
Denis.Zharkov
2021-10-21 17:39:10 +03:00
parent 94129dce2e
commit 507422d3d8
7 changed files with 47 additions and 6 deletions
@@ -3496,6 +3496,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/types"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("bareWithFlexibleArg.kt")
public void testBareWithFlexibleArg() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/types/bareWithFlexibleArg.kt");
}
@TestMetadata("bareWithSubjectTypeAlias.kt")
public void testBareWithSubjectTypeAlias() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/types/bareWithSubjectTypeAlias.kt");
@@ -0,0 +1,6 @@
FILE: main.kt
public final fun foo(x: R|Promise<kotlin/String?>|): R|kotlin/Unit| {
R|/bar|((R|<local>/x| as R|CancellablePromise<kotlin/String?>|))
}
public final fun bar(x: R|CancellablePromise<kotlin/String?>|): R|kotlin/Unit| {
}
@@ -0,0 +1,15 @@
// FIR_IDENTICAL
// SKIP_TXT
// FILE: Promise.java
public interface Promise<T> {}
// FILE: CancellablePromise.java
public interface CancellablePromise<E> extends Promise<E> {}
// FILE: main.kt
fun foo(x: Promise<String?>) {
bar(x as CancellablePromise)
}
fun bar(x: CancellablePromise<String?>) {}
@@ -3901,6 +3901,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/types"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@Test
@TestMetadata("bareWithFlexibleArg.kt")
public void testBareWithFlexibleArg() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/types/bareWithFlexibleArg.kt");
}
@Test
@TestMetadata("bareWithSubjectTypeAlias.kt")
public void testBareWithSubjectTypeAlias() throws Exception {
@@ -3901,6 +3901,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/types"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@Test
@TestMetadata("bareWithFlexibleArg.kt")
public void testBareWithFlexibleArg() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/types/bareWithFlexibleArg.kt");
}
@Test
@TestMetadata("bareWithSubjectTypeAlias.kt")
public void testBareWithSubjectTypeAlias() throws Exception {