Add support of internal arguments for language feature settings

Arguments are passed in form '-XXLanguage:+LanguageFeatureName' for enabling
LanguageFeature.LanguageFeatureName, and '-XXLanguage:-LanguageFeatureName'
for disabling.

Note that they do override other settings, including 'language-version'
or extra ('-X') args.
This commit is contained in:
Dmitry Savvinov
2018-03-27 13:41:03 +03:00
parent ae119a09eb
commit c33b7377da
24 changed files with 346 additions and 23 deletions
+1
View File
@@ -0,0 +1 @@
inline class Foo(val x: Int)
@@ -0,0 +1,6 @@
-language-version
1.3
-XXLanguage\:-InlineClasses
$TESTDATA_DIR$/inlineClass.kt
-d
$TEMP_DIR$
@@ -0,0 +1,14 @@
warning: ATTENTION!
This build uses internal compiler arguments:
-XXLanguage:-InlineClasses
This mode is strictly prohibited for production use,
as no stability/compatibility guarantees are given on
compiler or generated code. Use it at your own risk!
warning: language version 1.3 is experimental, there are no backwards compatibility guarantees for new language and library features
compiler/testData/cli/jvm/inlineClass.kt:1:1: error: the feature "inline classes" is experimental and should be enabled explicitly
inline class Foo(val x: Int)
^
COMPILATION_ERROR
@@ -0,0 +1,4 @@
$TESTDATA_DIR$/inlineClass.kt
-d
$TEMP_DIR$
-XXLanguage\:+
@@ -0,0 +1,14 @@
warning: ATTENTION!
This build uses internal compiler arguments:
-XXLanguage:+
This mode is strictly prohibited for production use,
as no stability/compatibility guarantees are given on
compiler or generated code. Use it at your own risk!
warning: empty language feature name for internal argument '-XXLanguage:+'
compiler/testData/cli/jvm/inlineClass.kt:1:1: error: the feature "inline classes" is experimental and should be enabled explicitly
inline class Foo(val x: Int)
^
COMPILATION_ERROR
@@ -0,0 +1,6 @@
$TESTDATA_DIR$/inlineClass.kt
-d
$TEMP_DIR$
-language-version
1.2
-XXLanguage\:+InlineClasses
@@ -0,0 +1,11 @@
warning: ATTENTION!
This build uses internal compiler arguments:
-XXLanguage:+InlineClasses
This mode is strictly prohibited for production use,
as no stability/compatibility guarantees are given on
compiler or generated code. Use it at your own risk!
warning: following manually enabled features will force generation of pre-release binaries: InlineClasses
OK
@@ -0,0 +1,4 @@
$TESTDATA_DIR$/inlineClass.kt
-d
$TEMP_DIR$
-XXLanguage\:InlineClasses
@@ -0,0 +1,14 @@
warning: ATTENTION!
This build uses internal compiler arguments:
-XXLanguage:InlineClasses
This mode is strictly prohibited for production use,
as no stability/compatibility guarantees are given on
compiler or generated code. Use it at your own risk!
warning: incorrect internal argument syntax, missing modificator: -XXLanguage:InlineClasses
compiler/testData/cli/jvm/inlineClass.kt:1:1: error: the feature "inline classes" is experimental and should be enabled explicitly
inline class Foo(val x: Int)
^
COMPILATION_ERROR
@@ -0,0 +1,4 @@
$TESTDATA_DIR$/inlineClass.kt
-d
$TEMP_DIR$
-XXLanguage\:+UnknownFeature
@@ -0,0 +1,14 @@
warning: ATTENTION!
This build uses internal compiler arguments:
-XXLanguage:+UnknownFeature
This mode is strictly prohibited for production use,
as no stability/compatibility guarantees are given on
compiler or generated code. Use it at your own risk!
warning: unknown language feature 'UnknownFeature' in passed internal argument '-XXLanguage:+UnknownFeature'
compiler/testData/cli/jvm/inlineClass.kt:1:1: error: the feature "inline classes" is experimental and should be enabled explicitly
inline class Foo(val x: Int)
^
COMPILATION_ERROR
+4
View File
@@ -0,0 +1,4 @@
$TESTDATA_DIR$/inlineClass.kt
-d
$TEMP_DIR$
-XX:+InlineClasses
+5
View File
@@ -0,0 +1,5 @@
warning: flag is not supported by this version of the compiler: -XX:+InlineClasses
compiler/testData/cli/jvm/inlineClass.kt:1:1: error: the feature "inline classes" is experimental and should be enabled explicitly
inline class Foo(val x: Int)
^
COMPILATION_ERROR
@@ -0,0 +1,5 @@
$TESTDATA_DIR$/legacySmartCastsAfterTry.kt
-d
$TEMP_DIR$
-XXLanguage\:+SoundSmartCastsAfterTry
-Xlegacy-smart-cast-after-try
@@ -0,0 +1,13 @@
warning: ATTENTION!
This build uses internal compiler arguments:
-XXLanguage:+SoundSmartCastsAfterTry
This mode is strictly prohibited for production use,
as no stability/compatibility guarantees are given on
compiler or generated code. Use it at your own risk!
compiler/testData/cli/jvm/legacySmartCastsAfterTry.kt:8:9: error: only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type String?
some.length
^
COMPILATION_ERROR