diff --git a/idea/testData/quickfix/override/typeMismatchOnOverride/beforeCantChangeMultipleOverriddenPropertiesTypes.kt b/idea/testData/quickfix/override/typeMismatchOnOverride/beforeCantChangeMultipleOverriddenPropertiesTypes.kt index 5838c8b8a7e..fa5b3205a7f 100644 --- a/idea/testData/quickfix/override/typeMismatchOnOverride/beforeCantChangeMultipleOverriddenPropertiesTypes.kt +++ b/idea/testData/quickfix/override/typeMismatchOnOverride/beforeCantChangeMultipleOverriddenPropertiesTypes.kt @@ -1,5 +1,7 @@ // "Change 'A.x' type to '(Int) -> Int'" "false" // ACTION: Change 'C.x' type to '(String) -> Int' +// ACTION: Disable inspection +// ACTION: Edit inspection profile setting // ERROR: Return type is '(kotlin.Int) → kotlin.Int', which is not a subtype of overridden
internal abstract val x: (kotlin.String) → kotlin.Int defined in A trait A { val x: (String) -> Int diff --git a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInAnnotationArgument.kt b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInAnnotationArgument.kt index afa779f2161..a0732e4539e 100644 --- a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInAnnotationArgument.kt +++ b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInAnnotationArgument.kt @@ -1,4 +1,5 @@ // "class com.intellij.codeInspection.SuppressIntentionAction" "false" +// ACTION: Suppress 'INTEGER_OVERFLOW' for fun foo [Ann(Integer.MAX_VALUE + 1)] fun foo() {} diff --git a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInClassHeader.kt b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInClassHeader.kt index bd76490b6da..af60e795e7b 100644 --- a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInClassHeader.kt +++ b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInClassHeader.kt @@ -1,4 +1,5 @@ // "class com.intellij.codeInspection.SuppressIntentionAction" "false" +// ACTION: Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for class Child open class Base(s: String) class Child: Base(""!!) \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInDefaultArgument.kt b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInDefaultArgument.kt index a0dfaf56c6b..aa47dc38422 100644 --- a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInDefaultArgument.kt +++ b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInDefaultArgument.kt @@ -1,3 +1,5 @@ // "class com.intellij.codeInspection.SuppressIntentionAction" "false" +// ACTION: Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for fun foo +// ACTION: Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for parameter s fun foo(s: String = ""!!) {} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInExpressionBody.kt b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInExpressionBody.kt index 215db232400..cec96edb67a 100644 --- a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInExpressionBody.kt +++ b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInExpressionBody.kt @@ -1,3 +1,4 @@ // "class com.intellij.codeInspection.SuppressIntentionAction" "false" +// ACTION: Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for fun foo fun foo() = ""!! \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInLocalValInitializer.kt b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInLocalValInitializer.kt index ce1d8d1c68a..429e511bfe3 100644 --- a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInLocalValInitializer.kt +++ b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInLocalValInitializer.kt @@ -1,4 +1,6 @@ // "class com.intellij.codeInspection.SuppressIntentionAction" "false" +// ACTION: Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for fun foo +// ACTION: Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for val bar fun foo() { val bar = ""!! diff --git a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInParameterType.kt b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInParameterType.kt index 3cbb707f1cd..8f07f10d11c 100644 --- a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInParameterType.kt +++ b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInParameterType.kt @@ -1,3 +1,5 @@ // "class com.intellij.codeInspection.SuppressIntentionAction" "false" +// ACTION: Suppress 'REDUNDANT_NULLABLE' for fun foo +// ACTION: Suppress 'REDUNDANT_NULLABLE' for parameter s fun foo(s: String??) {} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInParameterTypeInFunctionLiteral.kt b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInParameterTypeInFunctionLiteral.kt index 6f1fa648b13..371d30b331c 100644 --- a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInParameterTypeInFunctionLiteral.kt +++ b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInParameterTypeInFunctionLiteral.kt @@ -1,4 +1,6 @@ // "class com.intellij.codeInspection.SuppressIntentionAction" "false" +// ACTION: Suppress 'REDUNDANT_NULLABLE' for fun foo +// ACTION: Suppress 'REDUNDANT_NULLABLE' for parameter x fun foo() { any { diff --git a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInPropertyInitializer.kt b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInPropertyInitializer.kt index 78fcd8b9c3e..65b7cfec0e2 100644 --- a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInPropertyInitializer.kt +++ b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInPropertyInitializer.kt @@ -1,3 +1,4 @@ // "class com.intellij.codeInspection.SuppressIntentionAction" "false" +// ACTION: Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for val foo val foo = ""!! \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeObjectLiteral.kt b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeObjectLiteral.kt index 1340b0755cc..4eb656f4f3f 100644 --- a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeObjectLiteral.kt +++ b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeObjectLiteral.kt @@ -1,4 +1,5 @@ // "class com.intellij.codeInspection.SuppressIntentionAction" "false" +// ACTION: Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for fun foo fun foo() { object : Base(""!!) { diff --git a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeObjectLiteralInsideExpression.kt b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeObjectLiteralInsideExpression.kt index 0fb466191a8..cc8eeafc8d5 100644 --- a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeObjectLiteralInsideExpression.kt +++ b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeObjectLiteralInsideExpression.kt @@ -1,4 +1,6 @@ // "class com.intellij.codeInspection.SuppressIntentionAction" "false" +// ACTION: Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for fun foo +// ACTION: Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for val a fun foo() { val a = object : Base(""!!) { diff --git a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeSupretype.kt b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeSupretype.kt index 0116565a033..aee9200f3a5 100644 --- a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeSupretype.kt +++ b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeSupretype.kt @@ -1,4 +1,5 @@ // "class com.intellij.codeInspection.SuppressIntentionAction" "false" +// ACTION: Suppress 'REDUNDANT_NULLABLE' for class Child open class Base class Child: Base?>() \ No newline at end of file diff --git a/idea/testData/quickfix/typeAddition/beforePublicFunWithoutBody.kt b/idea/testData/quickfix/typeAddition/beforePublicFunWithoutBody.kt index 9b010edfc97..a6fad96da1b 100644 --- a/idea/testData/quickfix/typeAddition/beforePublicFunWithoutBody.kt +++ b/idea/testData/quickfix/typeAddition/beforePublicFunWithoutBody.kt @@ -4,6 +4,10 @@ // ACTION: Make 'foo' abstract // ACTION: Convert to extension // ACTION: Disable 'Convert to extension' +// ACTION: Disable inspection +// ACTION: Disable inspection +// ACTION: Edit inspection profile setting +// ACTION: Edit inspection profile setting // ACTION: Edit intention settings package a diff --git a/idea/testData/quickfix/typeMismatch/beforeDontChangeOverriddenPropertyTypeToErrorType.kt b/idea/testData/quickfix/typeMismatch/beforeDontChangeOverriddenPropertyTypeToErrorType.kt index d223f7dfd06..5dbeb8ae299 100644 --- a/idea/testData/quickfix/typeMismatch/beforeDontChangeOverriddenPropertyTypeToErrorType.kt +++ b/idea/testData/quickfix/typeMismatch/beforeDontChangeOverriddenPropertyTypeToErrorType.kt @@ -1,5 +1,7 @@ // "Change 'B.x' type to '(String) -> [ERROR : Ay]'" "false" // ACTION: Change 'A.x' type to '(Int) -> Int' +// ACTION: Disable inspection +// ACTION: Edit inspection profile setting // ERROR: Return type is '(kotlin.Int) → kotlin.Int', which is not a subtype of overridden
internal abstract val x: (kotlin.String) → [ERROR : Ay] defined in A // ERROR: Unresolved reference: Ay trait A { diff --git a/idea/tests/org/jetbrains/jet/plugin/quickfix/AbstractQuickFixTest.java b/idea/tests/org/jetbrains/jet/plugin/quickfix/AbstractQuickFixTest.java index 233efcde50a..5037dbabe0f 100644 --- a/idea/tests/org/jetbrains/jet/plugin/quickfix/AbstractQuickFixTest.java +++ b/idea/tests/org/jetbrains/jet/plugin/quickfix/AbstractQuickFixTest.java @@ -31,12 +31,15 @@ import com.intellij.psi.PsiElement; import junit.framework.Assert; import org.apache.commons.lang.SystemUtils; import org.jetbrains.annotations.NotNull; +import org.jetbrains.jet.InTextDirectivesUtils; import org.jetbrains.jet.lang.psi.JetFile; import org.jetbrains.jet.plugin.PluginTestCaseBase; import org.jetbrains.jet.test.TestMetadata; import org.jetbrains.jet.testing.ConfigLibraryUtil; +import java.util.HashSet; import java.util.List; +import java.util.Set; public abstract class AbstractQuickFixTest extends LightQuickFixTestCase { @Override @@ -65,7 +68,8 @@ public abstract class AbstractQuickFixTest extends LightQuickFixTestCase { } private void checkForUnexpectedActions() throws ClassNotFoundException { - Pair pair = parseActionHintImpl(getFile(), getEditor().getDocument().getText()); + String text = getEditor().getDocument().getText(); + Pair pair = parseActionHintImpl(getFile(), text); if (!pair.second) { List actions = getAvailableActions(); @@ -74,8 +78,11 @@ public abstract class AbstractQuickFixTest extends LightQuickFixTestCase { String className = pair.first.substring(prefix.length()); Class aClass = Class.forName(className); assert IntentionAction.class.isAssignableFrom(aClass) : className + " should be inheritor of IntentionAction"; + + Set validActions = new HashSet(InTextDirectivesUtils.findLinesWithPrefixesRemoved(text, "// ACTION:")); + for (IntentionAction action : actions) { - if (aClass.isAssignableFrom(action.getClass())) { + if (aClass.isAssignableFrom(action.getClass()) && !validActions.contains(action.getText())) { Assert.fail("Unexpected intention action " + action.getClass() + " found"); } }