Rethink constraints incorporation

Namely, remove incorporation “otherInsideMyConstraint” to eliminate
constraint system redundancy and produce a potentially very large number
 of constructs.
Instead, introduce not so “spreadable” incorporation during variable
fixation (equality constraint with result type into other constraints).
^KT-41644 Fixed
^KT-42195 Fixed
^KT-42920 Fixed
^KT-42791 Fixed
^KT-41741 Fixed
This commit is contained in:
Victor Petukhov
2020-11-19 12:39:57 +03:00
parent 616e40f879
commit 0857b9c9e7
24 changed files with 299 additions and 136 deletions
@@ -12241,6 +12241,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali
runTest("compiler/testData/diagnostics/tests/inference/upperBounds/flexibilityInCommonSuperTypeCalculation.ni.kt");
}
@TestMetadata("inferringVariableByMaterializeAndUpperBound.kt")
public void testInferringVariableByMaterializeAndUpperBound() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/upperBounds/inferringVariableByMaterializeAndUpperBound.kt");
}
@TestMetadata("intersectUpperBounds.kt")
public void testIntersectUpperBounds() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/upperBounds/intersectUpperBounds.kt");
@@ -3188,29 +3188,6 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/recursiveFlexibleAssertions.kt");
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class AddEqualityConstraintsWithoutSubtyping extends AbstractDiagnosticsTestWithStdLib {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInAddEqualityConstraintsWithoutSubtyping() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@TestMetadata("kt41741.kt")
public void testKt41741() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping/kt41741.kt");
}
@TestMetadata("kt42195.kt")
public void testKt42195() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping/kt42195.kt");
}
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -3523,6 +3500,34 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/nothingType/dontSpreadWarningToNotReturningNothingSubResolvedAtoms.kt");
}
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inference/performance")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Performance extends AbstractDiagnosticsTestWithStdLib {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInPerformance() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/inference/performance"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@TestMetadata("kt41644.kt")
public void testKt41644() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41644.kt");
}
@TestMetadata("kt41741.kt")
public void testKt41741() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41741.kt");
}
@TestMetadata("kt42195.kt")
public void testKt42195() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt42195.kt");
}
}
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inline")
@@ -3188,29 +3188,6 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/recursiveFlexibleAssertions.kt");
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class AddEqualityConstraintsWithoutSubtyping extends AbstractDiagnosticsTestWithStdLibUsingJavac {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInAddEqualityConstraintsWithoutSubtyping() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@TestMetadata("kt41741.kt")
public void testKt41741() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping/kt41741.kt");
}
@TestMetadata("kt42195.kt")
public void testKt42195() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/addEqualityConstraintsWithoutSubtyping/kt42195.kt");
}
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -3523,6 +3500,34 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/nothingType/dontSpreadWarningToNotReturningNothingSubResolvedAtoms.kt");
}
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inference/performance")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Performance extends AbstractDiagnosticsTestWithStdLibUsingJavac {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInPerformance() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/inference/performance"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@TestMetadata("kt41644.kt")
public void testKt41644() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41644.kt");
}
@TestMetadata("kt41741.kt")
public void testKt41741() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41741.kt");
}
@TestMetadata("kt42195.kt")
public void testKt42195() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt42195.kt");
}
}
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inline")
@@ -12236,6 +12236,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
runTest("compiler/testData/diagnostics/tests/inference/upperBounds/flexibilityInCommonSuperTypeCalculation.ni.kt");
}
@TestMetadata("inferringVariableByMaterializeAndUpperBound.kt")
public void testInferringVariableByMaterializeAndUpperBound() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/upperBounds/inferringVariableByMaterializeAndUpperBound.kt");
}
@TestMetadata("intersectUpperBounds.kt")
public void testIntersectUpperBounds() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/upperBounds/intersectUpperBounds.kt");
@@ -271,6 +271,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations/typeAnnotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@TestMetadata("checkingNotincorporatedInputTypes.kt")
public void testCheckingNotincorporatedInputTypes() throws Exception {
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/checkingNotincorporatedInputTypes.kt");
}
@TestMetadata("implicitReturn.kt")
public void testImplicitReturn() throws Exception {
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/implicitReturn.kt");