From e25b3153199f6dc17c26693af8059d92cf41c090 Mon Sep 17 00:00:00 2001 From: Victor Petukhov Date: Fri, 26 Jul 2019 08:57:35 +0300 Subject: [PATCH] Introduce `-Xpolymorphic-signature` compiler flag as more priority than `-XXLanguage:+PolymorphicSignature` --- .../cli/common/arguments/CommonCompilerArguments.kt | 10 ++++++++++ compiler/testData/cli/js/jsExtraHelp.out | 1 + compiler/testData/cli/jvm/extraHelp.out | 1 + 3 files changed, 12 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 bc9e4b8e318..85e21b51dda 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 @@ -134,6 +134,12 @@ abstract class CommonCompilerArguments : CommonToolArguments() { ) var inlineClasses: Boolean by FreezableVar(false) + @Argument( + value = "-Xpolymorphic-signature", + description = "Enable experimental support for @PolymorphicSignature (MethodHandle/VarHandle)" + ) + var polymorphicSignature: Boolean by FreezableVar(false) + @Argument( value = "-Xlegacy-smart-cast-after-try", description = "Allow var smart casts despite assignment in try block" @@ -336,6 +342,10 @@ abstract class CommonCompilerArguments : CommonToolArguments() { put(LanguageFeature.InlineClasses, LanguageFeature.State.ENABLED) } + if (polymorphicSignature) { + put(LanguageFeature.PolymorphicSignature, LanguageFeature.State.ENABLED) + } + if (legacySmartCastAfterTry) { put(LanguageFeature.SoundSmartCastsAfterTry, LanguageFeature.State.DISABLED) } diff --git a/compiler/testData/cli/js/jsExtraHelp.out b/compiler/testData/cli/js/jsExtraHelp.out index b82f930fc96..42708db2f83 100644 --- a/compiler/testData/cli/js/jsExtraHelp.out +++ b/compiler/testData/cli/js/jsExtraHelp.out @@ -39,6 +39,7 @@ where advanced options include: -Xphases-to-validate-after Validate backend state after these phases -Xphases-to-validate-before Validate backend state before these phases -Xplugin= Load plugins from the given classpath + -Xpolymorphic-signature Enable experimental support for @PolymorphicSignature (MethodHandle/VarHandle) -Xprofile-phases Profile backend phases -Xproper-ieee754-comparisons Generate proper IEEE 754 comparisons in all cases if values are statically known to be of primitive numeric types -Xread-deserialized-contracts Enable reading of contracts from metadata diff --git a/compiler/testData/cli/jvm/extraHelp.out b/compiler/testData/cli/jvm/extraHelp.out index 9c16d78818c..442682b2ea5 100644 --- a/compiler/testData/cli/jvm/extraHelp.out +++ b/compiler/testData/cli/jvm/extraHelp.out @@ -101,6 +101,7 @@ where advanced options include: -Xphases-to-validate-after Validate backend state after these phases -Xphases-to-validate-before Validate backend state before these phases -Xplugin= Load plugins from the given classpath + -Xpolymorphic-signature Enable experimental support for @PolymorphicSignature (MethodHandle/VarHandle) -Xprofile-phases Profile backend phases -Xproper-ieee754-comparisons Generate proper IEEE 754 comparisons in all cases if values are statically known to be of primitive numeric types -Xread-deserialized-contracts Enable reading of contracts from metadata