[IR] Enable -Xvalue-classes flag
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>
#KT-1179
diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt
index a8db4bd..35c65c4 100644
--- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt
+++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt
@@ -546,6 +546,12 @@
)
var oldInnerClassesLogic: Boolean by FreezableVar(false)
+ @Argument(
+ value = "-Xvalue-classes",
+ description = "Enable experimental value classes"
+ )
+ var valueClasses: Boolean by FreezableVar(false)
+
override fun configureAnalysisFlags(collector: MessageCollector, languageVersion: LanguageVersion): MutableMap<AnalysisFlag<*>, Any> {
val result = super.configureAnalysisFlags(collector, languageVersion)
result[JvmAnalysisFlags.strictMetadataVersionSemantics] = strictMetadataVersionSemantics
@@ -581,6 +587,9 @@
result[LanguageFeature.ForbidSuperDelegationToAbstractFakeOverride] = LanguageFeature.State.ENABLED
result[LanguageFeature.AbstractClassMemberNotImplementedWithIntermediateAbstractClass] = LanguageFeature.State.ENABLED
}
+ if (valueClasses) {
+ result[LanguageFeature.ValueClasses] = LanguageFeature.State.ENABLED
+ }
return result
}
diff --git a/compiler/testData/cli/jvm/extraHelp.out b/compiler/testData/cli/jvm/extraHelp.out
index 993274d..6c78ff2 100644
--- a/compiler/testData/cli/jvm/extraHelp.out
+++ b/compiler/testData/cli/jvm/extraHelp.out
@@ -157,6 +157,7 @@
-Xuse-type-table Use type table in metadata serialization
-Xvalidate-bytecode Validate generated JVM bytecode before and after optimizations
-Xvalidate-ir Validate IR before and after lowering
+ -Xvalue-classes Enable experimental value classes
-Xallow-any-scripts-in-source-roots
Allow to compile any scripts along with regular Kotlin sources
-Xallow-kotlin-package Allow compiling code in package 'kotlin' and allow not requiring kotlin.stdlib in module-info
diff --git a/jps/jps-common/test/CompilerArgumentsContentProspectorTest.kt b/jps/jps-common/test/CompilerArgumentsContentProspectorTest.kt
index 14edff5..42546d5 100644
--- a/jps/jps-common/test/CompilerArgumentsContentProspectorTest.kt
+++ b/jps/jps-common/test/CompilerArgumentsContentProspectorTest.kt
@@ -165,6 +165,7 @@
K2JVMCompilerArguments::noUnifiedNullChecks,
K2JVMCompilerArguments::useOldInlineClassesManglingScheme,
K2JVMCompilerArguments::enableJvmPreview,
+ K2JVMCompilerArguments::valueClasses,
)
private val k2JVMCompilerArgumentsStringProperties = commonCompilerArgumentsStringProperties + listOf(