From 5c0cfa87bad6109cd863be91f5749a90d7e0714b Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Fri, 22 Jan 2021 14:34:24 +0300 Subject: [PATCH] [Test] Support some jvm codegen specific configuration directives --- .../codegen/box/assert/alwaysDisable.kt | 4 ++-- .../codegen/box/assert/alwaysEnable.kt | 4 ++-- ...ssertionsEnabledBeforeClassInitializers.kt | 2 +- .../codegen/box/assert/jvm/classAssertions.kt | 2 +- .../assert/jvm/classAssertionsForCompanion.kt | 2 +- .../jvm/classAssertionsForInnerClasses.kt | 2 +- .../jvm/classAssertionsForLocalClasses.kt | 2 +- .../jvm/classAssertionsForNestedClasses.kt | 2 +- .../assert/jvm/interfaceAssertionsDisabled.kt | 2 +- .../assert/jvm/interfaceAssertionsEnabled.kt | 4 ++-- .../box/assert/jvm/lambdaNotEvaluated.kt | 2 +- .../box/assert/jvm/localAnonymousFunction.kt | 4 ++-- .../codegen/box/assert/jvm/localClass.kt | 4 ++-- .../codegen/box/assert/jvm/localFunction.kt | 4 ++-- .../codegen/box/assert/jvm/localLambda.kt | 4 ++-- .../codegen/box/assert/jvm/localObject.kt | 4 ++-- .../jvm/noUnnecessaryClassInitialization.kt | 2 +- .../codegen/box/assert/jvm/nonLocalReturn.kt | 4 ++-- .../codegen/box/assert/jvm/ordinary.kt | 4 ++-- .../box/assert/jvm/superClassInitializer.kt | 4 ++-- .../jvm/suspendFunctionAssertionDisabled.kt | 2 +- .../jvm/suspendFunctionAssertionsEnabled.kt | 2 +- .../jvm/suspendLambdaAssertionsDisabled.kt | 2 +- .../jvm/suspendLambdaAssertionsEnabled.kt | 2 +- ...onstructorCallWithDisabledNormalization.kt | 2 +- ...ConstructorCallWithEnabledNormalization.kt | 2 +- ...nConstructorCallWithStrictNormalization.kt | 2 +- ...ConstructorCallWithEnabledNormalization.kt | 4 ++-- ...loopInInlineFunWithEnabledNormalization.kt | 2 +- .../JvmEnvironmentConfigurationDirectives.kt | 22 +++++++++++++++++++ .../JvmEnvironmentConfigurator.kt | 10 +++++++++ 31 files changed, 73 insertions(+), 41 deletions(-) diff --git a/compiler/testData/codegen/box/assert/alwaysDisable.kt b/compiler/testData/codegen/box/assert/alwaysDisable.kt index 7979acc6e65..9926f1626f7 100644 --- a/compiler/testData/codegen/box/assert/alwaysDisable.kt +++ b/compiler/testData/codegen/box/assert/alwaysDisable.kt @@ -4,7 +4,7 @@ // IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: JS_IR_ES6 // IGNORE_BACKEND: JS -// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=always-disable +// ASSERTIONS_MODE: always-disable // WITH_RUNTIME fun checkTrue(): Boolean { @@ -42,4 +42,4 @@ fun box(): String { if (checkFalseWithMessage()) return "FAIL 3" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/assert/alwaysEnable.kt b/compiler/testData/codegen/box/assert/alwaysEnable.kt index 33d66d70a1f..4a3c3cda612 100644 --- a/compiler/testData/codegen/box/assert/alwaysEnable.kt +++ b/compiler/testData/codegen/box/assert/alwaysEnable.kt @@ -3,7 +3,7 @@ // IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: JS_IR_ES6 // IGNORE_BACKEND: JS -// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=always-enable +// ASSERTIONS_MODE: always-enable // WITH_RUNTIME fun checkTrue(): Boolean { @@ -49,4 +49,4 @@ fun box(): String { } return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/assert/jvm/assertionsEnabledBeforeClassInitializers.kt b/compiler/testData/codegen/box/assert/jvm/assertionsEnabledBeforeClassInitializers.kt index b94528d63d5..e00a5e2ebb0 100644 --- a/compiler/testData/codegen/box/assert/jvm/assertionsEnabledBeforeClassInitializers.kt +++ b/compiler/testData/codegen/box/assert/jvm/assertionsEnabledBeforeClassInitializers.kt @@ -1,5 +1,5 @@ // TARGET_BACKEND: JVM -// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// ASSERTIONS_MODE: jvm // WITH_RUNTIME // Assertions which run before the class initializer are always checked diff --git a/compiler/testData/codegen/box/assert/jvm/classAssertions.kt b/compiler/testData/codegen/box/assert/jvm/classAssertions.kt index 0bcb3914bcd..09e216f5ca1 100644 --- a/compiler/testData/codegen/box/assert/jvm/classAssertions.kt +++ b/compiler/testData/codegen/box/assert/jvm/classAssertions.kt @@ -1,5 +1,5 @@ // TARGET_BACKEND: JVM -// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// ASSERTIONS_MODE: jvm // WITH_RUNTIME package classAssertions diff --git a/compiler/testData/codegen/box/assert/jvm/classAssertionsForCompanion.kt b/compiler/testData/codegen/box/assert/jvm/classAssertionsForCompanion.kt index 0b765861c84..fa665a56062 100644 --- a/compiler/testData/codegen/box/assert/jvm/classAssertionsForCompanion.kt +++ b/compiler/testData/codegen/box/assert/jvm/classAssertionsForCompanion.kt @@ -1,5 +1,5 @@ // TARGET_BACKEND: JVM -// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// ASSERTIONS_MODE: jvm // WITH_RUNTIME package classAssertions diff --git a/compiler/testData/codegen/box/assert/jvm/classAssertionsForInnerClasses.kt b/compiler/testData/codegen/box/assert/jvm/classAssertionsForInnerClasses.kt index 6f53cdb07b3..fc7e117e12e 100644 --- a/compiler/testData/codegen/box/assert/jvm/classAssertionsForInnerClasses.kt +++ b/compiler/testData/codegen/box/assert/jvm/classAssertionsForInnerClasses.kt @@ -1,6 +1,6 @@ // TARGET_BACKEND: JVM // IGNORE_BACKEND: JVM -// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// ASSERTIONS_MODE: jvm // WITH_RUNTIME package classAssertions diff --git a/compiler/testData/codegen/box/assert/jvm/classAssertionsForLocalClasses.kt b/compiler/testData/codegen/box/assert/jvm/classAssertionsForLocalClasses.kt index 96366cc33bb..24dbb4382bf 100644 --- a/compiler/testData/codegen/box/assert/jvm/classAssertionsForLocalClasses.kt +++ b/compiler/testData/codegen/box/assert/jvm/classAssertionsForLocalClasses.kt @@ -1,6 +1,6 @@ // TARGET_BACKEND: JVM // IGNORE_BACKEND: JVM -// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// ASSERTIONS_MODE: jvm // WITH_RUNTIME package classAssertions diff --git a/compiler/testData/codegen/box/assert/jvm/classAssertionsForNestedClasses.kt b/compiler/testData/codegen/box/assert/jvm/classAssertionsForNestedClasses.kt index 74963866c2e..6e99b08fb66 100644 --- a/compiler/testData/codegen/box/assert/jvm/classAssertionsForNestedClasses.kt +++ b/compiler/testData/codegen/box/assert/jvm/classAssertionsForNestedClasses.kt @@ -1,6 +1,6 @@ // TARGET_BACKEND: JVM // IGNORE_BACKEND: JVM -// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// ASSERTIONS_MODE: jvm // WITH_RUNTIME package classAssertions diff --git a/compiler/testData/codegen/box/assert/jvm/interfaceAssertionsDisabled.kt b/compiler/testData/codegen/box/assert/jvm/interfaceAssertionsDisabled.kt index 023a189eccf..50c94865b93 100644 --- a/compiler/testData/codegen/box/assert/jvm/interfaceAssertionsDisabled.kt +++ b/compiler/testData/codegen/box/assert/jvm/interfaceAssertionsDisabled.kt @@ -1,5 +1,5 @@ // TARGET_BACKEND: JVM -// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// ASSERTIONS_MODE: jvm // WITH_RUNTIME package interfaceAssertionsDisabled diff --git a/compiler/testData/codegen/box/assert/jvm/interfaceAssertionsEnabled.kt b/compiler/testData/codegen/box/assert/jvm/interfaceAssertionsEnabled.kt index 3878018bf55..3ce00abf86f 100644 --- a/compiler/testData/codegen/box/assert/jvm/interfaceAssertionsEnabled.kt +++ b/compiler/testData/codegen/box/assert/jvm/interfaceAssertionsEnabled.kt @@ -1,5 +1,5 @@ // TARGET_BACKEND: JVM -// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// ASSERTIONS_MODE: jvm // WITH_RUNTIME package interfaceAssertionsEnabled @@ -61,4 +61,4 @@ fun box(): String { } return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/assert/jvm/lambdaNotEvaluated.kt b/compiler/testData/codegen/box/assert/jvm/lambdaNotEvaluated.kt index 02c0d488a54..0f66c5ca378 100644 --- a/compiler/testData/codegen/box/assert/jvm/lambdaNotEvaluated.kt +++ b/compiler/testData/codegen/box/assert/jvm/lambdaNotEvaluated.kt @@ -1,5 +1,5 @@ // TARGET_BACKEND: JVM -// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// ASSERTIONS_MODE: jvm // WITH_RUNTIME // If assertions are disabled, neither argument to assert should be evaluated. diff --git a/compiler/testData/codegen/box/assert/jvm/localAnonymousFunction.kt b/compiler/testData/codegen/box/assert/jvm/localAnonymousFunction.kt index 6bcd5092ed2..337e6bcc211 100644 --- a/compiler/testData/codegen/box/assert/jvm/localAnonymousFunction.kt +++ b/compiler/testData/codegen/box/assert/jvm/localAnonymousFunction.kt @@ -1,5 +1,5 @@ // TARGET_BACKEND: JVM -// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// ASSERTIONS_MODE: jvm // WITH_RUNTIME package localAnonymousFunction @@ -123,4 +123,4 @@ fun box(): String { } return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/assert/jvm/localClass.kt b/compiler/testData/codegen/box/assert/jvm/localClass.kt index 6369b054fbb..aa27419f28c 100644 --- a/compiler/testData/codegen/box/assert/jvm/localClass.kt +++ b/compiler/testData/codegen/box/assert/jvm/localClass.kt @@ -1,5 +1,5 @@ // TARGET_BACKEND: JVM -// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// ASSERTIONS_MODE: jvm // WITH_RUNTIME package localClass @@ -163,4 +163,4 @@ fun box(): String { } return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/assert/jvm/localFunction.kt b/compiler/testData/codegen/box/assert/jvm/localFunction.kt index 79d0ee1850e..0c2c988a694 100644 --- a/compiler/testData/codegen/box/assert/jvm/localFunction.kt +++ b/compiler/testData/codegen/box/assert/jvm/localFunction.kt @@ -1,5 +1,5 @@ // TARGET_BACKEND: JVM -// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// ASSERTIONS_MODE: jvm // WITH_RUNTIME package localFunction @@ -123,4 +123,4 @@ fun box(): String { } return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/assert/jvm/localLambda.kt b/compiler/testData/codegen/box/assert/jvm/localLambda.kt index 8b84cdbd072..c14ede23d2b 100644 --- a/compiler/testData/codegen/box/assert/jvm/localLambda.kt +++ b/compiler/testData/codegen/box/assert/jvm/localLambda.kt @@ -1,5 +1,5 @@ // TARGET_BACKEND: JVM -// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// ASSERTIONS_MODE: jvm // WITH_RUNTIME package localLambda @@ -123,4 +123,4 @@ fun box(): String { } return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/assert/jvm/localObject.kt b/compiler/testData/codegen/box/assert/jvm/localObject.kt index 1d5a992e10f..6f68346bac5 100644 --- a/compiler/testData/codegen/box/assert/jvm/localObject.kt +++ b/compiler/testData/codegen/box/assert/jvm/localObject.kt @@ -1,5 +1,5 @@ // TARGET_BACKEND: JVM -// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// ASSERTIONS_MODE: jvm // WITH_RUNTIME package localObject @@ -155,4 +155,4 @@ fun box(): String { } return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/assert/jvm/noUnnecessaryClassInitialization.kt b/compiler/testData/codegen/box/assert/jvm/noUnnecessaryClassInitialization.kt index f7bc41fe918..9aaf1c597be 100644 --- a/compiler/testData/codegen/box/assert/jvm/noUnnecessaryClassInitialization.kt +++ b/compiler/testData/codegen/box/assert/jvm/noUnnecessaryClassInitialization.kt @@ -1,5 +1,5 @@ // TARGET_BACKEND: JVM -// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// ASSERTIONS_MODE: jvm // WITH_RUNTIME // Reusing the $assertionsDisabled field in the Outer class might seem like a good idea, diff --git a/compiler/testData/codegen/box/assert/jvm/nonLocalReturn.kt b/compiler/testData/codegen/box/assert/jvm/nonLocalReturn.kt index 518cba40697..ad447c15810 100644 --- a/compiler/testData/codegen/box/assert/jvm/nonLocalReturn.kt +++ b/compiler/testData/codegen/box/assert/jvm/nonLocalReturn.kt @@ -1,5 +1,5 @@ // TARGET_BACKEND: JVM -// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// ASSERTIONS_MODE: jvm // WITH_RUNTIME package nonLocalReturn @@ -74,4 +74,4 @@ fun box(): String { if (!c.checkFalseWithMessage()) return "FAIL 8" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/assert/jvm/ordinary.kt b/compiler/testData/codegen/box/assert/jvm/ordinary.kt index 198579a1e74..db101f34c3c 100644 --- a/compiler/testData/codegen/box/assert/jvm/ordinary.kt +++ b/compiler/testData/codegen/box/assert/jvm/ordinary.kt @@ -1,5 +1,5 @@ // TARGET_BACKEND: JVM -// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// ASSERTIONS_MODE: jvm // WITH_RUNTIME package ordinary @@ -99,4 +99,4 @@ fun box(): String { } return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/assert/jvm/superClassInitializer.kt b/compiler/testData/codegen/box/assert/jvm/superClassInitializer.kt index c15120c2db0..727d8ad9d39 100644 --- a/compiler/testData/codegen/box/assert/jvm/superClassInitializer.kt +++ b/compiler/testData/codegen/box/assert/jvm/superClassInitializer.kt @@ -1,5 +1,5 @@ // TARGET_BACKEND: JVM -// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// ASSERTIONS_MODE: jvm // WITH_RUNTIME package superClassInitializer @@ -117,4 +117,4 @@ fun box(): String { } return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionDisabled.kt b/compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionDisabled.kt index b9da206e874..1a8338e138a 100644 --- a/compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionDisabled.kt +++ b/compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionDisabled.kt @@ -1,5 +1,5 @@ // TARGET_BACKEND: JVM -// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// ASSERTIONS_MODE: jvm // WITH_RUNTIME // WITH_COROUTINES package suspendFunctionAssertionDisabled diff --git a/compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionsEnabled.kt b/compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionsEnabled.kt index a937c0c5bb8..9bc5ab593a7 100644 --- a/compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionsEnabled.kt +++ b/compiler/testData/codegen/box/assert/jvm/suspendFunctionAssertionsEnabled.kt @@ -1,5 +1,5 @@ // TARGET_BACKEND: JVM -// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// ASSERTIONS_MODE: jvm // WITH_RUNTIME // WITH_COROUTINES package suspendFunctionAssertionsEnabled diff --git a/compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsDisabled.kt b/compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsDisabled.kt index 098235714c0..e4d91741dd4 100644 --- a/compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsDisabled.kt +++ b/compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsDisabled.kt @@ -1,5 +1,5 @@ // TARGET_BACKEND: JVM -// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// ASSERTIONS_MODE: jvm // WITH_RUNTIME // WITH_COROUTINES package suspendLambdaAssertionsDisabled diff --git a/compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsEnabled.kt b/compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsEnabled.kt index e9f3ebc920f..3634ce86e73 100644 --- a/compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsEnabled.kt +++ b/compiler/testData/codegen/box/assert/jvm/suspendLambdaAssertionsEnabled.kt @@ -1,5 +1,5 @@ // TARGET_BACKEND: JVM -// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm +// ASSERTIONS_MODE: jvm // WITH_RUNTIME // WITH_COROUTINES package suspendLambdaAssertionsEnabled diff --git a/compiler/testData/codegen/box/constructorCall/inlineFunInConstructorCallWithDisabledNormalization.kt b/compiler/testData/codegen/box/constructorCall/inlineFunInConstructorCallWithDisabledNormalization.kt index 79020cc9986..3e1c4a08742 100644 --- a/compiler/testData/codegen/box/constructorCall/inlineFunInConstructorCallWithDisabledNormalization.kt +++ b/compiler/testData/codegen/box/constructorCall/inlineFunInConstructorCallWithDisabledNormalization.kt @@ -1,6 +1,6 @@ // TARGET_BACKEND: JVM // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: CONSTRUCTOR_CALL_NORMALIZATION_MODE=disable +// CONSTRUCTOR_CALL_NORMALIZATION_MODE: disable // FILE: test.kt fun box(): String { Foo( diff --git a/compiler/testData/codegen/box/constructorCall/inlineFunInConstructorCallWithEnabledNormalization.kt b/compiler/testData/codegen/box/constructorCall/inlineFunInConstructorCallWithEnabledNormalization.kt index 64c7310ef57..8d5bea4a29e 100644 --- a/compiler/testData/codegen/box/constructorCall/inlineFunInConstructorCallWithEnabledNormalization.kt +++ b/compiler/testData/codegen/box/constructorCall/inlineFunInConstructorCallWithEnabledNormalization.kt @@ -1,6 +1,6 @@ // TARGET_BACKEND: JVM // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: CONSTRUCTOR_CALL_NORMALIZATION_MODE=enable +// CONSTRUCTOR_CALL_NORMALIZATION_MODE: enable // FILE: test.kt fun box(): String { Foo( diff --git a/compiler/testData/codegen/box/constructorCall/inlineFunInConstructorCallWithStrictNormalization.kt b/compiler/testData/codegen/box/constructorCall/inlineFunInConstructorCallWithStrictNormalization.kt index 65ef307f5b8..174d155b028 100644 --- a/compiler/testData/codegen/box/constructorCall/inlineFunInConstructorCallWithStrictNormalization.kt +++ b/compiler/testData/codegen/box/constructorCall/inlineFunInConstructorCallWithStrictNormalization.kt @@ -1,6 +1,6 @@ // TARGET_BACKEND: JVM // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: CONSTRUCTOR_CALL_NORMALIZATION_MODE=preserve-class-initialization +// CONSTRUCTOR_CALL_NORMALIZATION_MODE: preserve-class-initialization // FILE: test.kt fun box(): String { Foo( diff --git a/compiler/testData/codegen/box/constructorCall/loopInInlineFunInSuperConstructorCallWithEnabledNormalization.kt b/compiler/testData/codegen/box/constructorCall/loopInInlineFunInSuperConstructorCallWithEnabledNormalization.kt index fc914fa55c6..945640a76c6 100644 --- a/compiler/testData/codegen/box/constructorCall/loopInInlineFunInSuperConstructorCallWithEnabledNormalization.kt +++ b/compiler/testData/codegen/box/constructorCall/loopInInlineFunInSuperConstructorCallWithEnabledNormalization.kt @@ -1,6 +1,6 @@ // TARGET_BACKEND: JVM // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: CONSTRUCTOR_CALL_NORMALIZATION_MODE=enable +// CONSTRUCTOR_CALL_NORMALIZATION_MODE: enable open class A(val s: String) inline fun test(crossinline z: () -> String): String { @@ -11,4 +11,4 @@ inline fun test(crossinline z: () -> String): String { fun box(): String { return test { "OK" } -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/constructorCall/loopInInlineFunWithEnabledNormalization.kt b/compiler/testData/codegen/box/constructorCall/loopInInlineFunWithEnabledNormalization.kt index 1edbb009b57..2d5eb0145d5 100644 --- a/compiler/testData/codegen/box/constructorCall/loopInInlineFunWithEnabledNormalization.kt +++ b/compiler/testData/codegen/box/constructorCall/loopInInlineFunWithEnabledNormalization.kt @@ -1,6 +1,6 @@ // TARGET_BACKEND: JVM // WITH_RUNTIME -// KOTLIN_CONFIGURATION_FLAGS: CONSTRUCTOR_CALL_NORMALIZATION_MODE=enable +// CONSTRUCTOR_CALL_NORMALIZATION_MODE: enable // FILE: test.kt fun box(): String { Foo( diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/JvmEnvironmentConfigurationDirectives.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/JvmEnvironmentConfigurationDirectives.kt index c0b623f48dc..23b8513d982 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/JvmEnvironmentConfigurationDirectives.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/JvmEnvironmentConfigurationDirectives.kt @@ -5,11 +5,15 @@ package org.jetbrains.kotlin.test.directives +import org.jetbrains.kotlin.config.JVMAssertionsMode +import org.jetbrains.kotlin.config.JVMConstructorCallNormalizationMode +import org.jetbrains.kotlin.config.JvmStringConcat import org.jetbrains.kotlin.config.JvmTarget import org.jetbrains.kotlin.test.TestJdkKind import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer object JvmEnvironmentConfigurationDirectives : SimpleDirectivesContainer() { + @Suppress("RemoveExplicitTypeArguments") val JVM_TARGET by enumDirective( description = "Target bytecode version", additionalParser = JvmTarget.Companion::fromString @@ -34,4 +38,22 @@ object JvmEnvironmentConfigurationDirectives : SimpleDirectivesContainer() { val USE_PSI_CLASS_FILES_READING by directive("Use a slower (PSI-based) class files reading implementation") val USE_JAVAC by directive("Enable javac integration") val SKIP_JAVA_SOURCES by directive("Don't add java sources to compile classpath") + + @Suppress("RemoveExplicitTypeArguments") + val STRING_CONCAT by enumDirective( + description = "Configure mode of string concatenation", + additionalParser = JvmStringConcat.Companion::fromString + ) + + @Suppress("RemoveExplicitTypeArguments") + val ASSERTIONS_MODE by enumDirective( + description = "Configure jvm assertions mode", + additionalParser = JVMAssertionsMode.Companion::fromString + ) + + @Suppress("RemoveExplicitTypeArguments") + val CONSTRUCTOR_CALL_NORMALIZATION_MODE by enumDirective( + description = "Configure jvm constructor call normalization mode", + additionalParser = JVMConstructorCallNormalizationMode.Companion::fromStringOrNull + ) } diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/configuration/JvmEnvironmentConfigurator.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/configuration/JvmEnvironmentConfigurator.kt index 3f4e35fec44..675f133871a 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/configuration/JvmEnvironmentConfigurator.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/configuration/JvmEnvironmentConfigurator.kt @@ -19,6 +19,9 @@ import org.jetbrains.kotlin.platform.jvm.JvmPlatforms import org.jetbrains.kotlin.test.ConfigurationKind import org.jetbrains.kotlin.test.TestJdkKind import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives +import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.ASSERTIONS_MODE +import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.CONSTRUCTOR_CALL_NORMALIZATION_MODE +import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.STRING_CONCAT import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives import org.jetbrains.kotlin.test.directives.model.DirectivesContainer import org.jetbrains.kotlin.test.directives.model.RegisteredDirectives @@ -26,6 +29,7 @@ import org.jetbrains.kotlin.test.model.DependencyDescription import org.jetbrains.kotlin.test.model.DependencyKind import org.jetbrains.kotlin.test.model.TestModule import org.jetbrains.kotlin.test.services.* +import org.jetbrains.kotlin.test.services.DirectiveToConfigurationKeyExtractor import org.jetbrains.kotlin.test.services.jvm.CompiledClassesManager import org.jetbrains.kotlin.test.services.jvm.compiledClassesManager import org.jetbrains.kotlin.test.util.KtTestUtil @@ -44,6 +48,12 @@ class JvmEnvironmentConfigurator(testServices: TestServices) : EnvironmentConfig override val additionalServices: List get() = listOf(service(::CompiledClassesManager)) + override fun DirectiveToConfigurationKeyExtractor.provideConfigurationKeys() { + register(STRING_CONCAT, JVMConfigurationKeys.STRING_CONCAT) + register(ASSERTIONS_MODE, JVMConfigurationKeys.ASSERTIONS_MODE) + register(CONSTRUCTOR_CALL_NORMALIZATION_MODE, JVMConfigurationKeys.CONSTRUCTOR_CALL_NORMALIZATION_MODE) + } + override fun configureCompilerConfiguration(configuration: CompilerConfiguration, module: TestModule, project: MockProject) { if (module.targetPlatform !in JvmPlatforms.allJvmPlatforms) return val registeredDirectives = module.directives