Do not suggest -Xuse...=kotlin.Experimental in experimental world

This commit is contained in:
Mikhail Glukhikh
2018-05-23 18:48:52 +03:00
parent f2989ee3a6
commit d7bb8a7a21
3 changed files with 21 additions and 1 deletions
@@ -47,7 +47,13 @@ class MakeModuleExperimentalFix(
val facet = KotlinFacet.get(module) ?: return true
val facetSettings = facet.configuration.settings
val compilerSettings = facetSettings.compilerSettings ?: return true
return compilerArgument !in compilerSettings.additionalArgumentsAsList
return if (annotationFqName != ExperimentalUsageChecker.EXPERIMENTAL_FQ_NAME) {
compilerArgument !in compilerSettings.additionalArgumentsAsList
} else {
compilerSettings.additionalArgumentsAsList.none {
it.startsWith("-Xuse-experimental=") || it.startsWith("-Xexperimental=")
}
}
}
companion object : KotlinSingleIntentionActionFactory() {
+9
View File
@@ -0,0 +1,9 @@
// "Add '-Xuse-experimental=kotlin.Experimental' to module light_idea_test_case compiler arguments" "false"
// COMPILER_ARGUMENTS: -version -Xuse-experimental=Something
// DISABLE-ERRORS
// WITH_RUNTIME
// ACTION: Make internal
// ACTION: Make private
@Experimental<caret>
annotation class MyExperimentalAPI
@@ -6062,6 +6062,11 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
runTest("idea/testData/quickfix/experimental/classUseExperimental.kt");
}
@TestMetadata("doNotSwitchOn.kt")
public void testDoNotSwitchOn() throws Exception {
runTest("idea/testData/quickfix/experimental/doNotSwitchOn.kt");
}
@TestMetadata("functionInLocalClass.kt")
public void testFunctionInLocalClass() throws Exception {
runTest("idea/testData/quickfix/experimental/functionInLocalClass.kt");