Improved parsing of internal compiler arguments with boolean state in
case when the argument is listed twice in the list of command line arguments. The last value will be used. #KT-27181 Fixed
This commit is contained in:
+9
-1
@@ -135,7 +135,15 @@ private fun <A : CommonToolArguments> parsePreprocessedCommandLineArguments(args
|
|||||||
if (parser == null) {
|
if (parser == null) {
|
||||||
errors.unknownExtraFlags += arg
|
errors.unknownExtraFlags += arg
|
||||||
} else {
|
} else {
|
||||||
internalArguments.add(parser.parseInternalArgument(arg, errors) ?: continue)
|
val newInternalArgument = parser.parseInternalArgument(arg, errors) ?: continue
|
||||||
|
val argumentWillBeOverridden = when (newInternalArgument) {
|
||||||
|
is ManualLanguageFeatureSetting -> internalArguments.firstOrNull { (it is ManualLanguageFeatureSetting) && (it.languageFeature == newInternalArgument.languageFeature) }
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
if (argumentWillBeOverridden != null) {
|
||||||
|
internalArguments.remove(argumentWillBeOverridden)
|
||||||
|
}
|
||||||
|
internalArguments.add(newInternalArgument)
|
||||||
}
|
}
|
||||||
|
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
$TESTDATA_DIR$/inlineClass.kt
|
||||||
|
-d
|
||||||
|
$TEMP_DIR$
|
||||||
|
-XXLanguage:-InlineClasses
|
||||||
|
-XXLanguage:+InlineClasses
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
warning: ATTENTION!
|
||||||
|
This build uses unsafe internal compiler arguments:
|
||||||
|
|
||||||
|
-XXLanguage;+InlineClasses
|
||||||
|
|
||||||
|
This mode is not recommended for production use,
|
||||||
|
as no stability/compatibility guarantees are given on
|
||||||
|
compiler or generated code. Use it at your own risk!
|
||||||
|
|
||||||
|
OK
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
$TESTDATA_DIR$/inlineClass.kt
|
||||||
|
-d
|
||||||
|
$TEMP_DIR$
|
||||||
|
-XXLanguage:+InlineClasses
|
||||||
|
-XXLanguage:-InlineClasses
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
warning: ATTENTION!
|
||||||
|
This build uses unsafe internal compiler arguments:
|
||||||
|
|
||||||
|
-XXLanguage;-InlineClasses
|
||||||
|
|
||||||
|
This mode is not recommended 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/inlineClass.kt:1:1: error: the feature "inline classes" is disabled
|
||||||
|
inline class Foo(val x: Int)
|
||||||
|
^
|
||||||
|
COMPILATION_ERROR
|
||||||
@@ -296,6 +296,16 @@ public class CliTestGenerated extends AbstractCliTest {
|
|||||||
runTest("compiler/testData/cli/jvm/internalArgNoWarningForEnablingBugfix.args");
|
runTest("compiler/testData/cli/jvm/internalArgNoWarningForEnablingBugfix.args");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("internalArgOverrideLanguageFeature.args")
|
||||||
|
public void testInternalArgOverrideLanguageFeature() throws Exception {
|
||||||
|
runTest("compiler/testData/cli/jvm/internalArgOverrideLanguageFeature.args");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("internalArgOverrideOffLanguageFeature.args")
|
||||||
|
public void testInternalArgOverrideOffLanguageFeature() throws Exception {
|
||||||
|
runTest("compiler/testData/cli/jvm/internalArgOverrideOffLanguageFeature.args");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("internalArgUnrecognizedFeature.args")
|
@TestMetadata("internalArgUnrecognizedFeature.args")
|
||||||
public void testInternalArgUnrecognizedFeature() throws Exception {
|
public void testInternalArgUnrecognizedFeature() throws Exception {
|
||||||
runTest("compiler/testData/cli/jvm/internalArgUnrecognizedFeature.args");
|
runTest("compiler/testData/cli/jvm/internalArgUnrecognizedFeature.args");
|
||||||
|
|||||||
Reference in New Issue
Block a user