CLI: fix confusing error message about JvmDefault

#KT-58351 Fixed
This commit is contained in:
Alexander Udalov
2023-05-01 16:19:00 +02:00
committed by Space Team
parent 8106505166
commit b72b1ad7cd
4 changed files with 16 additions and 1 deletions
@@ -866,7 +866,11 @@ Also sets `-jvm-target` value equal to the selected JDK version"""
result[JvmAnalysisFlags.jvmDefaultMode] = it
} ?: collector.report(
CompilerMessageSeverity.ERROR,
"Unknown -Xjvm-default mode: $jvmDefault, supported modes: ${JvmDefaultMode.values().map { it.description }}"
"Unknown -Xjvm-default mode: $jvmDefault, supported modes: ${
JvmDefaultMode.values().mapNotNull { mode ->
mode.description.takeIf { JvmDefaultMode.fromStringOrNull(it) != null }
}
}"
)
result[JvmAnalysisFlags.inheritMultifileParts] = inheritMultifileParts
result[JvmAnalysisFlags.sanitizeParentheses] = sanitizeParentheses
@@ -0,0 +1,4 @@
$TESTDATA_DIR$/simple.kt
-d
$TEMP_DIR$
-Xjvm-default=enable
@@ -0,0 +1,2 @@
error: unknown -Xjvm-default mode: enable, supported modes: [disable, all-compatibility, all]
COMPILATION_ERROR
@@ -840,6 +840,11 @@ public class CliTestGenerated extends AbstractCliTest {
runTest("compiler/testData/cli/jvm/jvmDefaultAll.args");
}
@TestMetadata("jvmDefaultIncorrectValue.args")
public void testJvmDefaultIncorrectValue() throws Exception {
runTest("compiler/testData/cli/jvm/jvmDefaultIncorrectValue.args");
}
@TestMetadata("jvmIrByDefault1_4.args")
public void testJvmIrByDefault1_4() throws Exception {
runTest("compiler/testData/cli/jvm/jvmIrByDefault1_4.args");