diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt index 95e78c304b2..f6180d7fa04 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt @@ -321,10 +321,10 @@ abstract class CommonCompilerArguments : CommonToolArguments() { var useMixedNamedArguments: Boolean by FreezableVar(false) @Argument( - value = "-Xklib-mpp", - description = "Enable experimental support for multi-platform klib libraries" + value = "-Xexpect-actual-linker", + description = "Enable experimental expect/actual linker" ) - var klibBasedMpp: Boolean by FreezableVar(false) + var expectActualLinker: Boolean by FreezableVar(false) @Argument(value = "-Xdisable-default-scripting-plugin", description = "Do not enable scripting plugin by default") var disableDefaultScriptingPlugin: Boolean by FreezableVar(false) @@ -347,7 +347,7 @@ abstract class CommonCompilerArguments : CommonToolArguments() { collector.report(CompilerMessageSeverity.WARNING, "'-Xexperimental' is deprecated and will be removed in a future release") } put(AnalysisFlags.useExperimental, useExperimental?.toList().orEmpty() + optIn?.toList().orEmpty()) - put(AnalysisFlags.klibBasedMpp, klibBasedMpp) + put(AnalysisFlags.expectActualLinker, expectActualLinker) put(AnalysisFlags.explicitApiVersion, apiVersion != null) put(AnalysisFlags.allowResultReturnType, allowResultReturnType) ExplicitApiMode.fromString(explicitApi)?.also { put(AnalysisFlags.explicitApiMode, it) } ?: collector.report( diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/arguments.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/common/arguments.kt index 3ff837810ed..e12391d8989 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/arguments.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/arguments.kt @@ -23,7 +23,7 @@ fun CompilerConfiguration.setupCommonArguments( ) { put(CommonConfigurationKeys.DISABLE_INLINE, arguments.noInline) put(CommonConfigurationKeys.USE_FIR, arguments.useFir) - put(CommonConfigurationKeys.KLIB_MPP, arguments.klibBasedMpp) + put(CommonConfigurationKeys.EXPECT_ACTUAL_LINKER, arguments.expectActualLinker) putIfNotNull(CLIConfigurationKeys.INTELLIJ_PLUGIN_ROOT, arguments.intellijPluginRoot) put(CommonConfigurationKeys.REPORT_OUTPUT_FILES, arguments.reportOutputFiles) @@ -118,4 +118,4 @@ private fun MessageCollector.reportUnsafeInternalArgum "compiler or generated code. Use it at your own risk!\n" ) } -} \ No newline at end of file +} diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/K2MetadataCompiler.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/K2MetadataCompiler.kt index 022cd8214f2..d744bb86758 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/K2MetadataCompiler.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/K2MetadataCompiler.kt @@ -106,7 +106,7 @@ class K2MetadataCompiler : CLICompiler() { try { val metadataVersion = configuration.get(CommonConfigurationKeys.METADATA_VERSION) as? BuiltInsBinaryVersion ?: BuiltInsBinaryVersion.INSTANCE - if (arguments.klibBasedMpp) { + if (arguments.expectActualLinker) { K2MetadataKlibSerializer(metadataVersion).serialize(environment) } else { MetadataSerializer(metadataVersion, true).serialize(environment) diff --git a/compiler/config/src/org/jetbrains/kotlin/config/AnalysisFlags.kt b/compiler/config/src/org/jetbrains/kotlin/config/AnalysisFlags.kt index 2959d8ccd2a..e560cfd5d85 100644 --- a/compiler/config/src/org/jetbrains/kotlin/config/AnalysisFlags.kt +++ b/compiler/config/src/org/jetbrains/kotlin/config/AnalysisFlags.kt @@ -13,7 +13,7 @@ object AnalysisFlags { val multiPlatformDoNotCheckActual by AnalysisFlag.Delegates.Boolean @JvmStatic - val klibBasedMpp by AnalysisFlag.Delegates.Boolean + val expectActualLinker by AnalysisFlag.Delegates.Boolean @JvmStatic val experimental by AnalysisFlag.Delegates.ListOfStrings diff --git a/compiler/config/src/org/jetbrains/kotlin/config/CommonConfigurationKeys.kt b/compiler/config/src/org/jetbrains/kotlin/config/CommonConfigurationKeys.kt index a79a4954e88..4fc5f368965 100644 --- a/compiler/config/src/org/jetbrains/kotlin/config/CommonConfigurationKeys.kt +++ b/compiler/config/src/org/jetbrains/kotlin/config/CommonConfigurationKeys.kt @@ -46,7 +46,7 @@ object CommonConfigurationKeys { val USE_FIR = CompilerConfigurationKey.create("front-end IR") @JvmField - val KLIB_MPP = CompilerConfigurationKey.create("Klib based MPP") + val EXPECT_ACTUAL_LINKER = CompilerConfigurationKey.create("Experimental expext/actual linker") } var CompilerConfiguration.languageVersionSettings: LanguageVersionSettings diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ExpectedActualDeclarationChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ExpectedActualDeclarationChecker.kt index 5e5d63f2572..41af0be9294 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ExpectedActualDeclarationChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ExpectedActualDeclarationChecker.kt @@ -55,7 +55,7 @@ class ExpectedActualDeclarationChecker( override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) { if (!context.languageVersionSettings.supportsFeature(LanguageFeature.MultiPlatformProjects)) return // TODO: we need a klib based MPP aware ModuleStructureOracle. Just disable the checks for now. - if (context.languageVersionSettings.getFlag(AnalysisFlags.klibBasedMpp)) return + if (context.languageVersionSettings.getFlag(AnalysisFlags.expectActualLinker)) return // Note that this check is necessary, because for default accessors KtProperty is passed for KtDeclaration, so this // case won't be covered by the next check (also, it accidentally fixes KT-28385) diff --git a/compiler/ir/serialization.js/src/org/jetbrains/kotlin/ir/backend/js/klib.kt b/compiler/ir/serialization.js/src/org/jetbrains/kotlin/ir/backend/js/klib.kt index 1f52468f08e..e36ebd2d8d3 100644 --- a/compiler/ir/serialization.js/src/org/jetbrains/kotlin/ir/backend/js/klib.kt +++ b/compiler/ir/serialization.js/src/org/jetbrains/kotlin/ir/backend/js/klib.kt @@ -83,8 +83,8 @@ val emptyLoggingContext = object : LoggingContext { private val CompilerConfiguration.metadataVersion get() = get(CommonConfigurationKeys.METADATA_VERSION) as? KlibMetadataVersion ?: KlibMetadataVersion.INSTANCE -private val CompilerConfiguration.klibMpp: Boolean - get() = get(CommonConfigurationKeys.KLIB_MPP) ?: false +private val CompilerConfiguration.expectActualLinker: Boolean + get() = get(CommonConfigurationKeys.EXPECT_ACTUAL_LINKER) ?: false class KotlinFileSerializedData(val metadata: ByteArray, val irData: SerializedIrFile) @@ -141,7 +141,7 @@ fun generateKLib( val moduleName = configuration[CommonConfigurationKeys.MODULE_NAME]!! - if (!configuration.klibMpp) { + if (!configuration.expectActualLinker) { moduleFragment.acceptVoid(ExpectDeclarationRemover(psi2IrContext.symbolTable, doRemove = false, keepOptionalAnnotations = false)) } @@ -442,7 +442,7 @@ fun serializeModuleIntoKlib( emptyLoggingContext, moduleFragment.irBuiltins, expectDescriptorToSymbol = expectDescriptorToSymbol, - skipExpects = !configuration.klibMpp + skipExpects = !configuration.expectActualLinker ).serializedIrModule(moduleFragment) val moduleDescriptor = moduleFragment.descriptor @@ -547,5 +547,5 @@ private fun compareMetadataAndGoToNextICRoundIfNeeded( private fun KlibMetadataIncrementalSerializer(configuration: CompilerConfiguration) = KlibMetadataIncrementalSerializer( languageVersionSettings = configuration.languageVersionSettings, metadataVersion = configuration.metadataVersion, - skipExpects = !configuration.klibMpp + skipExpects = !configuration.expectActualLinker ) diff --git a/compiler/testData/cli/js/jsExtraHelp.out b/compiler/testData/cli/js/jsExtraHelp.out index 024f2748e66..f4ea73afd5b 100644 --- a/compiler/testData/cli/js/jsExtraHelp.out +++ b/compiler/testData/cli/js/jsExtraHelp.out @@ -32,13 +32,13 @@ where advanced options include: -Xdump-fqname FqName of declaration that should be dumped -Xdump-perf= Dump detailed performance statistics to the specified file -Xeffect-system Enable experimental language feature: effect system + -Xexpect-actual-linker Enable experimental expect/actual linker -Xexperimental= Enable and propagate usages of experimental API for marker annotation with the given fully qualified name -Xexplicit-api={strict|warning|disable} Force compiler to report errors on all public API declarations without explicit visibility or return type. Use 'warning' level to issue warnings instead of errors. -Xinline-classes Enable experimental inline classes -Xintellij-plugin-root= Path to the kotlin-compiler.jar or directory where IntelliJ configuration files can be found - -Xklib-mpp Enable experimental support for multi-platform klib libraries -Xlegacy-smart-cast-after-try Allow var smart casts despite assignment in try block -Xlist-phases List backend phases -Xmetadata-version Change metadata version of the generated binary files diff --git a/compiler/testData/cli/jvm/extraHelp.out b/compiler/testData/cli/jvm/extraHelp.out index 93c1f48b64d..910136693d3 100644 --- a/compiler/testData/cli/jvm/extraHelp.out +++ b/compiler/testData/cli/jvm/extraHelp.out @@ -92,13 +92,13 @@ where advanced options include: -Xdump-fqname FqName of declaration that should be dumped -Xdump-perf= Dump detailed performance statistics to the specified file -Xeffect-system Enable experimental language feature: effect system + -Xexpect-actual-linker Enable experimental expect/actual linker -Xexperimental= Enable and propagate usages of experimental API for marker annotation with the given fully qualified name -Xexplicit-api={strict|warning|disable} Force compiler to report errors on all public API declarations without explicit visibility or return type. Use 'warning' level to issue warnings instead of errors. -Xinline-classes Enable experimental inline classes -Xintellij-plugin-root= Path to the kotlin-compiler.jar or directory where IntelliJ configuration files can be found - -Xklib-mpp Enable experimental support for multi-platform klib libraries -Xlegacy-smart-cast-after-try Allow var smart casts despite assignment in try block -Xlist-phases List backend phases -Xmetadata-version Change metadata version of the generated binary files diff --git a/compiler/testData/codegen/box/multiplatform/multiModule/expectActualLink.kt b/compiler/testData/codegen/box/multiplatform/multiModule/expectActualLink.kt index 76b0c58085e..23c5a2e25fa 100644 --- a/compiler/testData/codegen/box/multiplatform/multiModule/expectActualLink.kt +++ b/compiler/testData/codegen/box/multiplatform/multiModule/expectActualLink.kt @@ -1,6 +1,6 @@ // !LANGUAGE: +MultiPlatformProjects // KJS_WITH_FULL_RUNTIME -// KLIB_BASED_MPP +// EXPECT_ACTUAL_LINKER // IGNORE_BACKEND: JS // IGNORE_BACKEND_FIR: JVM_IR diff --git a/compiler/testData/codegen/box/multiplatform/multiModule/expectActualMemberLink.kt b/compiler/testData/codegen/box/multiplatform/multiModule/expectActualMemberLink.kt index 5dfae1ec017..328dbc0cf70 100644 --- a/compiler/testData/codegen/box/multiplatform/multiModule/expectActualMemberLink.kt +++ b/compiler/testData/codegen/box/multiplatform/multiModule/expectActualMemberLink.kt @@ -1,6 +1,6 @@ // !LANGUAGE: +MultiPlatformProjects // KJS_WITH_FULL_RUNTIME -// KLIB_BASED_MPP +// EXPECT_ACTUAL_LINKER // IGNORE_BACKEND: JS // IGNORE_BACKEND_FIR: JVM_IR diff --git a/compiler/testData/codegen/box/multiplatform/multiModule/expectActualTypealiasLink.kt b/compiler/testData/codegen/box/multiplatform/multiModule/expectActualTypealiasLink.kt index 56b1a36848e..cff5910e8dd 100644 --- a/compiler/testData/codegen/box/multiplatform/multiModule/expectActualTypealiasLink.kt +++ b/compiler/testData/codegen/box/multiplatform/multiModule/expectActualTypealiasLink.kt @@ -1,6 +1,6 @@ // !LANGUAGE: +MultiPlatformProjects // KJS_WITH_FULL_RUNTIME -// KLIB_BASED_MPP +// EXPECT_ACTUAL_LINKER // IGNORE_BACKEND: JS // IGNORE_BACKEND_FIR: JVM_IR diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt index f8debe3bd1f..42c63feb34e 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicBoxTest.kt @@ -124,7 +124,7 @@ abstract class BasicBoxTest( val runPlainBoxFunction = RUN_PLAIN_BOX_FUNCTION.matcher(fileContent).find() val inferMainModule = INFER_MAIN_MODULE.matcher(fileContent).find() - val klibBasedMpp = KLIB_BASED_MPP.matcher(fileContent).find() + val expectActualLinker = EXPECT_ACTUAL_LINKER.matcher(fileContent).find() val skipDceDriven = SKIP_DCE_DRIVEN.matcher(fileContent).find() @@ -171,7 +171,7 @@ abstract class BasicBoxTest( testFactory.tmpDir, file.parent, module, outputFileName, dceOutputFileName, pirOutputFileName, dependencies, allDependencies, friends, modules.size > 1, !SKIP_SOURCEMAP_REMAPPING.matcher(fileContent).find(), outputPrefixFile, outputPostfixFile, - actualMainCallParameters, testPackage, testFunction, needsFullIrRuntime, isMainModule, klibBasedMpp, skipDceDriven + actualMainCallParameters, testPackage, testFunction, needsFullIrRuntime, isMainModule, expectActualLinker, skipDceDriven ) when { @@ -383,7 +383,7 @@ abstract class BasicBoxTest( testFunction: String, needsFullIrRuntime: Boolean, isMainModule: Boolean, - klibBasedMpp: Boolean, + expectActualLinker: Boolean, skipDceDriven: Boolean ) { val kotlinFiles = module.files.filter { it.fileName.endsWith(".kt") } @@ -400,7 +400,7 @@ abstract class BasicBoxTest( val psiFiles = createPsiFiles(allSourceFiles.sortedBy { it.canonicalPath }.map { it.canonicalPath }) val sourceDirs = (testFiles + additionalFiles).map { File(it).parent }.distinct() - val config = createConfig(sourceDirs, module, dependencies, allDependencies, friends, multiModule, tmpDir, incrementalData = null, klibBasedMpp = klibBasedMpp) + val config = createConfig(sourceDirs, module, dependencies, allDependencies, friends, multiModule, tmpDir, incrementalData = null, expectActualLinker = expectActualLinker) val outputFile = File(outputFileName) val dceOutputFile = File(dceOutputFileName) val pirOutputFile = File(pirOutputFileName) @@ -414,7 +414,7 @@ abstract class BasicBoxTest( if (incrementalCompilationChecksEnabled && module.hasFilesToRecompile) { checkIncrementalCompilation( sourceDirs, module, kotlinFiles, dependencies, allDependencies, friends, multiModule, tmpDir, remap, - outputFile, outputPrefixFile, outputPostfixFile, mainCallParameters, incrementalData, testPackage, testFunction, needsFullIrRuntime, klibBasedMpp + outputFile, outputPrefixFile, outputPostfixFile, mainCallParameters, incrementalData, testPackage, testFunction, needsFullIrRuntime, expectActualLinker ) } } @@ -437,7 +437,7 @@ abstract class BasicBoxTest( testPackage: String?, testFunction: String, needsFullIrRuntime: Boolean, - klibBasedMpp: Boolean + expectActualLinker: Boolean ) { val sourceToTranslationUnit = hashMapOf() for (testFile in kotlinFiles) { @@ -455,7 +455,7 @@ abstract class BasicBoxTest( .sortedBy { it.canonicalPath } .map { sourceToTranslationUnit[it]!! } - val recompiledConfig = createConfig(sourceDirs, module, dependencies, allDependencies, friends, multiModule, tmpDir, incrementalData, klibBasedMpp) + val recompiledConfig = createConfig(sourceDirs, module, dependencies, allDependencies, friends, multiModule, tmpDir, incrementalData, expectActualLinker) val recompiledOutputFile = File(outputFile.parentFile, outputFile.nameWithoutExtension + "-recompiled.js") translateFiles( @@ -670,7 +670,7 @@ abstract class BasicBoxTest( private fun createConfig( sourceDirs: List, module: TestModule, dependencies: List, allDependencies: List, friends: List, - multiModule: Boolean, tmpDir: File, incrementalData: IncrementalData?, klibBasedMpp: Boolean + multiModule: Boolean, tmpDir: File, incrementalData: IncrementalData?, expectActualLinker: Boolean ): JsConfig { val configuration = environment.configuration.copy() @@ -722,7 +722,7 @@ abstract class BasicBoxTest( ) ) - configuration.put(CommonConfigurationKeys.KLIB_MPP, klibBasedMpp) + configuration.put(CommonConfigurationKeys.EXPECT_ACTUAL_LINKER, expectActualLinker) return JsConfig(project, configuration, METADATA_CACHE, (JsConfig.JS_STDLIB + JsConfig.JS_KOTLIN_TEST).toSet()) } @@ -915,7 +915,7 @@ abstract class BasicBoxTest( private val SOURCE_MAP_SOURCE_EMBEDDING = Regex("^// *SOURCE_MAP_EMBED_SOURCES: ([A-Z]+)*\$", RegexOption.MULTILINE) private val CALL_MAIN_PATTERN = Pattern.compile("^// *CALL_MAIN *$", Pattern.MULTILINE) private val KJS_WITH_FULL_RUNTIME = Pattern.compile("^// *KJS_WITH_FULL_RUNTIME *\$", Pattern.MULTILINE) - private val KLIB_BASED_MPP = Pattern.compile("^// KLIB_BASED_MPP *$", Pattern.MULTILINE) + private val EXPECT_ACTUAL_LINKER = Pattern.compile("^// EXPECT_ACTUAL_LINKER *$", Pattern.MULTILINE) private val SKIP_DCE_DRIVEN = Pattern.compile("^// *SKIP_DCE_DRIVEN *$", Pattern.MULTILINE) @JvmStatic diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/tasks/KotlinNativeTasks.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/tasks/KotlinNativeTasks.kt index 721b6de3d33..83b1a2fe7df 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/tasks/KotlinNativeTasks.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/tasks/KotlinNativeTasks.kt @@ -250,7 +250,7 @@ abstract class AbstractKotlinNativeCompile : Abstra addArg("-p", outputKind.name.toLowerCase()) if (compilation is KotlinSharedNativeCompilation) { - add("-Xklib-mpp") + add("-Xexpect-actual-linker") add("-Xmetadata-klib") } diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/KotlinCompileCommon.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/KotlinCompileCommon.kt index f34a91d3faa..9a2b4e79d14 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/KotlinCompileCommon.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/KotlinCompileCommon.kt @@ -60,7 +60,7 @@ open class KotlinCompileCommon : AbstractKotlinCompile