diff --git a/idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/DirectiveBasedActionUtils.kt b/idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/DirectiveBasedActionUtils.kt index fca6b8c4d84..3ff687d0bcc 100644 --- a/idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/DirectiveBasedActionUtils.kt +++ b/idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/DirectiveBasedActionUtils.kt @@ -45,19 +45,24 @@ public object DirectiveBasedActionUtils { public fun checkAvailableActionsAreExpected(file: JetFile, availableActions: Collection) { val expectedActions = InTextDirectivesUtils.findLinesWithPrefixesRemoved(file.getText(), "// ACTION:").sort() + UsefulTestCase.assertEmpty("Irrelevant actions should not be specified in ACTION directive for they are not checked anyway", + expectedActions.filter { isIrrelevantAction(it) }) + val actualActions = availableActions.map { it.getText() }.sort() UsefulTestCase.assertOrderedEquals("Some unexpected actions available at current position. Use // ACTION: directive", filterOutIrrelevantActions(actualActions), - filterOutIrrelevantActions(expectedActions)) + expectedActions) } //TODO: hack, implemented because irrelevant actions behave in different ways on build server and locally // this behaviour should be investigated and hack can be removed private fun filterOutIrrelevantActions(actions: Collection): Collection { - return actions.filter { action -> IRRELEVANT_ACTION_PREFIXES.none { action.startsWith(it) } } + return actions.filter { !isIrrelevantAction(it) } } + private fun isIrrelevantAction(action: String) = IRRELEVANT_ACTION_PREFIXES.any { action.startsWith(it) } + private val IRRELEVANT_ACTION_PREFIXES = listOf( "Disable ", "Edit intention settings", diff --git a/idea/testData/quickfix/autoImports/noImportInSafeQualifiedExpressionNotFirst.before.Main.kt b/idea/testData/quickfix/autoImports/noImportInSafeQualifiedExpressionNotFirst.before.Main.kt index 1305266e16b..1cfe1a2f0a5 100644 --- a/idea/testData/quickfix/autoImports/noImportInSafeQualifiedExpressionNotFirst.before.Main.kt +++ b/idea/testData/quickfix/autoImports/noImportInSafeQualifiedExpressionNotFirst.before.Main.kt @@ -1,9 +1,7 @@ // "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false" // ERROR: Unresolved reference: SomeTest // ACTION: Create class 'SomeTest' -// ACTION: Edit intention settings // ACTION: Replace safe access expression with 'if' expression -// ACTION: Disable 'Replace Safe Access Expression with 'if' Expression' package testing diff --git a/idea/testData/quickfix/createFromUsage/createVariable/property/localValNoReceiver.kt b/idea/testData/quickfix/createFromUsage/createVariable/property/localValNoReceiver.kt index 6ab1fc48028..76d544c7dc6 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/property/localValNoReceiver.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/property/localValNoReceiver.kt @@ -1,7 +1,5 @@ // "Create property 'foo'" "false" // ACTION: Convert to expression body -// ACTION: Disable 'Convert to Expression Body' -// ACTION: Edit intention settings // ACTION: Create parameter 'foo' // ACTION: Create local variable 'foo' // ERROR: Unresolved reference: foo diff --git a/idea/testData/quickfix/createFromUsage/createVariable/property/valOnJavaInterface.before.Main.kt b/idea/testData/quickfix/createFromUsage/createVariable/property/valOnJavaInterface.before.Main.kt index 13ebd61d7ef..7df1347e1a8 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/property/valOnJavaInterface.before.Main.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/property/valOnJavaInterface.before.Main.kt @@ -1,7 +1,5 @@ // "Create property 'foo'" "false" // ACTION: Convert to expression body -// ACTION: Disable 'Convert to Expression Body' -// ACTION: Edit intention settings // ACTION: Create extension property 'foo' // ERROR: Unresolved reference: foo diff --git a/idea/testData/quickfix/override/typeMismatchOnOverride/cantChangeMultipleOverriddenPropertiesTypes.kt b/idea/testData/quickfix/override/typeMismatchOnOverride/cantChangeMultipleOverriddenPropertiesTypes.kt index d2a79b49e7e..cfcf99eccfb 100644 --- a/idea/testData/quickfix/override/typeMismatchOnOverride/cantChangeMultipleOverriddenPropertiesTypes.kt +++ b/idea/testData/quickfix/override/typeMismatchOnOverride/cantChangeMultipleOverriddenPropertiesTypes.kt @@ -1,7 +1,5 @@ // "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 interface A { val x: (String) -> Int diff --git a/idea/testData/quickfix/typeAddition/publicFunWithoutBody.kt b/idea/testData/quickfix/typeAddition/publicFunWithoutBody.kt index 6cae4c8e3d0..cc725120649 100644 --- a/idea/testData/quickfix/typeAddition/publicFunWithoutBody.kt +++ b/idea/testData/quickfix/typeAddition/publicFunWithoutBody.kt @@ -3,12 +3,6 @@ // ACTION: Add function body // ACTION: Make 'foo' abstract // ACTION: Convert member 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/dontChangeOverriddenPropertyTypeToErrorType.kt b/idea/testData/quickfix/typeMismatch/dontChangeOverriddenPropertyTypeToErrorType.kt index 4f4ebc0f521..c43f72601c6 100644 --- a/idea/testData/quickfix/typeMismatch/dontChangeOverriddenPropertyTypeToErrorType.kt +++ b/idea/testData/quickfix/typeMismatch/dontChangeOverriddenPropertyTypeToErrorType.kt @@ -1,7 +1,5 @@ // "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 interface A { diff --git a/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/changeFunctionParameterType4.kt b/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/changeFunctionParameterType4.kt index c358f791ec9..bbc9aa20f83 100644 --- a/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/changeFunctionParameterType4.kt +++ b/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/changeFunctionParameterType4.kt @@ -1,7 +1,5 @@ // "Change parameter 'z' type of function 'foo' to '(Int) -> String'" "false" -// ACTION: Edit intention settings - fun foo(y: Int = 0, z: (Int) -> String = {""}) { foo { "" as Int diff --git a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/dontChangeFunctionReturnTypeToErrorType.kt b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/dontChangeFunctionReturnTypeToErrorType.kt index 57f923f963a..2bdfc0c4b41 100644 --- a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/dontChangeFunctionReturnTypeToErrorType.kt +++ b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/dontChangeFunctionReturnTypeToErrorType.kt @@ -1,6 +1,4 @@ // "Change 'foo' function return type to '([ERROR : NoSuchType]) -> Int'" "false" -// ACTION: Disable 'Make Types Implicit In Lambda (May Break Code)' -// ACTION: Edit intention settings // ACTION: Create annotation 'NoSuchType' // ACTION: Create class 'NoSuchType' // ACTION: Create enum 'NoSuchType' diff --git a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/multiFakeOverride.kt b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/multiFakeOverride.kt index eaa1386e34e..253d8ff05c5 100644 --- a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/multiFakeOverride.kt +++ b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/multiFakeOverride.kt @@ -1,8 +1,6 @@ // "Change 'AA.f' function return type to 'Boolean'" "false" // ACTION: Change 'AAA.g' function return type to 'Int' // ACTION: Convert to expression body -// ACTION: Disable 'Convert to Expression Body' -// ACTION: Edit intention settings // ERROR: Type mismatch.
Required:kotlin.Boolean
Found:kotlin.Int
interface A { fun f(): Int diff --git a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/multiFakeOverrideForOperatorConvention.kt b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/multiFakeOverrideForOperatorConvention.kt index 2d0e3cc50f4..8d524c25dd5 100644 --- a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/multiFakeOverrideForOperatorConvention.kt +++ b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/multiFakeOverrideForOperatorConvention.kt @@ -1,10 +1,6 @@ // "Change 'AA.contains' function return type to 'Int'" "false" // ACTION: Change 'AAA.g' function return type to 'Boolean' // ACTION: Convert to expression body -// ACTION: Disable 'Convert to Expression Body' -// ACTION: Disable 'Replace Overloaded Operator With Function Call' -// ACTION: Edit intention settings -// ACTION: Edit intention settings // ACTION: Replace overloaded operator with function call // ERROR: Type mismatch.
Required:kotlin.Int
Found:kotlin.Boolean
interface A {