[JS] JsExport diagnostics and legacy support

Account for JsExport in legacy backend namer. It means we
catch overloaded exported function conflicts for free!

Add error diagnostics:
* NESTED_JS_EXPORT (Fixes KT-36798)
* WRONG_EXPORTED_DECLARATION (Part of the fix for KT-37752)
* NON_EXPORTABLE_TYPE (Fixes KT-37771)
This commit is contained in:
Svyatoslav Kuzmich
2019-08-29 18:25:09 +03:00
parent 4076bf40a9
commit 6e3d3831c2
52 changed files with 972 additions and 72 deletions
@@ -334,6 +334,54 @@ public class DiagnosticsTestWithJsStdLibGenerated extends AbstractDiagnosticsTes
}
}
@TestMetadata("compiler/testData/diagnostics/testsWithJsStdLib/export")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Export extends AbstractDiagnosticsTestWithJsStdLib {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInExport() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJsStdLib/export"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("extendingNonExportedType.kt")
public void testExtendingNonExportedType() throws Exception {
runTest("compiler/testData/diagnostics/testsWithJsStdLib/export/extendingNonExportedType.kt");
}
@TestMetadata("jsExportOnNestedDeclarations.kt")
public void testJsExportOnNestedDeclarations() throws Exception {
runTest("compiler/testData/diagnostics/testsWithJsStdLib/export/jsExportOnNestedDeclarations.kt");
}
@TestMetadata("secondaryConstructorWithoutJsName.kt")
public void testSecondaryConstructorWithoutJsName() throws Exception {
runTest("compiler/testData/diagnostics/testsWithJsStdLib/export/secondaryConstructorWithoutJsName.kt");
}
@TestMetadata("unexportableTypesInSignature.kt")
public void testUnexportableTypesInSignature() throws Exception {
runTest("compiler/testData/diagnostics/testsWithJsStdLib/export/unexportableTypesInSignature.kt");
}
@TestMetadata("unexportableTypesInTypeParameters.kt")
public void testUnexportableTypesInTypeParameters() throws Exception {
runTest("compiler/testData/diagnostics/testsWithJsStdLib/export/unexportableTypesInTypeParameters.kt");
}
@TestMetadata("wrongExportedDeclaration.kt")
public void testWrongExportedDeclaration() throws Exception {
runTest("compiler/testData/diagnostics/testsWithJsStdLib/export/wrongExportedDeclaration.kt");
}
@TestMetadata("wrongExportedDeclarationInExportedFile.kt")
public void testWrongExportedDeclarationInExportedFile() throws Exception {
runTest("compiler/testData/diagnostics/testsWithJsStdLib/export/wrongExportedDeclarationInExportedFile.kt");
}
}
@TestMetadata("compiler/testData/diagnostics/testsWithJsStdLib/inline")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)