From 440b6d993404e7a1d7dfbd07f789b8ace7ef99e8 Mon Sep 17 00:00:00 2001 From: Dmitry Savvinov Date: Wed, 15 Nov 2017 20:54:26 +0300 Subject: [PATCH] Add -Xeffect-system CLI argument which enables Effect System --- .../kotlin/cli/common/arguments/CommonCompilerArguments.kt | 6 ++++++ .../src/org/jetbrains/kotlin/cli/common/CLICompiler.java | 6 ++++++ compiler/testData/cli/js/jsExtraHelp.out | 1 + compiler/testData/cli/jvm/extraHelp.out | 1 + 4 files changed, 14 insertions(+) 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 3ed7b91eefb..bddb377f0c6 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 @@ -118,6 +118,12 @@ abstract class CommonCompilerArguments : CommonToolArguments() { ) var legacySmartCastAfterTry by FreezableVar(false) + @Argument( + value = "-Xeffect-system", + description = "Enable experimental language feature: effect system" + ) + var effectSystem: Boolean by FreezableVar(false) + open fun configureAnalysisFlags(collector: MessageCollector): MutableMap, Any> { return HashMap, Any>().apply { put(AnalysisFlag.skipMetadataVersionCheck, skipMetadataVersionCheck) diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLICompiler.java b/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLICompiler.java index 852cc901011..e9839af7cb3 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLICompiler.java +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLICompiler.java @@ -212,6 +212,12 @@ public abstract class CLICompiler extends CLI extraLanguageFeatures.put(LanguageFeature.SoundSmartCastsAfterTry, LanguageFeature.State.DISABLED); } + if (arguments.getEffectSystem()) { + extraLanguageFeatures.put(LanguageFeature.CallsInPlaceEffect, LanguageFeature.State.ENABLED); + extraLanguageFeatures.put(LanguageFeature.ReturnsEffect, LanguageFeature.State.ENABLED); + } + + setupPlatformSpecificLanguageFeatureSettings(extraLanguageFeatures, arguments); CommonConfigurationKeysKt.setLanguageVersionSettings(configuration, new LanguageVersionSettingsImpl( diff --git a/compiler/testData/cli/js/jsExtraHelp.out b/compiler/testData/cli/js/jsExtraHelp.out index 8a4a9dd08c5..c61004ec91f 100644 --- a/compiler/testData/cli/js/jsExtraHelp.out +++ b/compiler/testData/cli/js/jsExtraHelp.out @@ -6,6 +6,7 @@ where advanced options include: -Xallow-kotlin-package Allow compiling code in package 'kotlin' and allow not requiring kotlin.stdlib in module-info -Xcoroutines={enable|warn|error} Enable coroutines or report warnings or errors on declarations and use sites of 'suspend' modifier + -Xeffect-system Enable experimental language feature: effect system -Xintellij-plugin-root= Path to the kotlin-compiler.jar or directory where IntelliJ configuration files can be found -Xlegacy-smart-cast-after-try Allow var smart casts despite assignment in try block -Xmulti-platform Enable experimental language support for multi-platform projects diff --git a/compiler/testData/cli/jvm/extraHelp.out b/compiler/testData/cli/jvm/extraHelp.out index 897fc17b10a..87d13fac3c2 100644 --- a/compiler/testData/cli/jvm/extraHelp.out +++ b/compiler/testData/cli/jvm/extraHelp.out @@ -33,6 +33,7 @@ where advanced options include: -Xallow-kotlin-package Allow compiling code in package 'kotlin' and allow not requiring kotlin.stdlib in module-info -Xcoroutines={enable|warn|error} Enable coroutines or report warnings or errors on declarations and use sites of 'suspend' modifier + -Xeffect-system Enable experimental language feature: effect system -Xintellij-plugin-root= Path to the kotlin-compiler.jar or directory where IntelliJ configuration files can be found -Xlegacy-smart-cast-after-try Allow var smart casts despite assignment in try block -Xmulti-platform Enable experimental language support for multi-platform projects