From 1920bbde07de15b7ca2eef5a9acec64d75bcddfb Mon Sep 17 00:00:00 2001 From: Alexander Korepanov Date: Thu, 11 May 2023 12:37:01 +0000 Subject: [PATCH] [K/JS] Enable partial linkage tests --- .../js/lower/ES6ConstructorLowering.kt | 21 ++- .../generators/tests/GenerateJsTests.kt | 37 +++-- .../ir/AbstractJsPartialLinkageTestCase.kt | 50 +++--- ...JsPartialLinkageNoICTestCaseGenerated.java | 32 +++- ...artialLinkageNoICES6TestCaseGenerated.java | 153 ++++++++++++++++++ ...JsPartialLinkageNoICTestCaseGenerated.java | 32 +++- ...PartialLinkageWithICTestCaseGenerated.java | 32 +++- 7 files changed, 288 insertions(+), 69 deletions(-) create mode 100644 js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/JsPartialLinkageNoICES6TestCaseGenerated.java diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/ES6ConstructorLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/ES6ConstructorLowering.kt index e2bf6d8de6f..091ef8356ec 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/ES6ConstructorLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/ES6ConstructorLowering.kt @@ -23,6 +23,7 @@ import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.utils.addToStdlib.runIf +import org.jetbrains.kotlin.utils.addToStdlib.runUnless import org.jetbrains.kotlin.utils.memoryOptimizedFilterNot import org.jetbrains.kotlin.utils.memoryOptimizedMap import org.jetbrains.kotlin.utils.memoryOptimizedPlus @@ -137,8 +138,12 @@ class ES6ConstructorLowering(val context: JsIrBackendContext) : DeclarationTrans factory.body = context.irFactory.createBlockBody(UNDEFINED_OFFSET, UNDEFINED_OFFSET) { val bodyCopy = constructor.body?.deepCopyWithSymbols(factory) ?: return@createBlockBody val self = bodyCopy.replaceSuperCallsAndThisUsages(irClass, factory, constructor) + statements.addAll(bodyCopy.statements) - statements.add(JsIrBuilder.buildReturn(factory.symbol, JsIrBuilder.buildGetValue(self), irClass.defaultType)) + + if (self != null) { + statements.add(JsIrBuilder.buildReturn(factory.symbol, JsIrBuilder.buildGetValue(self), irClass.defaultType)) + } } constructorFactory = factory @@ -169,8 +174,9 @@ class ES6ConstructorLowering(val context: JsIrBackendContext) : DeclarationTrans irClass: IrClass, constructorReplacement: IrSimpleFunction, currentConstructor: IrConstructor, - ): IrValueSymbol { + ): IrValueSymbol? { var generatedThisValueSymbol: IrValueSymbol? = null + var gotLinkageErrorInsteadOfSuperCall = false val selfParameterSymbol = irClass.thisReceiver!!.symbol val boxParameterSymbol = constructorReplacement.boxParameter @@ -194,6 +200,13 @@ class ES6ConstructorLowering(val context: JsIrBackendContext) : DeclarationTrans } } + override fun visitCall(expression: IrCall): IrExpression { + if (expression.symbol == context.irBuiltIns.linkageErrorSymbol) { + gotLinkageErrorInsteadOfSuperCall = true + } + return super.visitCall(expression) + } + override fun visitDelegatingConstructorCall(expression: IrDelegatingConstructorCall): IrExpression { val constructor = expression.symbol.owner @@ -244,7 +257,9 @@ class ES6ConstructorLowering(val context: JsIrBackendContext) : DeclarationTrans } }) - return generatedThisValueSymbol!! + return generatedThisValueSymbol ?: runUnless(gotLinkageErrorInsteadOfSuperCall) { + error("Expect to have either super call or partial linkage stub inside constructor") + } } private fun IrClass.getCurrentConstructorReference(currentFactoryFunction: IrSimpleFunction): IrExpression { diff --git a/js/js.tests/test/org/jetbrains/kotlin/generators/tests/GenerateJsTests.kt b/js/js.tests/test/org/jetbrains/kotlin/generators/tests/GenerateJsTests.kt index e3ac1174ce4..d7699e65124 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/generators/tests/GenerateJsTests.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/generators/tests/GenerateJsTests.kt @@ -38,22 +38,6 @@ fun main(args: Array) { } } - testGroup("js/js.tests/tests-gen", "compiler/testData") { - testClass { - model("klibABI/", pattern = "^([^_](.+))$", targetBackend = TargetBackend.JS_IR, recursive = false) - } - } - testGroup("js/js.tests/tests-gen", "compiler/testData") { - testClass { - model("klibABI/", pattern = "^([^_](.+))$", targetBackend = TargetBackend.JS_IR, recursive = false) - } - } - testGroup("js/js.tests/tests-gen", "compiler/testData") { - testClass { - model("klibABI/", pattern = "^([^_](.+))$", targetBackend = TargetBackend.JS_IR, recursive = false) - } - } - testGroup("js/js.tests/tests-gen", "compiler/testData/binaryCompatibility", testRunnerMethodName = "runTest0") { testClass { model("klibEvolution", targetBackend = TargetBackend.JS_IR) @@ -65,6 +49,27 @@ fun main(args: Array) { } generateTestGroupSuiteWithJUnit5(args) { + testGroup("js/js.tests/tests-gen", "compiler/testData") { + testClass { + model("klibABI/", pattern = "^([^_](.+))$", targetBackend = TargetBackend.JS_IR, recursive = false) + } + } + testGroup("js/js.tests/tests-gen", "compiler/testData") { + testClass { + model("klibABI/", pattern = "^([^_](.+))$", targetBackend = TargetBackend.JS_IR, recursive = false) + } + } + testGroup("js/js.tests/tests-gen", "compiler/testData") { + testClass { + model("klibABI/", pattern = "^([^_](.+))$", targetBackend = TargetBackend.JS_IR_ES6, recursive = false) + } + } + testGroup("js/js.tests/tests-gen", "compiler/testData") { + testClass { + model("klibABI/", pattern = "^([^_](.+))$", targetBackend = TargetBackend.JS_IR, recursive = false) + } + } + testGroup("js/js.tests/tests-gen", "js/js.translator/testData") { testClass { model("incremental/invalidation/", pattern = "^([^_](.+))$", targetBackend = TargetBackend.JS_IR, recursive = false) diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/AbstractJsPartialLinkageTestCase.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/AbstractJsPartialLinkageTestCase.kt index 6863e0a86db..6b24439598b 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/AbstractJsPartialLinkageTestCase.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/AbstractJsPartialLinkageTestCase.kt @@ -10,6 +10,7 @@ import com.intellij.openapi.vfs.VirtualFileManager import com.intellij.openapi.vfs.local.CoreLocalFileSystem import com.intellij.psi.PsiManager import com.intellij.psi.SingleRootFileViewProvider +import com.intellij.testFramework.TestDataFile import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig import org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport import org.jetbrains.kotlin.cli.common.messages.MessageRenderer @@ -49,7 +50,8 @@ import org.jetbrains.kotlin.konan.file.ZipFileSystemCacheableAccessor import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.serialization.js.ModuleKind -import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase +import org.jetbrains.kotlin.test.utils.TestDisposable +import org.junit.jupiter.api.AfterEach import java.io.ByteArrayOutputStream import java.io.File import java.io.PrintStream @@ -57,36 +59,28 @@ import java.nio.charset.Charset import kotlin.io.path.createTempDirectory abstract class AbstractJsPartialLinkageNoICTestCase : AbstractJsPartialLinkageTestCase(CompilerType.K1_NO_IC) +abstract class AbstractJsPartialLinkageNoICES6TestCase : AbstractJsPartialLinkageTestCase(CompilerType.K1_NO_IC_WITH_ES6) abstract class AbstractJsPartialLinkageWithICTestCase : AbstractJsPartialLinkageTestCase(CompilerType.K1_WITH_IC) abstract class AbstractFirJsPartialLinkageNoICTestCase : AbstractJsPartialLinkageTestCase(CompilerType.K2_NO_IC) -abstract class AbstractJsPartialLinkageTestCase(val compilerType: CompilerType) : KtUsefulTestCase() { - enum class CompilerType(val testModeName: String) { - K1_NO_IC("JS_NO_IC"), - K1_WITH_IC("JS_WITH_IC"), - K2_NO_IC("JS_NO_IC") +abstract class AbstractJsPartialLinkageTestCase(val compilerType: CompilerType) { + enum class CompilerType(val testModeName: String, val es6Mode: Boolean) { + K1_NO_IC("JS_NO_IC", false), + K1_NO_IC_WITH_ES6("JS_NO_IC", true), + K1_WITH_IC("JS_WITH_IC", false), + K2_NO_IC("JS_NO_IC", false) } - private lateinit var buildDir: File - private lateinit var environment: KotlinCoreEnvironment - private val zipAccessor = ZipFileSystemCacheableAccessor(2) + private val buildDir = createTempDirectory().toFile().also { it.mkdirs() } + private val environment = + KotlinCoreEnvironment.createForParallelTests(TestDisposable(), CompilerConfiguration(), EnvironmentConfigFiles.JS_CONFIG_FILES) - override fun setUp() { - super.setUp() - buildDir = createTempDirectory().toFile().also { it.mkdirs() } - environment = KotlinCoreEnvironment.createForTests( - testRootDisposable, - CompilerConfiguration(), - EnvironmentConfigFiles.JS_CONFIG_FILES - ) - } - - override fun tearDown() { + @AfterEach + fun clearArtifacts() { zipAccessor.reset() buildDir.deleteRecursively() - super.tearDown() } private fun createConfig(moduleName: String): CompilerConfiguration { @@ -128,7 +122,7 @@ abstract class AbstractJsPartialLinkageTestCase(val compilerType: CompilerType) } // The entry point to generated test classes. - fun doTest(testPath: String) = PartialLinkageTestUtils.runTest(JsTestConfiguration(testPath)) + fun runTest(@TestDataFile testPath: String) = PartialLinkageTestUtils.runTest(JsTestConfiguration(testPath)) private fun buildKlib(moduleName: String, buildDirs: ModuleBuildDirs, dependencies: Dependencies, klibFile: File) { buildDirs.sourceDir.walkTopDown() @@ -136,7 +130,8 @@ abstract class AbstractJsPartialLinkageTestCase(val compilerType: CompilerType) .forEach { file -> file.copyTo(buildDirs.outputDir.resolve(file.relativeTo(buildDirs.sourceDir)), overwrite = true) } when (compilerType) { - CompilerType.K1_NO_IC, CompilerType.K1_WITH_IC -> buildKlibWithK1(moduleName, buildDirs.sourceDir, dependencies, klibFile) + CompilerType.K1_NO_IC, CompilerType.K1_NO_IC_WITH_ES6, CompilerType.K1_WITH_IC -> + buildKlibWithK1(moduleName, buildDirs.sourceDir, dependencies, klibFile) CompilerType.K2_NO_IC -> buildKlibWithK2(moduleName, buildDirs.sourceDir, dependencies, klibFile) } } @@ -247,7 +242,8 @@ abstract class AbstractJsPartialLinkageTestCase(val compilerType: CompilerType) configuration.setupPartialLinkageConfig(PartialLinkageConfig(PartialLinkageMode.ENABLE, PartialLinkageLogLevel.WARNING)) val compilationOutputs = when (compilerType) { - CompilerType.K1_NO_IC, CompilerType.K2_NO_IC -> buildBinaryNoIC(configuration, mainModuleKlibFile, allDependencies) + CompilerType.K1_NO_IC, CompilerType.K1_NO_IC_WITH_ES6, CompilerType.K2_NO_IC -> + buildBinaryNoIC(configuration, mainModuleKlibFile, allDependencies, compilerType.es6Mode) CompilerType.K1_WITH_IC -> buildBinaryWithIC(configuration, mainModuleKlibFile, allDependencies) } @@ -288,7 +284,8 @@ abstract class AbstractJsPartialLinkageTestCase(val compilerType: CompilerType) private fun buildBinaryNoIC( configuration: CompilerConfiguration, mainModuleKlibFile: File, - allDependencies: Dependencies + allDependencies: Dependencies, + es6mode: Boolean ): CompilationOutputs { val klib = MainModule.Klib(mainModuleKlibFile.path) val moduleStructure = ModulesStructure( @@ -304,7 +301,8 @@ abstract class AbstractJsPartialLinkageTestCase(val compilerType: CompilerType) PhaseConfig(jsPhases), IrFactoryImplForJsIC(WholeWorldStageController()), exportedDeclarations = setOf(BOX_FUN_FQN), - granularity = JsGenerationGranularity.PER_MODULE + granularity = JsGenerationGranularity.PER_MODULE, + es6mode = es6mode ) val transformer = IrModuleToJsTransformer( diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/FirJsPartialLinkageNoICTestCaseGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/FirJsPartialLinkageNoICTestCaseGenerated.java index 11c83fd4a8c..5d5d21ab82e 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/FirJsPartialLinkageNoICTestCaseGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/FirJsPartialLinkageNoICTestCaseGenerated.java @@ -6,12 +6,11 @@ package org.jetbrains.kotlin.js.test.ir; import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; -import org.jetbrains.kotlin.test.KotlinTestUtils; import org.jetbrains.kotlin.test.util.KtTestUtil; import org.jetbrains.kotlin.test.TargetBackend; import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.regex.Pattern; @@ -20,116 +19,133 @@ import java.util.regex.Pattern; @SuppressWarnings("all") @TestMetadata("compiler/testData/klibABI") @TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) public class FirJsPartialLinkageNoICTestCaseGenerated extends AbstractFirJsPartialLinkageNoICTestCase { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JS_IR, testDataFilePath); - } - + @Test @TestMetadata("addEnumEntry") public void testAddEnumEntry() throws Exception { runTest("compiler/testData/klibABI/addEnumEntry/"); } + @Test @TestMetadata("addSealedSubclass") public void testAddSealedSubclass() throws Exception { runTest("compiler/testData/klibABI/addSealedSubclass/"); } + @Test public void testAllFilesPresentInKlibABI() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/klibABI"), Pattern.compile("^([^_](.+))$"), null, TargetBackend.JS_IR, false); } + @Test @TestMetadata("changeClassVisibility") public void testChangeClassVisibility() throws Exception { runTest("compiler/testData/klibABI/changeClassVisibility/"); } + @Test @TestMetadata("changeFunctionVisibility") public void testChangeFunctionVisibility() throws Exception { runTest("compiler/testData/klibABI/changeFunctionVisibility/"); } + @Test @TestMetadata("changePropertyVisibility") public void testChangePropertyVisibility() throws Exception { runTest("compiler/testData/klibABI/changePropertyVisibility/"); } + @Test @TestMetadata("classTransformations") public void testClassTransformations() throws Exception { runTest("compiler/testData/klibABI/classTransformations/"); } + @Test @TestMetadata("externalDeclarations") public void testExternalDeclarations() throws Exception { runTest("compiler/testData/klibABI/externalDeclarations/"); } + @Test @TestMetadata("functionTransformations") public void testFunctionTransformations() throws Exception { runTest("compiler/testData/klibABI/functionTransformations/"); } + @Test @TestMetadata("inheritanceIssues") public void testInheritanceIssues() throws Exception { runTest("compiler/testData/klibABI/inheritanceIssues/"); } + @Test @TestMetadata("noNonImplementedCallableFalsePositives") public void testNoNonImplementedCallableFalsePositives() throws Exception { runTest("compiler/testData/klibABI/noNonImplementedCallableFalsePositives/"); } + @Test @TestMetadata("nonAbstractCallableBecomesAbstract") public void testNonAbstractCallableBecomesAbstract() throws Exception { runTest("compiler/testData/klibABI/nonAbstractCallableBecomesAbstract/"); } + @Test @TestMetadata("nonExhaustivenessOfWhenClause") public void testNonExhaustivenessOfWhenClause() throws Exception { runTest("compiler/testData/klibABI/nonExhaustivenessOfWhenClause/"); } + @Test @TestMetadata("propertyTransformations") public void testPropertyTransformations() throws Exception { runTest("compiler/testData/klibABI/propertyTransformations/"); } + @Test @TestMetadata("referencingUnusableDeclarations") public void testReferencingUnusableDeclarations() throws Exception { runTest("compiler/testData/klibABI/referencingUnusableDeclarations/"); } + @Test @TestMetadata("removeAbstractCallableFromAbstractClassOrInterface") public void testRemoveAbstractCallableFromAbstractClassOrInterface() throws Exception { runTest("compiler/testData/klibABI/removeAbstractCallableFromAbstractClassOrInterface/"); } + @Test @TestMetadata("removeCallable") public void testRemoveCallable() throws Exception { runTest("compiler/testData/klibABI/removeCallable/"); } + @Test @TestMetadata("removeClass") public void testRemoveClass() throws Exception { runTest("compiler/testData/klibABI/removeClass/"); } + @Test @TestMetadata("removeEnumEntry") public void testRemoveEnumEntry() throws Exception { runTest("compiler/testData/klibABI/removeEnumEntry/"); } + @Test @TestMetadata("removeSealedSubclass") public void testRemoveSealedSubclass() throws Exception { runTest("compiler/testData/klibABI/removeSealedSubclass/"); } + @Test @TestMetadata("replaceCallableReturnType") public void testReplaceCallableReturnType() throws Exception { runTest("compiler/testData/klibABI/replaceCallableReturnType/"); } + @Test @TestMetadata("typeAliasChanges") public void testTypeAliasChanges() throws Exception { runTest("compiler/testData/klibABI/typeAliasChanges/"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/JsPartialLinkageNoICES6TestCaseGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/JsPartialLinkageNoICES6TestCaseGenerated.java new file mode 100644 index 00000000000..31ed73458a8 --- /dev/null +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/JsPartialLinkageNoICES6TestCaseGenerated.java @@ -0,0 +1,153 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.js.test.ir; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.util.KtTestUtil; +import org.jetbrains.kotlin.test.TargetBackend; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateJsTestsKt}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("compiler/testData/klibABI") +@TestDataPath("$PROJECT_ROOT") +public class JsPartialLinkageNoICES6TestCaseGenerated extends AbstractJsPartialLinkageNoICES6TestCase { + @Test + @TestMetadata("addEnumEntry") + public void testAddEnumEntry() throws Exception { + runTest("compiler/testData/klibABI/addEnumEntry/"); + } + + @Test + @TestMetadata("addSealedSubclass") + public void testAddSealedSubclass() throws Exception { + runTest("compiler/testData/klibABI/addSealedSubclass/"); + } + + @Test + public void testAllFilesPresentInKlibABI() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/klibABI"), Pattern.compile("^([^_](.+))$"), null, TargetBackend.JS_IR_ES6, false); + } + + @Test + @TestMetadata("changeClassVisibility") + public void testChangeClassVisibility() throws Exception { + runTest("compiler/testData/klibABI/changeClassVisibility/"); + } + + @Test + @TestMetadata("changeFunctionVisibility") + public void testChangeFunctionVisibility() throws Exception { + runTest("compiler/testData/klibABI/changeFunctionVisibility/"); + } + + @Test + @TestMetadata("changePropertyVisibility") + public void testChangePropertyVisibility() throws Exception { + runTest("compiler/testData/klibABI/changePropertyVisibility/"); + } + + @Test + @TestMetadata("classTransformations") + public void testClassTransformations() throws Exception { + runTest("compiler/testData/klibABI/classTransformations/"); + } + + @Test + @TestMetadata("externalDeclarations") + public void testExternalDeclarations() throws Exception { + runTest("compiler/testData/klibABI/externalDeclarations/"); + } + + @Test + @TestMetadata("functionTransformations") + public void testFunctionTransformations() throws Exception { + runTest("compiler/testData/klibABI/functionTransformations/"); + } + + @Test + @TestMetadata("inheritanceIssues") + public void testInheritanceIssues() throws Exception { + runTest("compiler/testData/klibABI/inheritanceIssues/"); + } + + @Test + @TestMetadata("noNonImplementedCallableFalsePositives") + public void testNoNonImplementedCallableFalsePositives() throws Exception { + runTest("compiler/testData/klibABI/noNonImplementedCallableFalsePositives/"); + } + + @Test + @TestMetadata("nonAbstractCallableBecomesAbstract") + public void testNonAbstractCallableBecomesAbstract() throws Exception { + runTest("compiler/testData/klibABI/nonAbstractCallableBecomesAbstract/"); + } + + @Test + @TestMetadata("nonExhaustivenessOfWhenClause") + public void testNonExhaustivenessOfWhenClause() throws Exception { + runTest("compiler/testData/klibABI/nonExhaustivenessOfWhenClause/"); + } + + @Test + @TestMetadata("propertyTransformations") + public void testPropertyTransformations() throws Exception { + runTest("compiler/testData/klibABI/propertyTransformations/"); + } + + @Test + @TestMetadata("referencingUnusableDeclarations") + public void testReferencingUnusableDeclarations() throws Exception { + runTest("compiler/testData/klibABI/referencingUnusableDeclarations/"); + } + + @Test + @TestMetadata("removeAbstractCallableFromAbstractClassOrInterface") + public void testRemoveAbstractCallableFromAbstractClassOrInterface() throws Exception { + runTest("compiler/testData/klibABI/removeAbstractCallableFromAbstractClassOrInterface/"); + } + + @Test + @TestMetadata("removeCallable") + public void testRemoveCallable() throws Exception { + runTest("compiler/testData/klibABI/removeCallable/"); + } + + @Test + @TestMetadata("removeClass") + public void testRemoveClass() throws Exception { + runTest("compiler/testData/klibABI/removeClass/"); + } + + @Test + @TestMetadata("removeEnumEntry") + public void testRemoveEnumEntry() throws Exception { + runTest("compiler/testData/klibABI/removeEnumEntry/"); + } + + @Test + @TestMetadata("removeSealedSubclass") + public void testRemoveSealedSubclass() throws Exception { + runTest("compiler/testData/klibABI/removeSealedSubclass/"); + } + + @Test + @TestMetadata("replaceCallableReturnType") + public void testReplaceCallableReturnType() throws Exception { + runTest("compiler/testData/klibABI/replaceCallableReturnType/"); + } + + @Test + @TestMetadata("typeAliasChanges") + public void testTypeAliasChanges() throws Exception { + runTest("compiler/testData/klibABI/typeAliasChanges/"); + } +} diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/JsPartialLinkageNoICTestCaseGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/JsPartialLinkageNoICTestCaseGenerated.java index a87888c07b4..8ce8c9a715e 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/JsPartialLinkageNoICTestCaseGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/JsPartialLinkageNoICTestCaseGenerated.java @@ -6,12 +6,11 @@ package org.jetbrains.kotlin.js.test.ir; import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; -import org.jetbrains.kotlin.test.KotlinTestUtils; import org.jetbrains.kotlin.test.util.KtTestUtil; import org.jetbrains.kotlin.test.TargetBackend; import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.regex.Pattern; @@ -20,116 +19,133 @@ import java.util.regex.Pattern; @SuppressWarnings("all") @TestMetadata("compiler/testData/klibABI") @TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) public class JsPartialLinkageNoICTestCaseGenerated extends AbstractJsPartialLinkageNoICTestCase { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JS_IR, testDataFilePath); - } - + @Test @TestMetadata("addEnumEntry") public void testAddEnumEntry() throws Exception { runTest("compiler/testData/klibABI/addEnumEntry/"); } + @Test @TestMetadata("addSealedSubclass") public void testAddSealedSubclass() throws Exception { runTest("compiler/testData/klibABI/addSealedSubclass/"); } + @Test public void testAllFilesPresentInKlibABI() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/klibABI"), Pattern.compile("^([^_](.+))$"), null, TargetBackend.JS_IR, false); } + @Test @TestMetadata("changeClassVisibility") public void testChangeClassVisibility() throws Exception { runTest("compiler/testData/klibABI/changeClassVisibility/"); } + @Test @TestMetadata("changeFunctionVisibility") public void testChangeFunctionVisibility() throws Exception { runTest("compiler/testData/klibABI/changeFunctionVisibility/"); } + @Test @TestMetadata("changePropertyVisibility") public void testChangePropertyVisibility() throws Exception { runTest("compiler/testData/klibABI/changePropertyVisibility/"); } + @Test @TestMetadata("classTransformations") public void testClassTransformations() throws Exception { runTest("compiler/testData/klibABI/classTransformations/"); } + @Test @TestMetadata("externalDeclarations") public void testExternalDeclarations() throws Exception { runTest("compiler/testData/klibABI/externalDeclarations/"); } + @Test @TestMetadata("functionTransformations") public void testFunctionTransformations() throws Exception { runTest("compiler/testData/klibABI/functionTransformations/"); } + @Test @TestMetadata("inheritanceIssues") public void testInheritanceIssues() throws Exception { runTest("compiler/testData/klibABI/inheritanceIssues/"); } + @Test @TestMetadata("noNonImplementedCallableFalsePositives") public void testNoNonImplementedCallableFalsePositives() throws Exception { runTest("compiler/testData/klibABI/noNonImplementedCallableFalsePositives/"); } + @Test @TestMetadata("nonAbstractCallableBecomesAbstract") public void testNonAbstractCallableBecomesAbstract() throws Exception { runTest("compiler/testData/klibABI/nonAbstractCallableBecomesAbstract/"); } + @Test @TestMetadata("nonExhaustivenessOfWhenClause") public void testNonExhaustivenessOfWhenClause() throws Exception { runTest("compiler/testData/klibABI/nonExhaustivenessOfWhenClause/"); } + @Test @TestMetadata("propertyTransformations") public void testPropertyTransformations() throws Exception { runTest("compiler/testData/klibABI/propertyTransformations/"); } + @Test @TestMetadata("referencingUnusableDeclarations") public void testReferencingUnusableDeclarations() throws Exception { runTest("compiler/testData/klibABI/referencingUnusableDeclarations/"); } + @Test @TestMetadata("removeAbstractCallableFromAbstractClassOrInterface") public void testRemoveAbstractCallableFromAbstractClassOrInterface() throws Exception { runTest("compiler/testData/klibABI/removeAbstractCallableFromAbstractClassOrInterface/"); } + @Test @TestMetadata("removeCallable") public void testRemoveCallable() throws Exception { runTest("compiler/testData/klibABI/removeCallable/"); } + @Test @TestMetadata("removeClass") public void testRemoveClass() throws Exception { runTest("compiler/testData/klibABI/removeClass/"); } + @Test @TestMetadata("removeEnumEntry") public void testRemoveEnumEntry() throws Exception { runTest("compiler/testData/klibABI/removeEnumEntry/"); } + @Test @TestMetadata("removeSealedSubclass") public void testRemoveSealedSubclass() throws Exception { runTest("compiler/testData/klibABI/removeSealedSubclass/"); } + @Test @TestMetadata("replaceCallableReturnType") public void testReplaceCallableReturnType() throws Exception { runTest("compiler/testData/klibABI/replaceCallableReturnType/"); } + @Test @TestMetadata("typeAliasChanges") public void testTypeAliasChanges() throws Exception { runTest("compiler/testData/klibABI/typeAliasChanges/"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/JsPartialLinkageWithICTestCaseGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/JsPartialLinkageWithICTestCaseGenerated.java index c7cd27b18f8..8b6341d8707 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/JsPartialLinkageWithICTestCaseGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/JsPartialLinkageWithICTestCaseGenerated.java @@ -6,12 +6,11 @@ package org.jetbrains.kotlin.js.test.ir; import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; -import org.jetbrains.kotlin.test.KotlinTestUtils; import org.jetbrains.kotlin.test.util.KtTestUtil; import org.jetbrains.kotlin.test.TargetBackend; import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.regex.Pattern; @@ -20,116 +19,133 @@ import java.util.regex.Pattern; @SuppressWarnings("all") @TestMetadata("compiler/testData/klibABI") @TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) public class JsPartialLinkageWithICTestCaseGenerated extends AbstractJsPartialLinkageWithICTestCase { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JS_IR, testDataFilePath); - } - + @Test @TestMetadata("addEnumEntry") public void testAddEnumEntry() throws Exception { runTest("compiler/testData/klibABI/addEnumEntry/"); } + @Test @TestMetadata("addSealedSubclass") public void testAddSealedSubclass() throws Exception { runTest("compiler/testData/klibABI/addSealedSubclass/"); } + @Test public void testAllFilesPresentInKlibABI() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/klibABI"), Pattern.compile("^([^_](.+))$"), null, TargetBackend.JS_IR, false); } + @Test @TestMetadata("changeClassVisibility") public void testChangeClassVisibility() throws Exception { runTest("compiler/testData/klibABI/changeClassVisibility/"); } + @Test @TestMetadata("changeFunctionVisibility") public void testChangeFunctionVisibility() throws Exception { runTest("compiler/testData/klibABI/changeFunctionVisibility/"); } + @Test @TestMetadata("changePropertyVisibility") public void testChangePropertyVisibility() throws Exception { runTest("compiler/testData/klibABI/changePropertyVisibility/"); } + @Test @TestMetadata("classTransformations") public void testClassTransformations() throws Exception { runTest("compiler/testData/klibABI/classTransformations/"); } + @Test @TestMetadata("externalDeclarations") public void testExternalDeclarations() throws Exception { runTest("compiler/testData/klibABI/externalDeclarations/"); } + @Test @TestMetadata("functionTransformations") public void testFunctionTransformations() throws Exception { runTest("compiler/testData/klibABI/functionTransformations/"); } + @Test @TestMetadata("inheritanceIssues") public void testInheritanceIssues() throws Exception { runTest("compiler/testData/klibABI/inheritanceIssues/"); } + @Test @TestMetadata("noNonImplementedCallableFalsePositives") public void testNoNonImplementedCallableFalsePositives() throws Exception { runTest("compiler/testData/klibABI/noNonImplementedCallableFalsePositives/"); } + @Test @TestMetadata("nonAbstractCallableBecomesAbstract") public void testNonAbstractCallableBecomesAbstract() throws Exception { runTest("compiler/testData/klibABI/nonAbstractCallableBecomesAbstract/"); } + @Test @TestMetadata("nonExhaustivenessOfWhenClause") public void testNonExhaustivenessOfWhenClause() throws Exception { runTest("compiler/testData/klibABI/nonExhaustivenessOfWhenClause/"); } + @Test @TestMetadata("propertyTransformations") public void testPropertyTransformations() throws Exception { runTest("compiler/testData/klibABI/propertyTransformations/"); } + @Test @TestMetadata("referencingUnusableDeclarations") public void testReferencingUnusableDeclarations() throws Exception { runTest("compiler/testData/klibABI/referencingUnusableDeclarations/"); } + @Test @TestMetadata("removeAbstractCallableFromAbstractClassOrInterface") public void testRemoveAbstractCallableFromAbstractClassOrInterface() throws Exception { runTest("compiler/testData/klibABI/removeAbstractCallableFromAbstractClassOrInterface/"); } + @Test @TestMetadata("removeCallable") public void testRemoveCallable() throws Exception { runTest("compiler/testData/klibABI/removeCallable/"); } + @Test @TestMetadata("removeClass") public void testRemoveClass() throws Exception { runTest("compiler/testData/klibABI/removeClass/"); } + @Test @TestMetadata("removeEnumEntry") public void testRemoveEnumEntry() throws Exception { runTest("compiler/testData/klibABI/removeEnumEntry/"); } + @Test @TestMetadata("removeSealedSubclass") public void testRemoveSealedSubclass() throws Exception { runTest("compiler/testData/klibABI/removeSealedSubclass/"); } + @Test @TestMetadata("replaceCallableReturnType") public void testReplaceCallableReturnType() throws Exception { runTest("compiler/testData/klibABI/replaceCallableReturnType/"); } + @Test @TestMetadata("typeAliasChanges") public void testTypeAliasChanges() throws Exception { runTest("compiler/testData/klibABI/typeAliasChanges/");