Use upper bound aware type approximator for intersection types inside sam types in contravariant positions to build proper types in terms of subtyping

This commit is contained in:
Victor Petukhov
2021-06-16 18:55:03 +03:00
committed by TeamCityServer
parent 6a78e0a10c
commit 4aeabb6b0f
21 changed files with 424 additions and 18 deletions
@@ -31285,6 +31285,39 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
}
}
@TestMetadata("compiler/testData/codegen/box/sam/approximation")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Approximation extends AbstractLightAnalysisModeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public void testAllFilesPresentInApproximation() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sam/approximation"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@TestMetadata("approxToIntermediateType.kt")
public void testApproxToIntermediateType() throws Exception {
runTest("compiler/testData/codegen/box/sam/approximation/approxToIntermediateType.kt");
}
@TestMetadata("approxToSingleUpperBound.kt")
public void testApproxToSingleUpperBound() throws Exception {
runTest("compiler/testData/codegen/box/sam/approximation/approxToSingleUpperBound.kt");
}
@TestMetadata("impossibleToApproxToRepresentable.kt")
public void testImpossibleToApproxToRepresentable() throws Exception {
runTest("compiler/testData/codegen/box/sam/approximation/impossibleToApproxToRepresentable.kt");
}
@TestMetadata("impossibleToApproxToRepresentable2.kt")
public void testImpossibleToApproxToRepresentable2() throws Exception {
runTest("compiler/testData/codegen/box/sam/approximation/impossibleToApproxToRepresentable2.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/sam/constructors")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)