NI: Improve postponed arguments analysis
Introduce seven stages: 1) Analyze postponed arguments with fixed parameter types 2) Collect parameter types from constraints and lambda parameters' declaration 3) Fix not postponed variables for parameter types of all postponed arguments 4) Create atoms with revised expected types if needed 5) Analyze the first ready postponed argument and rerun stages if it has been analyzed 6) Force fixation remaining type variables: fix if possible or report not enough information 7) Force analysis remaining not analyzed postponed arguments and rerun stages if there are ^KT-37952 Fixed ^KT-32156 Fixed ^KT-37249 Fixed ^KT-37341 Fixed
This commit is contained in:
@@ -10748,6 +10748,44 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali
|
||||
public void testWithExact() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/completion/withExact.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class PostponedArgumentsAnalysis extends AbstractDiagnosticsTestWithFirValidation {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInPostponedArgumentsAnalysis() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("basic.kt")
|
||||
public void testBasic() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceLambdaCombinationInsideCall.kt")
|
||||
public void testCallableReferenceLambdaCombinationInsideCall() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/callableReferenceLambdaCombinationInsideCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferences.kt")
|
||||
public void testCallableReferences() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/callableReferences.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lackOfDeepIncorporation.kt")
|
||||
public void testLackOfDeepIncorporation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/lackOfDeepIncorporation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdasInTryCatch.kt")
|
||||
public void testLambdasInTryCatch() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/lambdasInTryCatch.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/inference/constraints")
|
||||
|
||||
+76
@@ -3069,6 +3069,82 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inference/completion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Completion extends AbstractDiagnosticsTestWithStdLib {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInCompletion() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/inference/completion"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class PostponedArgumentsAnalysis extends AbstractDiagnosticsTestWithStdLib {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInPostponedArgumentsAnalysis() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferences.kt")
|
||||
public void testCallableReferences() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/callableReferences.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("complexInterdependentInputOutputTypes.kt")
|
||||
public void testComplexInterdependentInputOutputTypes() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/complexInterdependentInputOutputTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("deepLambdas.kt")
|
||||
public void testDeepLambdas() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/deepLambdas.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("fixIndependentVariables.kt")
|
||||
public void testFixIndependentVariables() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/fixIndependentVariables.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("fixInputTypeToMoreSpecificType.kt")
|
||||
public void testFixInputTypeToMoreSpecificType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/fixInputTypeToMoreSpecificType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("fixReceiverToMoreSpecificType.kt")
|
||||
public void testFixReceiverToMoreSpecificType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/fixReceiverToMoreSpecificType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("moreSpecificOutputType.kt")
|
||||
public void testMoreSpecificOutputType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/moreSpecificOutputType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("rerunStagesAfterFixationInFullMode.kt")
|
||||
public void testRerunStagesAfterFixationInFullMode() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/rerunStagesAfterFixationInFullMode.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("rerunStagesAfterFixationInPartialMode.kt")
|
||||
public void testRerunStagesAfterFixationInPartialMode() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/rerunStagesAfterFixationInPartialMode.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendFunctions.kt")
|
||||
public void testSuspendFunctions() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/suspendFunctions.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inference/delegates")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java
Generated
+76
@@ -3069,6 +3069,82 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inference/completion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Completion extends AbstractDiagnosticsTestWithStdLibUsingJavac {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInCompletion() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/inference/completion"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class PostponedArgumentsAnalysis extends AbstractDiagnosticsTestWithStdLibUsingJavac {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInPostponedArgumentsAnalysis() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferences.kt")
|
||||
public void testCallableReferences() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/callableReferences.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("complexInterdependentInputOutputTypes.kt")
|
||||
public void testComplexInterdependentInputOutputTypes() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/complexInterdependentInputOutputTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("deepLambdas.kt")
|
||||
public void testDeepLambdas() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/deepLambdas.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("fixIndependentVariables.kt")
|
||||
public void testFixIndependentVariables() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/fixIndependentVariables.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("fixInputTypeToMoreSpecificType.kt")
|
||||
public void testFixInputTypeToMoreSpecificType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/fixInputTypeToMoreSpecificType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("fixReceiverToMoreSpecificType.kt")
|
||||
public void testFixReceiverToMoreSpecificType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/fixReceiverToMoreSpecificType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("moreSpecificOutputType.kt")
|
||||
public void testMoreSpecificOutputType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/moreSpecificOutputType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("rerunStagesAfterFixationInFullMode.kt")
|
||||
public void testRerunStagesAfterFixationInFullMode() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/rerunStagesAfterFixationInFullMode.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("rerunStagesAfterFixationInPartialMode.kt")
|
||||
public void testRerunStagesAfterFixationInPartialMode() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/rerunStagesAfterFixationInPartialMode.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendFunctions.kt")
|
||||
public void testSuspendFunctions() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/suspendFunctions.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inference/delegates")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Generated
+38
@@ -10743,6 +10743,44 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
public void testWithExact() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/completion/withExact.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class PostponedArgumentsAnalysis extends AbstractDiagnosticsUsingJavacTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInPostponedArgumentsAnalysis() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("basic.kt")
|
||||
public void testBasic() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceLambdaCombinationInsideCall.kt")
|
||||
public void testCallableReferenceLambdaCombinationInsideCall() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/callableReferenceLambdaCombinationInsideCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferences.kt")
|
||||
public void testCallableReferences() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/callableReferences.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lackOfDeepIncorporation.kt")
|
||||
public void testLackOfDeepIncorporation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/lackOfDeepIncorporation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdasInTryCatch.kt")
|
||||
public void testLambdasInTryCatch() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/lambdasInTryCatch.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/inference/constraints")
|
||||
|
||||
Reference in New Issue
Block a user