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
@@ -26285,6 +26285,39 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
}
}
@TestMetadata("compiler/testData/codegen/box/sam/approximation")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Approximation extends AbstractIrJsCodegenBoxES6Test {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath);
}
public void testAllFilesPresentInApproximation() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sam/approximation"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, 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)
@@ -25691,6 +25691,39 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
}
}
@TestMetadata("compiler/testData/codegen/box/sam/approximation")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Approximation extends AbstractIrJsCodegenBoxTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInApproximation() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sam/approximation"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, 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)
@@ -25651,6 +25651,39 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
}
}
@TestMetadata("compiler/testData/codegen/box/sam/approximation")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Approximation extends AbstractJsCodegenBoxTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
}
public void testAllFilesPresentInApproximation() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sam/approximation"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, 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)
@@ -14022,6 +14022,39 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
}
}
@TestMetadata("compiler/testData/codegen/box/sam/approximation")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Approximation extends AbstractIrCodegenBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInApproximation() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/sam/approximation"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, 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)