Fix false positive "Cannot capture" error reporting

There is no need to report an error in case of non-top-level
capture conversion, just don't add relevant capture type in the system instead

If system can be solved successfully without captured type, then it's just fine
(see KT-13950)
In case of contradiction TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR is reported

 #KT-13950 Fixed
This commit is contained in:
Denis Zharkov
2016-09-21 11:57:28 +03:00
parent 4431c6ad02
commit 6663054f4d
10 changed files with 67 additions and 23 deletions
@@ -9389,6 +9389,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("noCaptureTypeErrorForNonTopLevel.kt")
public void testNoCaptureTypeErrorForNonTopLevel() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/inference/capturedTypes/noCaptureTypeErrorForNonTopLevel.kt");
doTest(fileName);
}
@TestMetadata("notApproximateWhenCopyDescriptors.kt")
public void testNotApproximateWhenCopyDescriptors() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/inference/capturedTypes/notApproximateWhenCopyDescriptors.kt");