Don't try parsing contract-like function not from kotlin package

Returning `null` from `doCheckContract` functions means that we
have failed to parse contract function and should report an error, but
if the called function isn't true contract, we shouldn't evaluate that code
at all.

 #KT-27758 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2018-10-23 11:23:06 +03:00
committed by Dmitry Savvinov
parent d82ca9ccd0
commit bae3ff5211
5 changed files with 95 additions and 8 deletions
@@ -1112,6 +1112,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/contracts/dsl"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("callUsualContractFunction.kt")
public void testCallUsualContractFunction() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/callUsualContractFunction.kt");
}
@TestMetadata("useBeforeDeclaration.kt")
public void testUseBeforeDeclaration() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/useBeforeDeclaration.kt");
@@ -1112,6 +1112,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/contracts/dsl"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("callUsualContractFunction.kt")
public void testCallUsualContractFunction() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/callUsualContractFunction.kt");
}
@TestMetadata("useBeforeDeclaration.kt")
public void testUseBeforeDeclaration() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/useBeforeDeclaration.kt");