Quickfix and intention tests refactoring: refer to intention action by class when checking that it's not available (instead of listing all available actions)

This commit is contained in:
Valentin Kipyatkov
2014-01-23 17:00:26 +04:00
parent 3028cec4cd
commit d01ff28212
75 changed files with 99 additions and 136 deletions
@@ -1,5 +1,4 @@
// "Add '<*, *>'" "false"
// "Add '<*>'" "false"
// "class org.jetbrains.jet.plugin.quickfix.AddStarProjectionsFix" "false"
// ERROR: 2 type arguments expected
public fun foo(a: Any) {
a is Map<Int>
@@ -1,5 +1,4 @@
// "Add '<*, *>'" "false"
// "Add '<*>'" "false"
// "class org.jetbrains.jet.plugin.quickfix.AddStarProjectionsFix" "false"
// ERROR: 2 type arguments expected
public fun foo(a: Any) {
a is <caret>Map<Int>
@@ -1,4 +1,4 @@
// "Add '<*, *>'" "false"
// "class org.jetbrains.jet.plugin.quickfix.AddStarProjectionsFix" "false"
// ERROR: Type argument expected
class C2<T>
@@ -1,5 +1,4 @@
// "Add '<*>'" "false"
// "Add '<*, *>'" "false"
// "class org.jetbrains.jet.plugin.quickfix.AddStarProjectionsFix" "false"
class C
fun test() {
@@ -1,4 +1,4 @@
// "Add '<*, *>'" "false"
// "class org.jetbrains.jet.plugin.quickfix.AddStarProjectionsFix" "false"
// ERROR: Type argument expected
class C2<T>
@@ -1,5 +1,4 @@
// "Add '<*>'" "false"
// "Add '<*, *>'" "false"
// "class org.jetbrains.jet.plugin.quickfix.AddStarProjectionsFix" "false"
class C
fun test() {
@@ -1,5 +1,4 @@
// "Add '<*, *>'" "false"
// "Add '<*>'" "false"
// "class org.jetbrains.jet.plugin.quickfix.AddStarProjectionsFix" "false"
// ERROR: 2 type arguments expected
public fun foo(a: Any) {
when (a) {
@@ -1,12 +1,5 @@
// "Add '<*, *>'" "false"
// "Add '<*>'" "false"
// "class org.jetbrains.jet.plugin.quickfix.AddStarProjectionsFix" "false"
// ERROR: 2 type arguments expected
// ACTION: Disable 'Eliminate Argument of 'when''
// ACTION: Disable 'Replace 'when' with 'if''
// ACTION: Edit intention settings
// ACTION: Edit intention settings
// ACTION: Eliminate argument of 'when'
// ACTION: Replace 'when' with 'if'
public fun foo(a: Any) {
when (a) {
is <caret>Map<Int> -> {}
@@ -1,5 +1,4 @@
// "Import Class" "false"
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
// KT-3165 Weird stack overflow in IDE
// ERROR: Unresolved reference: Bar
// ERROR: Unresolved reference: SomeImpossibleName
@@ -1,4 +1,4 @@
// "Import Class" "false"
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
// ERROR: Unresolved reference: some[12]
// ERROR: No get method providing array access
@@ -1,4 +1,4 @@
// "Import Class" "false"
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
package Teting
@@ -1,4 +1,4 @@
// "Import Class" "false"
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
// KT-3165 Weird stack overflow in IDE
// ERROR: Unresolved reference: Bar
@@ -1,4 +1,4 @@
// "Import Class" "false"
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
// ERROR: Unresolved reference: TTT
class {
@@ -1,4 +1,4 @@
// "Import Class" "false"
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
// ERROR: Unresolved reference: TTTTT
fun () {
@@ -1,4 +1,4 @@
// "Import Class" "false"
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
// ERROR: Unresolved reference: TTT
object {
@@ -1,4 +1,4 @@
// "Import Class" "false"
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
// ERROR: Function 'f' must have a body
// ERROR: Unresolved reference: TTT
@@ -1,4 +1,4 @@
// "Import Class" "false"
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
// ERROR: Unresolved reference: TTT
val : Int
@@ -1,4 +1,4 @@
// "Import Class" "false"
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
// ERROR: Unresolved reference: someFun
// ERROR: Unresolved reference: test
@@ -1,4 +1,4 @@
// "Import Class" "false"
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
// ERROR: Unresolved reference: some[12]
// ERROR: No get method providing array access
@@ -1,4 +1,4 @@
// "Import" "false"
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
// ERROR: Unresolved reference: externalFun
package testing
@@ -1,4 +1,4 @@
// "Import" "false"
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
// ERROR: Unresolved reference: externalFun
package testing
@@ -1,4 +1,4 @@
// "Import Class" "false"
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
// ERROR: Unresolved reference: PrivateClass
fun test() {
@@ -1,4 +1,4 @@
// "Import" "false"
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
// ERROR: Unresolved reference: PrivateClass
fun test() {
@@ -1,4 +1,4 @@
// "Import" "false"
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
// ERROR: Unresolved reference: SomeTest
package testing
@@ -1,4 +1,4 @@
// "Import" "false"
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
// ERROR: Unresolved reference: SomeTest
package testing
@@ -1,4 +1,4 @@
// "Import" "false"
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
// ERROR: Unresolved reference: SomeTest
package testing
@@ -1,4 +1,4 @@
// "Import" "false"
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
// ERROR: Unresolved reference: SomeTest
package testing
@@ -1,4 +1,4 @@
// "Import" "false"
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
// ERROR: Unresolved reference: SomeTest
package testing
@@ -1,4 +1,4 @@
// "Import" "false"
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
// ERROR: Unresolved reference: SomeTest
package testing
@@ -1,4 +1,4 @@
// "Import" "false"
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
// ERROR: Unresolved reference: SomeTest
package testing
@@ -1,4 +1,4 @@
// "Import" "false"
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
// ERROR: Unresolved reference: SomeTest
package testing
@@ -1,4 +1,4 @@
// "Import" "false"
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
// ERROR: Unresolved reference: FooPackage
package packageClass
@@ -1,4 +1,4 @@
// "Add parameter to function 'component1'" "false"
// "class org.jetbrains.jet.plugin.quickfix.AddFunctionParametersFix" "false"
//ERROR: Too many arguments for internal final fun component1(): jet.Int defined in Data
data class Data(val i: Int) {}
@@ -1,4 +1,4 @@
// "Add parameter to function 'equals'" "false"
// "class org.jetbrains.jet.plugin.quickfix.AddFunctionParametersFix" "false"
// ERROR: Too many arguments for public fun jet.Any?.equals(other: jet.Any?): jet.Boolean defined in jet
fun f(d: Any) {
@@ -1,4 +1,4 @@
// "Add parameter to function 'equals'" "false"
// "class org.jetbrains.jet.plugin.quickfix.AddFunctionParametersFix" "false"
// ERROR: Too many arguments for public open fun equals(p0: jet.Any?): jet.Boolean defined in java.lang.Object
fun f(d: java.lang.Object) {
@@ -1,4 +1,4 @@
// "Add parameter to function 'component1'" "false"
// "class org.jetbrains.jet.plugin.quickfix.AddFunctionParametersFix" "false"
//ERROR: Too many arguments for internal final fun component1(): jet.Int defined in Data
data class Data(val i: Int) {}
@@ -1,4 +1,4 @@
// "Remove parameter 'other'" "false"
// "class org.jetbrains.jet.plugin.quickfix.RemoveFunctionParametersFix" "false"
// ERROR: No value passed for parameter other
fun f(d: Boolean) {
@@ -1,6 +0,0 @@
// "Replace sure() calls by !! in project" "false"
// ERROR: Unresolved reference: sure
fun test() {
sure()
}
@@ -1,4 +1,4 @@
// "Replace sure() calls by !! in project" "false"
// "class org.jetbrains.jet.plugin.quickfix.MigrateSureInProjectFix" "false"
// ERROR: Unresolved reference: sure
fun test() {
@@ -1,4 +1,4 @@
// "Make E open" "false"
// "class org.jetbrains.jet.plugin.quickfix.AddOpenModifierToClassDeclarationFix" "false"
// ERROR: This type is final, so it cannot be inherited from
// ERROR: Cannot access '<init>': it is 'private' in 'E'
enum class E {}
@@ -1,3 +1,3 @@
// "Make E open" "false"
// "class org.jetbrains.jet.plugin.quickfix.AddOpenModifierToClassDeclarationFix" "false"
enum class E {}
class A<T : E<caret>> {}
@@ -1,3 +1,3 @@
// "Make String open" "false"
// "class org.jetbrains.jet.plugin.quickfix.AddOpenModifierToClassDeclarationFix" "false"
// ERROR: This type is final, so it cannot be inherited from
class A : String<caret>() {}
@@ -1,2 +1,2 @@
// "Make String open" "false"
// "class org.jetbrains.jet.plugin.quickfix.AddOpenModifierToClassDeclarationFix" "false"
class A<T : String<caret>> {}
@@ -1,4 +1,4 @@
// "Make JavaClass open" "false"
// "class org.jetbrains.jet.plugin.quickfix.AddOpenModifierToClassDeclarationFix" "false"
// ERROR: This type is final, so it cannot be inherited from
import testPackage.*
@@ -1,4 +1,4 @@
// "Make JavaClass open" "false"
// "class org.jetbrains.jet.plugin.quickfix.AddOpenModifierToClassDeclarationFix" "false"
import testPackage.*
class foo<T : JavaClass>() {}
@@ -1,3 +1,3 @@
// "Make 'String' an annotation class" "false"
// "class org.jetbrains.jet.plugin.quickfix.MakeClassAnAnnotationClassFix" "false"
// ERROR: 'String' is not an annotation class
[String<caret>] class foo {}
@@ -1,8 +1,5 @@
// "Make Object.notify open" "false"
// "class org.jetbrains.jet.plugin.quickfix.MakeOverriddenMemberOpenFix" "false"
// ERROR: 'notify' in 'Object' is final and cannot be overridden
// ACTION: Convert to extension
// ACTION: Disable 'Convert to extension'
// ACTION: Edit intention settings
class A : Object() {
override<caret> fun notify() {}
}
@@ -1,10 +1,7 @@
// "Make 'ordinal' in E and X open" "false"
// "class org.jetbrains.jet.plugin.quickfix.MakeOverriddenMemberOpenFix" "false"
// ERROR: This type is final, so it cannot be inherited from
// ERROR: Cannot access '<init>': it is 'private' in 'E'
// ERROR: 'ordinal' in 'E' is final and cannot be overridden
// ACTION: Convert to extension
// ACTION: Disable 'Convert to extension'
// ACTION: Edit intention settings
enum class E {}
trait X {
final fun ordinal() : Int = 42
@@ -1,4 +1,5 @@
// "Rename parameter to match overridden method" "false"
// "class org.jetbrains.jet.plugin.quickfix.RenameParameterToMatchOverriddenMethodFix" "false"
abstract class A {
abstract fun foo(arg : Int) : Int;
}
@@ -1,10 +1,5 @@
// "Change function signature to 'override fun f(a: Int)'" "false"
// "class org.jetbrains.jet.plugin.quickfix.ChangeMemberFunctionSignatureFix" "false"
// ERROR: 'f' overrides nothing
// ACTION: Add 'open fun f(a: String)' to 'A'
// ACTION: Remove 'override' modifier
// ACTION: Convert to extension
// ACTION: Disable 'Convert to extension'
// ACTION: Edit intention settings
open class A {
open fun foo() {}
fun f(a: Int) {}
@@ -1,4 +1,4 @@
// "Change 'A.x' type to 'String'" "false"
// "class org.jetbrains.jet.plugin.quickfix.ChangeVariableTypeFix" "false"
// ERROR: <html>Var-property type is 'jet.String', which is not a type of overridden<br/><b>internal</b> <b>abstract</b> <b>var</b> x: jet.Int <i>defined in</i> A</html>
trait A {
var x: Int
@@ -1,4 +1,4 @@
// "Change 'C.x' type to 'String'" "false"
// "class org.jetbrains.jet.plugin.quickfix.ChangeVariableTypeFix" "false"
// ERROR: <html>Var-property type is 'jet.Int', which is not a type of overridden<br/><b>internal</b> <b>abstract</b> <b>var</b> x: jet.String <i>defined in</i> A</html>
trait A {
var x: String
@@ -1,4 +1,4 @@
// "Change 'A.foo' function return type to 'Long'" "false"
// "class org.jetbrains.jet.plugin.quickfix.ChangeFunctionReturnTypeFix" "false"
// ERROR: <html>Return type is 'jet.Long', which is not a subtype of overridden<br/><b>internal</b> <b>abstract</b> <b>fun</b> foo(): jet.Int <i>defined in</i> A</html>
trait A {
fun foo(): Int
@@ -1,4 +1,4 @@
// "Change to constructor invocation" "false"
// "class org.jetbrains.jet.plugin.quickfix.ChangeToConstructorInvocationFix" "false"
// ERROR: This type has a constructor, and thus must be initialized here
open class A(x : Int) {}
class B : A<caret> {}
@@ -1,4 +1,4 @@
// "Suppress 'REDUNDANT_NULLABLE' for fun foo" "false"
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
[suppress("REDUNDANT_NULLABLE")]
fun foo(): String?<caret>? = null
@@ -1,5 +1,4 @@
// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "false"
// ACTION: Remove unnecessary non-null assertion (!!)
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
[suppress("FOO"<caret>!!)]
fun foo() {}
@@ -1,5 +1,4 @@
// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "false"
// ACTION: Remove unnecessary non-null assertion (!!)
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
open class Base(s: String)
class Child: Base(""<caret>!!)
@@ -1,4 +1,3 @@
// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "false"
// ACTION: Remove unnecessary non-null assertion (!!)
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
fun foo(s: String = ""<caret>!!) {}
@@ -1,4 +1,3 @@
// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "false"
// ACTION: Remove unnecessary non-null assertion (!!)
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
fun foo() = ""<caret>!!
@@ -1,8 +1,4 @@
// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "false"
// ACTION: Disable 'Split Property Declaration'
// ACTION: Edit intention settings
// ACTION: Remove unnecessary non-null assertion (!!)
// ACTION: Split property declaration
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
fun foo() {
val bar = ""<caret>!!
@@ -1,4 +1,3 @@
// "Suppress 'REDUNDANT_NULLABLE' for statement " "false"
// ACTION: Remove redundant '?'
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
fun foo(s: String?<caret>?) {}
@@ -1,5 +1,4 @@
// "Suppress 'REDUNDANT_NULLABLE' for statement " "false"
// ACTION: Remove redundant '?'
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
fun foo() {
any {
@@ -1,4 +1,3 @@
// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "false"
// ACTION: Remove unnecessary non-null assertion (!!)
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
val foo = ""<caret>!!
@@ -1,5 +1,4 @@
// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for object <anonymous>" "false"
// ACTION: Remove unnecessary non-null assertion (!!)
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
fun foo() {
object : Base(""<caret>!!) {
@@ -1,8 +1,4 @@
// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for object <anonymous>" "false"
// ACTION: Disable 'Split Property Declaration'
// ACTION: Edit intention settings
// ACTION: Remove unnecessary non-null assertion (!!)
// ACTION: Split property declaration
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
fun foo() {
val a = object : Base(""<caret>!!) {
@@ -1,5 +1,4 @@
// "Suppress 'REDUNDANT_NULLABLE' for statement " "false"
// ACTION: Remove redundant '?'
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
open class Base<T>
class Child: Base<String?<caret>?>()
@@ -1,6 +1,5 @@
// "Cast expression 'a: A' to 'B'" "false"
// "class org.jetbrains.jet.plugin.quickfix.CastExpressionFix" "false"
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>B</td></tr><tr><td>Found:</td><td>A</td></tr></table></html>
// ACTION: Change 'foo' function return type to 'A'
open class A
class B : A()
@@ -1,4 +1,4 @@
// "Change parameter 'y' type of function 'foo' to 'Int'" "false"
// "class org.jetbrains.jet.plugin.quickfix.ChangeParameterTypeFix" "false"
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>jet.Int</td></tr><tr><td>Found:</td><td>jet.String</td></tr></table></html>
fun foo(y: Int = 0, z: (Int) -> String = {""}) {
foo(""<caret>: Int)
@@ -1,6 +1,3 @@
// "Change function 'foo' return type to 'String'" "false"
// "class org.jetbrains.jet.plugin.quickfix.ChangeFunctionReturnTypeFix" "false"
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>jet.Int</td></tr><tr><td>Found:</td><td>jet.String</td></tr></table></html>
// ACTION: Disable 'Replace 'if' with 'when''
// ACTION: Edit intention settings
// ACTION: Replace 'if' with 'when'
fun foo(): Int = if (true) ""<caret>: Int else 4
@@ -1,14 +1,8 @@
// "Move else branch to the end" "false"
// "class org.jetbrains.jet.plugin.quickfix.MoveWhenElseBranchFix" "false"
// ERROR: 'else' entry must be the last one in a when-expression
// ERROR: 'else' entry must be the last one in a when-expression
// WARNING: Unreachable code
// WARNING: Unreachable code
// ACTION: Disable 'Eliminate Argument of 'when''
// ACTION: Disable 'Replace 'when' with 'if''
// ACTION: Edit intention settings
// ACTION: Edit intention settings
// ACTION: Eliminate argument of 'when'
// ACTION: Replace 'when' with 'if'
package foo
fun foo() {