Do not lose information about contracts if call uses default value

It is safe to treat DefaultValueArgument as UNKNOWN_COMPUTATION, because
default arguments can't break smartcasts.

Possibly, they can add new ones, but it can be supported later.

^KT-25278 Fixed
This commit is contained in:
Dmitry Savvinov
2018-08-09 14:35:25 +03:00
parent cf62acc6d6
commit 57bafcf9e9
5 changed files with 63 additions and 10 deletions
@@ -1211,6 +1211,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("callWithDefaultValue.kt")
public void testCallWithDefaultValue() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/callWithDefaultValue.kt");
}
@TestMetadata("catchExceptionSpilling.kt")
public void testCatchExceptionSpilling() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/catchExceptionSpilling.kt");
@@ -1211,6 +1211,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("callWithDefaultValue.kt")
public void testCallWithDefaultValue() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/callWithDefaultValue.kt");
}
@TestMetadata("catchExceptionSpilling.kt")
public void testCatchExceptionSpilling() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/catchExceptionSpilling.kt");