Do subtyping with stub types properly

1) Return stub type if we are calculating super type between two same stub types
2) Return nullable Any if those stub types are different
This commit is contained in:
Victor Petukhov
2021-04-27 14:05:35 +03:00
parent 5d0461c722
commit ac7b459f2a
49 changed files with 1536 additions and 75 deletions
@@ -12638,12 +12638,6 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/builderInference"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@Test
@TestMetadata("renderingStubTypes.kt")
public void testRenderingStubTypes() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/renderingStubTypes.kt");
}
@Test
@TestMetadata("simpleLambdaInCallWithAnotherLambdaWithBuilderInference.kt")
public void testSimpleLambdaInCallWithAnotherLambdaWithBuilderInference() throws Exception {
@@ -12691,6 +12685,64 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
public void testSpecialCallsWithLambdas() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithLambdas.kt");
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes")
@TestDataPath("$PROJECT_ROOT")
public class StubTypes {
@Test
public void testAllFilesPresentInStubTypes() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@Test
@TestMetadata("capturedTypes.kt")
public void testCapturedTypes() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/capturedTypes.kt");
}
@Test
@TestMetadata("commonSuperType.kt")
public void testCommonSuperType() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/commonSuperType.kt");
}
@Test
@TestMetadata("commonSuperTypeContravariant.kt")
public void testCommonSuperTypeContravariant() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/commonSuperTypeContravariant.kt");
}
@Test
@TestMetadata("commonSuperTypeCovariant.kt")
public void testCommonSuperTypeCovariant() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/commonSuperTypeCovariant.kt");
}
@Test
@TestMetadata("commonSuperTypeInvariant.kt")
public void testCommonSuperTypeInvariant() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/commonSuperTypeInvariant.kt");
}
@Test
@TestMetadata("commonSuperTypeNullable.kt")
public void testCommonSuperTypeNullable() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/commonSuperTypeNullable.kt");
}
@Test
@TestMetadata("intersect.kt")
public void testIntersect() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/intersect.kt");
}
@Test
@TestMetadata("renderingStubTypes.kt")
public void testRenderingStubTypes() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/renderingStubTypes.kt");
}
}
}
@Nested
@@ -12638,12 +12638,6 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/builderInference"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@Test
@TestMetadata("renderingStubTypes.kt")
public void testRenderingStubTypes() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/renderingStubTypes.kt");
}
@Test
@TestMetadata("simpleLambdaInCallWithAnotherLambdaWithBuilderInference.kt")
public void testSimpleLambdaInCallWithAnotherLambdaWithBuilderInference() throws Exception {
@@ -12691,6 +12685,64 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
public void testSpecialCallsWithLambdas() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithLambdas.kt");
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes")
@TestDataPath("$PROJECT_ROOT")
public class StubTypes {
@Test
public void testAllFilesPresentInStubTypes() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@Test
@TestMetadata("capturedTypes.kt")
public void testCapturedTypes() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/capturedTypes.kt");
}
@Test
@TestMetadata("commonSuperType.kt")
public void testCommonSuperType() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/commonSuperType.kt");
}
@Test
@TestMetadata("commonSuperTypeContravariant.kt")
public void testCommonSuperTypeContravariant() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/commonSuperTypeContravariant.kt");
}
@Test
@TestMetadata("commonSuperTypeCovariant.kt")
public void testCommonSuperTypeCovariant() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/commonSuperTypeCovariant.kt");
}
@Test
@TestMetadata("commonSuperTypeInvariant.kt")
public void testCommonSuperTypeInvariant() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/commonSuperTypeInvariant.kt");
}
@Test
@TestMetadata("commonSuperTypeNullable.kt")
public void testCommonSuperTypeNullable() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/commonSuperTypeNullable.kt");
}
@Test
@TestMetadata("intersect.kt")
public void testIntersect() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/intersect.kt");
}
@Test
@TestMetadata("renderingStubTypes.kt")
public void testRenderingStubTypes() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/renderingStubTypes.kt");
}
}
}
@Nested