From c084eefb65a2eef44b5a278d70a1c611e5186e90 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 25 Feb 2019 10:37:07 +0300 Subject: [PATCH] Fix a bunch of IDE quick-fix tests (related to "convert to run/...") These actions became available more often some days ago --- .../autoImports/mismatchingArgs/extensionWrongReceiver.test | 2 ++ .../noImportForFunInQualifiedNotFirst.before.Main.kt | 2 ++ .../noImportInQualifiedExpressionNotFirst.before.Main.kt | 2 ++ .../createClass/callExpression/callWithLibClassQualifier.kt | 2 ++ .../createClass/callExpression/typeArguments/extension.kt | 2 ++ .../createFunction/call/abstract/otherExplicitReceiver.kt | 2 ++ .../createFunction/call/funOnClassNoClassObject.kt | 2 ++ .../createFunction/call/funOnGroovyType.before.Main.kt | 2 ++ .../createFromUsage/createFunction/call/propertyOnUserType.kt | 2 ++ .../call/typeArguments/memberWithTypeParameterAsReceiver.kt | 2 ++ .../createFromUsage/createVariable/property/callOnUserType.kt | 2 ++ .../deprecatedSymbolUsage/javaDeprecated.before.Main.kt | 4 ++++ .../quickfix/experimental/basicFunctionNotApplicable.kt | 2 ++ .../increaseVisibility/invisibleFake/methodToNotProtected.kt | 2 ++ .../increaseVisibility/privateMemberToInternalWithExposed.kt | 2 ++ .../nullables/unsafeInfixCall/unsafeInvokeWithReceiver.kt | 2 ++ .../removeSingleLambdaParameter/propertyWithImplicitType.kt | 2 ++ .../quickfix/surroundWithNullCheck/chainedUnsafeCall.kt | 2 ++ .../quickfix/surroundWithNullCheck/expressionUnsafeCall.kt | 2 ++ .../quickfix/surroundWithNullCheck/unsafeCallInDeclaration.kt | 2 ++ .../quickfix/surroundWithNullCheck/unsafeCallInGetter.kt | 2 ++ idea/testData/quickfix/surroundWithNullCheck/unstableValue.kt | 2 ++ .../quickfix/typeMismatch/tooManyArgumentsException.kt | 2 ++ .../changeToPropertyAccess/propertyCallWithArguments.kt | 2 ++ .../quickfix/wrapWithSafeLetCall/chainedUnsafeCall.kt | 2 ++ .../quickfix/wrapWithSafeLetCall/expressionUnsafeCall.kt | 2 ++ idea/testData/quickfix/wrapWithSafeLetCall/unstableValue.kt | 2 ++ 27 files changed, 56 insertions(+) diff --git a/idea/testData/quickfix/autoImports/mismatchingArgs/extensionWrongReceiver.test b/idea/testData/quickfix/autoImports/mismatchingArgs/extensionWrongReceiver.test index 27ec8a29f8f..d96e20a0fc4 100644 --- a/idea/testData/quickfix/autoImports/mismatchingArgs/extensionWrongReceiver.test +++ b/idea/testData/quickfix/autoImports/mismatchingArgs/extensionWrongReceiver.test @@ -4,6 +4,8 @@ // ACTION: Add parameter to function 'foo' // ACTION: Create extension function 'X.foo' // ACTION: Create member function 'X.foo' +// ACTION: Convert to run +// ACTION: Convert to with package main diff --git a/idea/testData/quickfix/autoImports/noImportForFunInQualifiedNotFirst.before.Main.kt b/idea/testData/quickfix/autoImports/noImportForFunInQualifiedNotFirst.before.Main.kt index a2d5a2c2561..8bc93b8b811 100644 --- a/idea/testData/quickfix/autoImports/noImportForFunInQualifiedNotFirst.before.Main.kt +++ b/idea/testData/quickfix/autoImports/noImportForFunInQualifiedNotFirst.before.Main.kt @@ -1,5 +1,7 @@ // "class org.jetbrains.kotlin.idea.quickfix.ImportFix" "false" // ACTION: Rename reference +// ACTION: Convert to run +// ACTION: Convert to with // ERROR: Unresolved reference: externalFun package testing diff --git a/idea/testData/quickfix/autoImports/noImportInQualifiedExpressionNotFirst.before.Main.kt b/idea/testData/quickfix/autoImports/noImportInQualifiedExpressionNotFirst.before.Main.kt index 01f5f88a50d..ae3e23fa8ef 100644 --- a/idea/testData/quickfix/autoImports/noImportInQualifiedExpressionNotFirst.before.Main.kt +++ b/idea/testData/quickfix/autoImports/noImportInQualifiedExpressionNotFirst.before.Main.kt @@ -2,6 +2,8 @@ // ACTION: Convert property initializer to getter // ACTION: Create class 'SomeTest' // ACTION: Rename reference +// ACTION: Convert to run +// ACTION: Convert to with // ERROR: Unresolved reference: SomeTest package testing diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithLibClassQualifier.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithLibClassQualifier.kt index 43287087cbe..0aaa7e86929 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithLibClassQualifier.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithLibClassQualifier.kt @@ -1,6 +1,8 @@ // "Create class 'Foo'" "false" // ACTION: Create extension function 'Int.Foo' // ACTION: Rename reference +// ACTION: Convert to run +// ACTION: Convert to with // ERROR: Unresolved reference: Foo // WITH_RUNTIME diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/extension.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/extension.kt index f9d8ca98b67..3844f102dc8 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/extension.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/extension.kt @@ -1,6 +1,8 @@ // "Create class 'Foo'" "false" // ACTION: Create extension function 'List.Foo' // ACTION: Rename reference +// ACTION: Convert to run +// ACTION: Convert to with // ERROR: Unresolved reference: Foo // WITH_RUNTIME diff --git a/idea/testData/quickfix/createFromUsage/createFunction/call/abstract/otherExplicitReceiver.kt b/idea/testData/quickfix/createFromUsage/createFunction/call/abstract/otherExplicitReceiver.kt index 009bf228daa..098002e2379 100644 --- a/idea/testData/quickfix/createFromUsage/createFunction/call/abstract/otherExplicitReceiver.kt +++ b/idea/testData/quickfix/createFromUsage/createFunction/call/abstract/otherExplicitReceiver.kt @@ -3,6 +3,8 @@ // ACTION: Create member function 'B.foo' // ACTION: Rename reference // ACTION: Add 'b =' to argument +// ACTION: Convert to run +// ACTION: Convert to with // ERROR: Unresolved reference: foo abstract class A { fun bar(b: Boolean) {} diff --git a/idea/testData/quickfix/createFromUsage/createFunction/call/funOnClassNoClassObject.kt b/idea/testData/quickfix/createFromUsage/createFunction/call/funOnClassNoClassObject.kt index 47a03bc1e4d..0a3d39790f1 100644 --- a/idea/testData/quickfix/createFromUsage/createFunction/call/funOnClassNoClassObject.kt +++ b/idea/testData/quickfix/createFromUsage/createFunction/call/funOnClassNoClassObject.kt @@ -1,5 +1,7 @@ // "Create member function 'foo'" "false" // ACTION: Rename reference +// ACTION: Convert to run +// ACTION: Convert to with // ERROR: Unresolved reference: foo class A(val n: T) diff --git a/idea/testData/quickfix/createFromUsage/createFunction/call/funOnGroovyType.before.Main.kt b/idea/testData/quickfix/createFromUsage/createFunction/call/funOnGroovyType.before.Main.kt index 2a1cbcdd97f..1e0bd5d770b 100644 --- a/idea/testData/quickfix/createFromUsage/createFunction/call/funOnGroovyType.before.Main.kt +++ b/idea/testData/quickfix/createFromUsage/createFunction/call/funOnGroovyType.before.Main.kt @@ -1,6 +1,8 @@ // "Create member function 'foo'" "false" // ACTION: Create extension function 'A.foo' // ACTION: Rename reference +// ACTION: Convert to run +// ACTION: Convert to with // ERROR: Unresolved reference: foo fun test(): Int { diff --git a/idea/testData/quickfix/createFromUsage/createFunction/call/propertyOnUserType.kt b/idea/testData/quickfix/createFromUsage/createFunction/call/propertyOnUserType.kt index 0c1f71f7b56..80ac430412d 100644 --- a/idea/testData/quickfix/createFromUsage/createFunction/call/propertyOnUserType.kt +++ b/idea/testData/quickfix/createFromUsage/createFunction/call/propertyOnUserType.kt @@ -1,5 +1,7 @@ // "Create member function 'foo'" "false" // ACTION: Add names to call arguments +// ACTION: Convert to run +// ACTION: Convert to with // ERROR: Unresolved reference: x class A(val n: T) { diff --git a/idea/testData/quickfix/createFromUsage/createFunction/call/typeArguments/memberWithTypeParameterAsReceiver.kt b/idea/testData/quickfix/createFromUsage/createFunction/call/typeArguments/memberWithTypeParameterAsReceiver.kt index 0772d3b272b..f57dbb5b3b5 100644 --- a/idea/testData/quickfix/createFromUsage/createFunction/call/typeArguments/memberWithTypeParameterAsReceiver.kt +++ b/idea/testData/quickfix/createFromUsage/createFunction/call/typeArguments/memberWithTypeParameterAsReceiver.kt @@ -1,6 +1,8 @@ // "Create member function 'bar'" "false" // ACTION: Create extension function 'T.bar' // ACTION: Rename reference +// ACTION: Convert to run +// ACTION: Convert to with // ERROR: Unresolved reference: bar fun foo(t: T) { t.bar() diff --git a/idea/testData/quickfix/createFromUsage/createVariable/property/callOnUserType.kt b/idea/testData/quickfix/createFromUsage/createVariable/property/callOnUserType.kt index e188c075ccf..cd908cfb825 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/property/callOnUserType.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/property/callOnUserType.kt @@ -2,6 +2,8 @@ // ACTION: Create extension function 'A.bar' // ACTION: Create member function 'A.bar' // ACTION: Rename reference +// ACTION: Convert to run +// ACTION: Convert to with // ERROR: Unresolved reference: bar // ERROR: Unresolved reference: foo diff --git a/idea/testData/quickfix/deprecatedSymbolUsage/javaDeprecated.before.Main.kt b/idea/testData/quickfix/deprecatedSymbolUsage/javaDeprecated.before.Main.kt index f08b1055f14..c1e17bef9af 100644 --- a/idea/testData/quickfix/deprecatedSymbolUsage/javaDeprecated.before.Main.kt +++ b/idea/testData/quickfix/deprecatedSymbolUsage/javaDeprecated.before.Main.kt @@ -1,4 +1,8 @@ // "class org.jetbrains.kotlin.idea.quickfix.replaceWith.DeprecatedSymbolUsageFix" "false" +// ACTION: Convert to run +// ACTION: Convert to with +// ACTION: Convert to also +// ACTION: Convert to apply fun foo() { val c = JavaClass() diff --git a/idea/testData/quickfix/experimental/basicFunctionNotApplicable.kt b/idea/testData/quickfix/experimental/basicFunctionNotApplicable.kt index 488f55d3b29..f365103c9f1 100644 --- a/idea/testData/quickfix/experimental/basicFunctionNotApplicable.kt +++ b/idea/testData/quickfix/experimental/basicFunctionNotApplicable.kt @@ -4,6 +4,8 @@ // ACTION: Add '@MyExperimentalAPI' annotation to containing class 'Bar' // ACTION: Add '@UseExperimental(MyExperimentalAPI::class)' annotation to 'bar' // ACTION: Add '-Xuse-experimental=MyExperimentalAPI' to module light_idea_test_case compiler arguments +// ACTION: Convert to run +// ACTION: Convert to with // ERROR: This declaration is experimental and its usage must be marked with '@MyExperimentalAPI' or '@UseExperimental(MyExperimentalAPI::class)' // ERROR: This declaration is experimental and its usage must be marked with '@MyExperimentalAPI' or '@UseExperimental(MyExperimentalAPI::class)' diff --git a/idea/testData/quickfix/increaseVisibility/invisibleFake/methodToNotProtected.kt b/idea/testData/quickfix/increaseVisibility/invisibleFake/methodToNotProtected.kt index 5eecc54a17b..2cf01b95b68 100644 --- a/idea/testData/quickfix/increaseVisibility/invisibleFake/methodToNotProtected.kt +++ b/idea/testData/quickfix/increaseVisibility/invisibleFake/methodToNotProtected.kt @@ -1,6 +1,8 @@ // "Make 'doSth' protected" "false" // ACTION: Make 'doSth' public // ACTION: Make 'doSth' internal +// ACTION: Convert to run +// ACTION: Convert to with // ERROR: Cannot access 'doSth': it is private in 'A' class A { diff --git a/idea/testData/quickfix/increaseVisibility/privateMemberToInternalWithExposed.kt b/idea/testData/quickfix/increaseVisibility/privateMemberToInternalWithExposed.kt index ae82b9b2b01..3cae1b35c99 100644 --- a/idea/testData/quickfix/increaseVisibility/privateMemberToInternalWithExposed.kt +++ b/idea/testData/quickfix/increaseVisibility/privateMemberToInternalWithExposed.kt @@ -2,6 +2,8 @@ // ACTION: Convert property initializer to getter // ACTION: Add names to call arguments // ACTION: Move to constructor +// ACTION: Convert to run +// ACTION: Convert to with // ERROR: Cannot access 'bar': it is private in 'First' private data class Data(val x: Int) diff --git a/idea/testData/quickfix/nullables/unsafeInfixCall/unsafeInvokeWithReceiver.kt b/idea/testData/quickfix/nullables/unsafeInfixCall/unsafeInvokeWithReceiver.kt index 0977c5b121e..b9baa26ad60 100644 --- a/idea/testData/quickfix/nullables/unsafeInfixCall/unsafeInvokeWithReceiver.kt +++ b/idea/testData/quickfix/nullables/unsafeInfixCall/unsafeInvokeWithReceiver.kt @@ -2,6 +2,8 @@ // ACTION: Convert to block body // ACTION: Replace overloaded operator with function call // ACTION: Wrap with '?.let { ... }' call +// ACTION: Convert to run +// ACTION: Convert to with // ERROR: Reference has a nullable type '(String.() -> Unit)?', use explicit '?.invoke()' to make a function-like call instead fun foo(exec: (String.() -> Unit)?) = "".exec() \ No newline at end of file diff --git a/idea/testData/quickfix/removeSingleLambdaParameter/propertyWithImplicitType.kt b/idea/testData/quickfix/removeSingleLambdaParameter/propertyWithImplicitType.kt index 0fcebe99ccf..882391721b6 100644 --- a/idea/testData/quickfix/removeSingleLambdaParameter/propertyWithImplicitType.kt +++ b/idea/testData/quickfix/removeSingleLambdaParameter/propertyWithImplicitType.kt @@ -1,6 +1,8 @@ // "Remove single lambda parameter declaration" "false" // ACTION: Remove explicit lambda parameter types (may break code) // ACTION: Rename to _ +// ACTION: Convert to also +// ACTION: Convert to apply fun test() { val f = { i: Int -> foo() } bar(f) diff --git a/idea/testData/quickfix/surroundWithNullCheck/chainedUnsafeCall.kt b/idea/testData/quickfix/surroundWithNullCheck/chainedUnsafeCall.kt index 1d46e1cd8cc..b69b0d55e5b 100644 --- a/idea/testData/quickfix/surroundWithNullCheck/chainedUnsafeCall.kt +++ b/idea/testData/quickfix/surroundWithNullCheck/chainedUnsafeCall.kt @@ -2,6 +2,8 @@ // ACTION: Introduce local variable // ACTION: Add non-null asserted (!!) call // ACTION: Replace with safe (?.) call +// ACTION: Convert to run +// ACTION: Convert to with // ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Int? fun foo(arg: Int?) { diff --git a/idea/testData/quickfix/surroundWithNullCheck/expressionUnsafeCall.kt b/idea/testData/quickfix/surroundWithNullCheck/expressionUnsafeCall.kt index ce71690956a..ca583b5a1bd 100644 --- a/idea/testData/quickfix/surroundWithNullCheck/expressionUnsafeCall.kt +++ b/idea/testData/quickfix/surroundWithNullCheck/expressionUnsafeCall.kt @@ -3,6 +3,8 @@ // ACTION: Convert to block body // ACTION: Introduce local variable // ACTION: Replace with safe (?.) call +// ACTION: Convert to run +// ACTION: Convert to with // ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Int? fun foo(arg: Int?) = arg.hashCode() \ No newline at end of file diff --git a/idea/testData/quickfix/surroundWithNullCheck/unsafeCallInDeclaration.kt b/idea/testData/quickfix/surroundWithNullCheck/unsafeCallInDeclaration.kt index d65aaa6ca48..b317da9f107 100644 --- a/idea/testData/quickfix/surroundWithNullCheck/unsafeCallInDeclaration.kt +++ b/idea/testData/quickfix/surroundWithNullCheck/unsafeCallInDeclaration.kt @@ -1,6 +1,8 @@ // "Surround with null check" "false" // ACTION: Add non-null asserted (!!) call // ACTION: Replace with safe (?.) call +// ACTION: Convert to run +// ACTION: Convert to with // ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type String? fun foo(s: String?) { diff --git a/idea/testData/quickfix/surroundWithNullCheck/unsafeCallInGetter.kt b/idea/testData/quickfix/surroundWithNullCheck/unsafeCallInGetter.kt index f3704618a4d..b9b49d074d1 100644 --- a/idea/testData/quickfix/surroundWithNullCheck/unsafeCallInGetter.kt +++ b/idea/testData/quickfix/surroundWithNullCheck/unsafeCallInGetter.kt @@ -4,6 +4,8 @@ // ACTION: Convert to block body // ACTION: Introduce local variable // ACTION: Replace with safe (?.) call +// ACTION: Convert to run +// ACTION: Convert to with // ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type String? class My(val x: String?) { diff --git a/idea/testData/quickfix/surroundWithNullCheck/unstableValue.kt b/idea/testData/quickfix/surroundWithNullCheck/unstableValue.kt index 6a8d7f82cc3..a7e6da1c080 100644 --- a/idea/testData/quickfix/surroundWithNullCheck/unstableValue.kt +++ b/idea/testData/quickfix/surroundWithNullCheck/unstableValue.kt @@ -2,6 +2,8 @@ // ACTION: Introduce local variable // ACTION: Add non-null asserted (!!) call // ACTION: Replace with safe (?.) call +// ACTION: Convert to run +// ACTION: Convert to with // ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Int? class My(var x: Int?) { diff --git a/idea/testData/quickfix/typeMismatch/tooManyArgumentsException.kt b/idea/testData/quickfix/typeMismatch/tooManyArgumentsException.kt index 0a02e4927ea..ad3fa3c4a80 100644 --- a/idea/testData/quickfix/typeMismatch/tooManyArgumentsException.kt +++ b/idea/testData/quickfix/typeMismatch/tooManyArgumentsException.kt @@ -4,6 +4,8 @@ // ACTION: Create function 'join' // ACTION: Flip ',' // ACTION: Introduce local variable +// ACTION: Convert to also +// ACTION: Convert to apply // ACTION: Put arguments on separate lines //this test checks that there is no ArrayIndexOutOfBoundsException when there are more arguments than parameters diff --git a/idea/testData/quickfix/variables/changeToPropertyAccess/propertyCallWithArguments.kt b/idea/testData/quickfix/variables/changeToPropertyAccess/propertyCallWithArguments.kt index 49d119b420a..67802988776 100644 --- a/idea/testData/quickfix/variables/changeToPropertyAccess/propertyCallWithArguments.kt +++ b/idea/testData/quickfix/variables/changeToPropertyAccess/propertyCallWithArguments.kt @@ -1,4 +1,6 @@ // "Change to property access" "false" +// ACTION: Convert to run +// ACTION: Convert to with // ERROR: Expression 'fd' of type 'String' cannot be invoked as a function. The function 'invoke()' is not found class A(val fd: String) diff --git a/idea/testData/quickfix/wrapWithSafeLetCall/chainedUnsafeCall.kt b/idea/testData/quickfix/wrapWithSafeLetCall/chainedUnsafeCall.kt index e2751de2138..37206973fb4 100644 --- a/idea/testData/quickfix/wrapWithSafeLetCall/chainedUnsafeCall.kt +++ b/idea/testData/quickfix/wrapWithSafeLetCall/chainedUnsafeCall.kt @@ -3,6 +3,8 @@ // ACTION: Add non-null asserted (!!) call // ACTION: Introduce local variable // ACTION: Replace with safe (?.) call +// ACTION: Convert to run +// ACTION: Convert to with // ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Int? fun foo(arg: Int?) { diff --git a/idea/testData/quickfix/wrapWithSafeLetCall/expressionUnsafeCall.kt b/idea/testData/quickfix/wrapWithSafeLetCall/expressionUnsafeCall.kt index dc6bcb44f99..41debe2b3a6 100644 --- a/idea/testData/quickfix/wrapWithSafeLetCall/expressionUnsafeCall.kt +++ b/idea/testData/quickfix/wrapWithSafeLetCall/expressionUnsafeCall.kt @@ -4,6 +4,8 @@ // ACTION: Convert to block body // ACTION: Introduce local variable // ACTION: Replace with safe (?.) call +// ACTION: Convert to run +// ACTION: Convert to with // ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Int? fun Int.bar() = this diff --git a/idea/testData/quickfix/wrapWithSafeLetCall/unstableValue.kt b/idea/testData/quickfix/wrapWithSafeLetCall/unstableValue.kt index 6ae07ce98d1..cb2270d893f 100644 --- a/idea/testData/quickfix/wrapWithSafeLetCall/unstableValue.kt +++ b/idea/testData/quickfix/wrapWithSafeLetCall/unstableValue.kt @@ -2,6 +2,8 @@ // WITH_RUNTIME // ACTION: Add non-null asserted (!!) call // ACTION: Replace with safe (?.) call +// ACTION: Convert to run +// ACTION: Convert to with // ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Int? fun Int.bar() {}