diff --git a/core/util.runtime/src/org/jetbrains/kotlin/utils/HammingComparator.kt b/core/util.runtime/src/org/jetbrains/kotlin/utils/HammingComparator.kt new file mode 100644 index 00000000000..468f209f5e1 --- /dev/null +++ b/core/util.runtime/src/org/jetbrains/kotlin/utils/HammingComparator.kt @@ -0,0 +1,29 @@ +/* + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.utils + +import java.util.* + +class HammingComparator(private val referenceString: String, private val asString: T.() -> String) : Comparator { + private fun countDifference(s1: String): Int { + return (0..Math.min(s1.lastIndex, referenceString.lastIndex)).count { s1[it] != referenceString[it] } + } + + override fun compare(lookupItem1: T, lookupItem2: T): Int { + return countDifference(lookupItem1.asString()) - countDifference(lookupItem2.asString()) + } +} diff --git a/core/util.runtime/src/org/jetbrains/kotlin/utils/collections.kt b/core/util.runtime/src/org/jetbrains/kotlin/utils/collections.kt index b0c6668c87f..db15746843a 100644 --- a/core/util.runtime/src/org/jetbrains/kotlin/utils/collections.kt +++ b/core/util.runtime/src/org/jetbrains/kotlin/utils/collections.kt @@ -85,6 +85,8 @@ public fun Iterable.mapToIndex(): Map { public inline fun > C.ifEmpty(body: () -> C): C = if (isEmpty()) body() else this +public inline fun Array.ifEmpty(body: () -> Array): Array = if (isEmpty()) body() else this + public fun emptyOrSingletonList(item: T?): List = if (item == null) listOf() else listOf(item) public fun MutableCollection.addIfNotNull(t: T?) { diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt index 060a6fe7644..f6783e7738f 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt @@ -345,6 +345,9 @@ public class QuickFixRegistrar : QuickFixContributor { UNRESOLVED_REFERENCE.registerFactory(KotlinAddOrderEntryActionFactory) + UNRESOLVED_REFERENCE.registerFactory(RenameUnresolvedReferenceActionFactory) + EXPRESSION_EXPECTED_PACKAGE_FOUND.registerFactory(RenameUnresolvedReferenceActionFactory) + MISPLACED_TYPE_PARAMETER_CONSTRAINTS.registerFactory(MoveTypeParameterConstraintFix) DELEGATE_RESOLVED_TO_DEPRECATED_CONVENTION.registerFactory(DeprecatedFunctionConventionFix) diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/RenameUnresolvedReferenceFix.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/RenameUnresolvedReferenceFix.kt new file mode 100644 index 00000000000..8d84f3b0015 --- /dev/null +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/RenameUnresolvedReferenceFix.kt @@ -0,0 +1,135 @@ +/* + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.idea.quickfix + +import com.intellij.codeInsight.daemon.QuickFixBundle +import com.intellij.codeInsight.intention.IntentionAction +import com.intellij.codeInsight.lookup.LookupElement +import com.intellij.codeInsight.lookup.LookupElementBuilder +import com.intellij.codeInsight.template.* +import com.intellij.openapi.application.ApplicationManager +import com.intellij.openapi.editor.Editor +import com.intellij.openapi.project.Project +import com.intellij.psi.PsiFile +import org.jetbrains.kotlin.descriptors.CallableDescriptor +import org.jetbrains.kotlin.descriptors.DeclarationDescriptorWithVisibility +import org.jetbrains.kotlin.diagnostics.Diagnostic +import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade +import org.jetbrains.kotlin.idea.codeInsight.ReferenceVariantsHelper +import org.jetbrains.kotlin.idea.core.isVisible +import org.jetbrains.kotlin.idea.quickfix.createFromUsage.callableBuilder.guessTypes +import org.jetbrains.kotlin.idea.util.psi.patternMatching.KotlinPsiUnifier +import org.jetbrains.kotlin.idea.util.psi.patternMatching.toRange +import org.jetbrains.kotlin.psi.* +import org.jetbrains.kotlin.psi.psiUtil.* +import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode +import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter +import org.jetbrains.kotlin.types.typeUtil.isSubtypeOf +import org.jetbrains.kotlin.utils.HammingComparator +import org.jetbrains.kotlin.utils.ifEmpty +import java.util.* + +object RenameUnresolvedReferenceActionFactory : KotlinSingleIntentionActionFactory() { + override fun createAction(diagnostic: Diagnostic): IntentionAction? { + val ref = diagnostic.psiElement as? KtNameReferenceExpression ?: return null + return RenameUnresolvedReferenceFix(ref) + } +} + +class RenameUnresolvedReferenceFix(element: KtNameReferenceExpression): KotlinQuickFixAction(element) { + companion object { + private val INPUT_VARIABLE_NAME = "INPUT_VAR" + private val OTHER_VARIABLE_NAME = "OTHER_VAR" + } + + private class ReferenceNameExpression( + private val items: Array, + private val originalReferenceName: String + ) : Expression() { + init { + Arrays.sort(items, HammingComparator(originalReferenceName, { lookupString })) + } + + override fun calculateResult(context: ExpressionContext) = TextResult(items.firstOrNull()?.lookupString ?: originalReferenceName) + + override fun calculateQuickResult(context: ExpressionContext) = null + + override fun calculateLookupItems(context: ExpressionContext) = if (items.size <= 1) null else items + } + + override fun getText() = QuickFixBundle.message("rename.wrong.reference.text") + + override fun getFamilyName() = QuickFixBundle.message("rename.wrong.reference.family") + + override fun isAvailable(project: Project, editor: Editor?, file: PsiFile): Boolean { + return super.isAvailable(project, editor, file) + && editor != null + && element.getStrictParentOfType() == null + } + + private fun KtExpression.isCallee() = getParentOfTypeAndBranch { calleeExpression } != null + + override fun invoke(project: Project, editor: Editor?, file: KtFile) { + if (editor == null) return + val patternExpression = element.getQualifiedElement() as? KtExpression ?: return + + val originalName = element.getReferencedName() + val container = element.parents.firstOrNull { it is KtDeclarationWithBody || it is KtClassOrObject || it is KtFile } ?: return + val isCallee = element.isCallee() + val occurrences = patternExpression.toRange() + .match(container, KotlinPsiUnifier.DEFAULT) + .mapNotNull { + val candidate = (it.range.elements.first() as? KtExpression)?.getQualifiedElementSelector() as? KtNameReferenceExpression + if (candidate != null && candidate.isCallee() == isCallee) candidate else null + } + + val resolutionFacade = element.getResolutionFacade() + val context = resolutionFacade.analyze(element, BodyResolveMode.PARTIAL) + val moduleDescriptor = resolutionFacade.moduleDescriptor + val variantsHelper = ReferenceVariantsHelper(context, resolutionFacade, moduleDescriptor) { + it !is DeclarationDescriptorWithVisibility || it.isVisible(element, null, context, resolutionFacade) + } + val expectedTypes = patternExpression + .guessTypes(context, moduleDescriptor) + .ifEmpty { arrayOf(moduleDescriptor.builtIns.nullableAnyType) } + val descriptorKindFilter = if (isCallee) DescriptorKindFilter.FUNCTIONS else DescriptorKindFilter.VARIABLES + val lookupItems = variantsHelper + .getReferenceVariants(element, descriptorKindFilter, { true }) + .filter { candidate -> + candidate is CallableDescriptor && (expectedTypes.any { candidate.returnType?.isSubtypeOf(it) ?: false }) + } + .mapTo(if (ApplicationManager.getApplication().isUnitTestMode) linkedSetOf() else linkedSetOf(originalName)) { + it.name.asString() + } + .map { LookupElementBuilder.create(it) } + .toTypedArray() + val nameExpression = ReferenceNameExpression(lookupItems, originalName) + + val builder = TemplateBuilderImpl(container) + occurrences.forEach { + if (it != element) { + builder.replaceElement(it.getReferencedNameElement(), OTHER_VARIABLE_NAME, INPUT_VARIABLE_NAME, false) + } + else { + builder.replaceElement(it.getReferencedNameElement(), INPUT_VARIABLE_NAME, nameExpression, true) + } + } + + editor.caretModel.moveToOffset(container.startOffset) + TemplateManager.getInstance(project).startTemplate(editor, builder.buildInlineTemplate()) + } +} diff --git a/idea/testData/quickfix/autoImports/noImportForFunInQualifiedNotFirst.before.Main.kt b/idea/testData/quickfix/autoImports/noImportForFunInQualifiedNotFirst.before.Main.kt index d9e2113610f..a85ceb9ea69 100644 --- a/idea/testData/quickfix/autoImports/noImportForFunInQualifiedNotFirst.before.Main.kt +++ b/idea/testData/quickfix/autoImports/noImportForFunInQualifiedNotFirst.before.Main.kt @@ -1,4 +1,5 @@ // "class org.jetbrains.kotlin.idea.quickfix.AutoImportFix" "false" +// ACTION: Rename reference // ERROR: Unresolved reference: externalFun package testing diff --git a/idea/testData/quickfix/autoImports/noImportForNestedInPrivate.before.Main.kt b/idea/testData/quickfix/autoImports/noImportForNestedInPrivate.before.Main.kt index 9357d0552e0..f4774a38c91 100644 --- a/idea/testData/quickfix/autoImports/noImportForNestedInPrivate.before.Main.kt +++ b/idea/testData/quickfix/autoImports/noImportForNestedInPrivate.before.Main.kt @@ -3,6 +3,7 @@ // ACTION: Create object 'Nested' // ACTION: Create parameter 'Nested' // ACTION: Create property 'Nested' +// ACTION: Rename reference // ERROR: Unresolved reference: Nested fun test() { diff --git a/idea/testData/quickfix/autoImports/noImportForPrivateClass.before.Main.kt b/idea/testData/quickfix/autoImports/noImportForPrivateClass.before.Main.kt index edd48c357ab..c58dfb1eba2 100644 --- a/idea/testData/quickfix/autoImports/noImportForPrivateClass.before.Main.kt +++ b/idea/testData/quickfix/autoImports/noImportForPrivateClass.before.Main.kt @@ -3,6 +3,7 @@ // ACTION: Create object 'PrivateClass' // ACTION: Create parameter 'PrivateClass' // ACTION: Create property 'PrivateClass' +// ACTION: Rename reference // ERROR: Unresolved reference: PrivateClass fun test() { diff --git a/idea/testData/quickfix/autoImports/noImportInImports.before.Main.kt b/idea/testData/quickfix/autoImports/noImportInImports.before.Main.kt index 4b4cba9f2fb..4008cd3b328 100644 --- a/idea/testData/quickfix/autoImports/noImportInImports.before.Main.kt +++ b/idea/testData/quickfix/autoImports/noImportInImports.before.Main.kt @@ -4,6 +4,7 @@ // ACTION: Create interface 'SomeTest' // ACTION: Create enum 'SomeTest' // ACTION: Create object 'SomeTest' +// ACTION: Rename reference // ERROR: Unresolved reference: SomeTest package testing diff --git a/idea/testData/quickfix/autoImports/noImportInQualifiedExpressionNotFirst.before.Main.kt b/idea/testData/quickfix/autoImports/noImportInQualifiedExpressionNotFirst.before.Main.kt index df00fd41501..9cc68e2878e 100644 --- a/idea/testData/quickfix/autoImports/noImportInQualifiedExpressionNotFirst.before.Main.kt +++ b/idea/testData/quickfix/autoImports/noImportInQualifiedExpressionNotFirst.before.Main.kt @@ -1,5 +1,6 @@ // "class org.jetbrains.kotlin.idea.quickfix.AutoImportFix" "false" // ACTION: Create class 'SomeTest' +// ACTION: Rename reference // ERROR: Unresolved reference: SomeTest package testing diff --git a/idea/testData/quickfix/autoImports/noImportInSafeQualifiedExpressionNotFirst.before.Main.kt b/idea/testData/quickfix/autoImports/noImportInSafeQualifiedExpressionNotFirst.before.Main.kt index 29a618e388b..e9ca2b55f5d 100644 --- a/idea/testData/quickfix/autoImports/noImportInSafeQualifiedExpressionNotFirst.before.Main.kt +++ b/idea/testData/quickfix/autoImports/noImportInSafeQualifiedExpressionNotFirst.before.Main.kt @@ -3,6 +3,7 @@ // ERROR: Expression expected, but a package name found // ACTION: Create class 'SomeTest' // ACTION: Replace safe access expression with 'if' expression +// ACTION: Rename reference package testing diff --git a/idea/testData/quickfix/autoImports/noImportsForClassInExcludedPackage.before.Main.kt b/idea/testData/quickfix/autoImports/noImportsForClassInExcludedPackage.before.Main.kt index 937fd51493c..651bd39cebd 100644 --- a/idea/testData/quickfix/autoImports/noImportsForClassInExcludedPackage.before.Main.kt +++ b/idea/testData/quickfix/autoImports/noImportsForClassInExcludedPackage.before.Main.kt @@ -1,6 +1,7 @@ // "class org.jetbrains.kotlin.idea.quickfix.AutoImportFix" "false" // ACTION: Create class 'SomeClass' // ACTION: Create function 'SomeClass' +// ACTION: Rename reference // ERROR: Unresolved reference: SomeClass val x = SomeClass() \ No newline at end of file diff --git a/idea/testData/quickfix/autoImports/noImportsForExcludedClass.before.Main.kt b/idea/testData/quickfix/autoImports/noImportsForExcludedClass.before.Main.kt index 54a86b8f32b..66d6ba00915 100644 --- a/idea/testData/quickfix/autoImports/noImportsForExcludedClass.before.Main.kt +++ b/idea/testData/quickfix/autoImports/noImportsForExcludedClass.before.Main.kt @@ -1,6 +1,7 @@ // "class org.jetbrains.kotlin.idea.quickfix.AutoImportFix" "false" // ACTION: Create class 'ExcludedClass' // ACTION: Create function 'ExcludedClass' +// ACTION: Rename reference // ERROR: Unresolved reference: ExcludedClass val x = ExcludedClass() \ No newline at end of file diff --git a/idea/testData/quickfix/autoImports/noImportsForFunctionInExcludedPackage.before.Main.kt b/idea/testData/quickfix/autoImports/noImportsForFunctionInExcludedPackage.before.Main.kt index 795e4b70cdf..edbfdceba53 100644 --- a/idea/testData/quickfix/autoImports/noImportsForFunctionInExcludedPackage.before.Main.kt +++ b/idea/testData/quickfix/autoImports/noImportsForFunctionInExcludedPackage.before.Main.kt @@ -1,5 +1,6 @@ // "class org.jetbrains.kotlin.idea.quickfix.AutoImportFix" "false" // ACTION: Create function 'someFunction' +// ACTION: Rename reference // ERROR: Unresolved reference: someFunction val x = someFunction() \ No newline at end of file diff --git a/idea/testData/quickfix/autoImports/packageClass.before.Main.kt b/idea/testData/quickfix/autoImports/packageClass.before.Main.kt index 9b6a719a083..d3e8ce36611 100644 --- a/idea/testData/quickfix/autoImports/packageClass.before.Main.kt +++ b/idea/testData/quickfix/autoImports/packageClass.before.Main.kt @@ -1,6 +1,7 @@ // "class org.jetbrains.kotlin.idea.quickfix.AutoImportFix" "false" // ACTION: Create function 'FooPackage' // ACTION: Create class 'FooPackage' +// ACTION: Rename reference // ERROR: Unresolved reference: FooPackage package packageClass diff --git a/idea/testData/quickfix/createFromUsage/createClass/annotationEntry/notAnnotation.kt b/idea/testData/quickfix/createFromUsage/createClass/annotationEntry/notAnnotation.kt index 7320c5842b0..17119db61e8 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/annotationEntry/notAnnotation.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/annotationEntry/notAnnotation.kt @@ -1,5 +1,6 @@ // "Create annotation 'foo'" "false" // ACTION: Create function 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo fun test() = foo(1, "2") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithFinalJavaSupertype.before.Main.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithFinalJavaSupertype.before.Main.kt index 59cdd8c6342..5ce3259d336 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithFinalJavaSupertype.before.Main.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithFinalJavaSupertype.before.Main.kt @@ -1,6 +1,7 @@ // "Create class 'Foo'" "false" // ACTION: Create function 'Foo' // ACTION: Convert to block body +// ACTION: Rename reference // ERROR: Unresolved reference: Foo internal fun test(): A = Foo(2, "2") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithFinalSupertype.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithFinalSupertype.kt index 406a540d987..f5ae1bc5aaf 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithFinalSupertype.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithFinalSupertype.kt @@ -1,6 +1,7 @@ // "Create class 'Foo'" "false" // ACTION: Create function 'Foo' // ACTION: Convert to block body +// ACTION: Rename reference // ERROR: Unresolved reference: Foo final class A diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithGroovyClassQualifier.before.Main.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithGroovyClassQualifier.before.Main.kt index a5c8b9cc8a9..ece1715b3bc 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithGroovyClassQualifier.before.Main.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithGroovyClassQualifier.before.Main.kt @@ -1,4 +1,5 @@ // "Create class 'Foo'" "false" +// ACTION: Rename reference // ERROR: Unresolved reference: Foo fun test() = J.Foo(2, "2") \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithLibClassQualifier.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithLibClassQualifier.kt index ace3416079a..6e1591b7ba4 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithLibClassQualifier.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/callWithLibClassQualifier.kt @@ -1,5 +1,6 @@ // "Create class 'Foo'" "false" // ACTION: Create extension function 'Foo' +// ACTION: Rename reference // ERROR: Unresolved reference: Foo fun test() { diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/extension.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/extension.kt index 4aee3dc9096..09813943bff 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/extension.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/typeArguments/extension.kt @@ -1,5 +1,6 @@ // "Create class 'Foo'" "false" // ACTION: Create extension function 'Foo' +// ACTION: Rename reference // ERROR: Unresolved reference: Foo class A(val items: List) { diff --git a/idea/testData/quickfix/createFromUsage/createClass/importDirective/classWithGroovyQualifier.before.Main.kt b/idea/testData/quickfix/createFromUsage/createClass/importDirective/classWithGroovyQualifier.before.Main.kt index f85893ddffe..6e26543b653 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/importDirective/classWithGroovyQualifier.before.Main.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/importDirective/classWithGroovyQualifier.before.Main.kt @@ -1,4 +1,5 @@ // "Create class 'A'" "false" +// ACTION: Rename reference // ERROR: Unresolved reference: A import J.A diff --git a/idea/testData/quickfix/createFromUsage/createClass/importDirective/enumEntryInJavaEnum.before.Main.kt b/idea/testData/quickfix/createFromUsage/createClass/importDirective/enumEntryInJavaEnum.before.Main.kt index 0183cdfe912..bec3de9ecec 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/importDirective/enumEntryInJavaEnum.before.Main.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/importDirective/enumEntryInJavaEnum.before.Main.kt @@ -3,6 +3,7 @@ // ACTION: Create class 'A' // ACTION: Create enum 'A' // ACTION: Create interface 'A' +// ACTION: Rename reference // ERROR: Unresolved reference: A import E.A diff --git a/idea/testData/quickfix/createFromUsage/createClass/importDirective/enumEntryInPackage.kt b/idea/testData/quickfix/createFromUsage/createClass/importDirective/enumEntryInPackage.kt index c88d76f04e4..5e19f5c6aa9 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/importDirective/enumEntryInPackage.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/importDirective/enumEntryInPackage.kt @@ -4,6 +4,7 @@ // ACTION: Create object 'A' // ACTION: Create enum 'A' // ACTION: Create annotation 'A' +// ACTION: Rename reference // ERROR: Unresolved reference: A package p diff --git a/idea/testData/quickfix/createFromUsage/createClass/importDirective/enumEntryWithQualifier.kt b/idea/testData/quickfix/createFromUsage/createClass/importDirective/enumEntryWithQualifier.kt index 072bf614c0b..f974ebafe11 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/importDirective/enumEntryWithQualifier.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/importDirective/enumEntryWithQualifier.kt @@ -4,6 +4,7 @@ // ACTION: Create object 'A' // ACTION: Create enum 'A' // ACTION: Create annotation 'A' +// ACTION: Rename reference // ERROR: Unresolved reference: A package p diff --git a/idea/testData/quickfix/createFromUsage/createClass/importDirective/objectWithJavaQualifier.before.Main.kt b/idea/testData/quickfix/createFromUsage/createClass/importDirective/objectWithJavaQualifier.before.Main.kt index 5082c82f15b..b85d3521277 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/importDirective/objectWithJavaQualifier.before.Main.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/importDirective/objectWithJavaQualifier.before.Main.kt @@ -4,6 +4,7 @@ // ACTION: Create class 'A' // ACTION: Create interface 'A' // ACTION: Create enum 'A' +// ACTION: Rename reference import J.A class X { diff --git a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/annotationNoReceiver.kt b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/annotationNoReceiver.kt index c17b71ef7df..23ff4c5551f 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/annotationNoReceiver.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/annotationNoReceiver.kt @@ -3,6 +3,7 @@ // ACTION: Create local variable 'A' // ACTION: Create parameter 'A' // ACTION: Create property 'A' +// ACTION: Rename reference // ERROR: Unresolved reference: A package p diff --git a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/classByNestedGroovyQualifier.before.Main.kt b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/classByNestedGroovyQualifier.before.Main.kt index f602a97454a..a010b632603 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/classByNestedGroovyQualifier.before.Main.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/classByNestedGroovyQualifier.before.Main.kt @@ -1,3 +1,4 @@ // "Create class 'A'" "false" +// ACTION: Rename reference // ERROR: Unresolved reference: A fun foo() = J.A.B diff --git a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/classInPackage.kt b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/classInPackage.kt index df46597fd20..0b2d821f05e 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/classInPackage.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/classInPackage.kt @@ -1,5 +1,6 @@ // "Create class 'A'" "false" // ACTION: Create object 'A' +// ACTION: Rename reference // ERROR: Unresolved reference: A package p diff --git a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/classNoReceiver.kt b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/classNoReceiver.kt index 962513e01b8..87fec207b4c 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/classNoReceiver.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/classNoReceiver.kt @@ -3,6 +3,7 @@ // ACTION: Create local variable 'A' // ACTION: Create parameter 'A' // ACTION: Create property 'A' +// ACTION: Rename reference // ERROR: Unresolved reference: A package p diff --git a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/classWithQualifier.kt b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/classWithQualifier.kt index a1b41aacd93..49c6bbecfb5 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/classWithQualifier.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/classWithQualifier.kt @@ -1,5 +1,6 @@ // "Create class 'A'" "false" // ACTION: Create object 'A' +// ACTION: Rename reference // ERROR: Unresolved reference: A package p diff --git a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/classWithReceiver.kt b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/classWithReceiver.kt index 5011b43dfa0..ac395c8c0e3 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/classWithReceiver.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/classWithReceiver.kt @@ -2,6 +2,7 @@ // ACTION: Create extension property 'A' // ACTION: Create member property 'A' // ACTION: Create property 'A' as constructor parameter +// ACTION: Rename reference // ERROR: Unresolved reference: A package p diff --git a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryNoReceiver.kt b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryNoReceiver.kt index 511fd011189..a3aeea08e12 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryNoReceiver.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryNoReceiver.kt @@ -3,6 +3,7 @@ // ACTION: Create local variable 'A' // ACTION: Create parameter 'A' // ACTION: Create property 'A' +// ACTION: Rename reference // ERROR: Unresolved reference: A package p diff --git a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithJavaEnumQualifier.before.Main.kt b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithJavaEnumQualifier.before.Main.kt index aa2c9a6a9b7..a5470fdd8cd 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithJavaEnumQualifier.before.Main.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithJavaEnumQualifier.before.Main.kt @@ -1,4 +1,5 @@ // "Create enum constant 'A'" "false" // ACTION: Create member property 'A' +// ACTION: Rename reference // ERROR: Unresolved reference: A fun foo() = J.A diff --git a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithJavaEnumSuperclass.before.Main.kt b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithJavaEnumSuperclass.before.Main.kt index cfe1b263765..630bc03138c 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithJavaEnumSuperclass.before.Main.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithJavaEnumSuperclass.before.Main.kt @@ -1,5 +1,6 @@ // "Create enum constant 'A'" "false" // ACTION: Convert to block body // ACTION: Create member property 'A' +// ACTION: Rename reference // ERROR: Unresolved reference: A internal fun foo(): J = J.A diff --git a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithJavaNonEnumQualifier.before.Main.kt b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithJavaNonEnumQualifier.before.Main.kt index aa2c9a6a9b7..a5470fdd8cd 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithJavaNonEnumQualifier.before.Main.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithJavaNonEnumQualifier.before.Main.kt @@ -1,4 +1,5 @@ // "Create enum constant 'A'" "false" // ACTION: Create member property 'A' +// ACTION: Rename reference // ERROR: Unresolved reference: A fun foo() = J.A diff --git a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithJavaNonEnumSuperclass.before.Main.kt b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithJavaNonEnumSuperclass.before.Main.kt index 1e0443eb5ee..e3a4135d9d1 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithJavaNonEnumSuperclass.before.Main.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithJavaNonEnumSuperclass.before.Main.kt @@ -1,5 +1,6 @@ // "Create enum constant 'A'" "false" // ACTION: Convert to block body // ACTION: Create member property 'A' +// ACTION: Rename reference // ERROR: Unresolved reference: A internal fun foo(): X = E.A diff --git a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithQualifier.kt b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithQualifier.kt index cf05b419cb8..f4c8e32404b 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithQualifier.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithQualifier.kt @@ -1,5 +1,6 @@ // "Create enum constant 'A'" "false" // ACTION: Create object 'A' +// ACTION: Rename reference // ERROR: Unresolved reference: A package p diff --git a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithReceiver.kt b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithReceiver.kt index a48fdff85b0..c465cb7336c 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithReceiver.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithReceiver.kt @@ -2,6 +2,7 @@ // ACTION: Create extension property 'A' // ACTION: Create member property 'A' // ACTION: Create property 'A' as constructor parameter +// ACTION: Rename reference // ERROR: Unresolved reference: A package p diff --git a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithSuperclass.kt b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithSuperclass.kt index e990263f6f3..18e2d7f1be0 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithSuperclass.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumEntryWithSuperclass.kt @@ -1,6 +1,7 @@ // "Create enum constant 'A'" "false" // ACTION: Convert to block body // ACTION: Create object 'A' +// ACTION: Rename reference // ERROR: Unresolved reference: A package p diff --git a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumNoReceiver.kt b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumNoReceiver.kt index 9eb038cafb4..dbb8d100de8 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumNoReceiver.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/enumNoReceiver.kt @@ -3,6 +3,7 @@ // ACTION: Create local variable 'A' // ACTION: Create parameter 'A' // ACTION: Create property 'A' +// ACTION: Rename reference // ERROR: Unresolved reference: A package p diff --git a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/objectWithJavaQualifier.before.Main.kt b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/objectWithJavaQualifier.before.Main.kt index 882e449de00..1f2b969ce2c 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/objectWithJavaQualifier.before.Main.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/objectWithJavaQualifier.before.Main.kt @@ -1,4 +1,5 @@ // "Create object 'A'" "false" // ACTION: Create member property 'A' +// ACTION: Rename reference // ERROR: Unresolved reference: A fun foo() = J.A diff --git a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/objectWithReceiver.kt b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/objectWithReceiver.kt index e95f812db4b..fd6ac6d6814 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/objectWithReceiver.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/objectWithReceiver.kt @@ -2,6 +2,7 @@ // ACTION: Create extension property 'A' // ACTION: Create member property 'A' // ACTION: Create property 'A' as constructor parameter +// ACTION: Rename reference // ERROR: Unresolved reference: A package p diff --git a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/recursiveBound.kt b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/recursiveBound.kt index 104b2f25906..33c34689262 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/recursiveBound.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/recursiveBound.kt @@ -3,6 +3,7 @@ // ACTION: Create parameter 'Foo' // ACTION: Create property 'Foo' // ACTION: Split property declaration +// ACTION: Rename reference // ERROR: Unresolved reference: Foo open class Cyclic> diff --git a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/traitNoReceiver.kt b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/traitNoReceiver.kt index cbc1a37db1b..b90d19fb929 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/traitNoReceiver.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/referenceExpression/traitNoReceiver.kt @@ -3,6 +3,7 @@ // ACTION: Create local variable 'A' // ACTION: Create parameter 'A' // ACTION: Create property 'A' +// ACTION: Rename reference // ERROR: Unresolved reference: A package p diff --git a/idea/testData/quickfix/createFromUsage/createFunction/call/callInAnnotationEntry.kt b/idea/testData/quickfix/createFromUsage/createFunction/call/callInAnnotationEntry.kt index 34ac4072417..f1440f507aa 100644 --- a/idea/testData/quickfix/createFromUsage/createFunction/call/callInAnnotationEntry.kt +++ b/idea/testData/quickfix/createFromUsage/createFunction/call/callInAnnotationEntry.kt @@ -2,6 +2,7 @@ // ACTION: Create annotation 'bar' // ACTION: Make internal // ACTION: Make private +// ACTION: Rename reference // ERROR: Unresolved reference: foo // ERROR: Unresolved reference: bar diff --git a/idea/testData/quickfix/createFromUsage/createFunction/call/extensionRefInImport.kt b/idea/testData/quickfix/createFromUsage/createFunction/call/extensionRefInImport.kt index 495deb3f7ea..2238f37a9b6 100644 --- a/idea/testData/quickfix/createFromUsage/createFunction/call/extensionRefInImport.kt +++ b/idea/testData/quickfix/createFromUsage/createFunction/call/extensionRefInImport.kt @@ -1,4 +1,5 @@ // "Create extension function 'foo'" "false" +// ACTION: Rename reference // ERROR: Unresolved reference: foo package p diff --git a/idea/testData/quickfix/createFromUsage/createFunction/call/funOnClassNoClassObject.kt b/idea/testData/quickfix/createFromUsage/createFunction/call/funOnClassNoClassObject.kt index ef465654f92..47a03bc1e4d 100644 --- a/idea/testData/quickfix/createFromUsage/createFunction/call/funOnClassNoClassObject.kt +++ b/idea/testData/quickfix/createFromUsage/createFunction/call/funOnClassNoClassObject.kt @@ -1,4 +1,5 @@ // "Create member function 'foo'" "false" +// ACTION: Rename reference // 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 b08763c712f..af404fd3562 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,7 @@ // "Create member function 'foo'" "false" // ACTION: Convert to expression body // ACTION: Create extension function 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo fun test(): Int { diff --git a/idea/testData/quickfix/createFromUsage/createFunction/call/refInImport.kt b/idea/testData/quickfix/createFromUsage/createFunction/call/refInImport.kt index 179a08e4876..162d90aeb9a 100644 --- a/idea/testData/quickfix/createFromUsage/createFunction/call/refInImport.kt +++ b/idea/testData/quickfix/createFromUsage/createFunction/call/refInImport.kt @@ -1,4 +1,5 @@ // "Create function 'foo'" "false" +// ACTION: Rename reference // ERROR: Unresolved reference: foo package p diff --git a/idea/testData/quickfix/createFromUsage/createFunction/call/staticExtensionFunOnJavaClass.before.Main.kt b/idea/testData/quickfix/createFromUsage/createFunction/call/staticExtensionFunOnJavaClass.before.Main.kt index 7088d3b8ad2..0a67286da88 100644 --- a/idea/testData/quickfix/createFromUsage/createFunction/call/staticExtensionFunOnJavaClass.before.Main.kt +++ b/idea/testData/quickfix/createFromUsage/createFunction/call/staticExtensionFunOnJavaClass.before.Main.kt @@ -1,5 +1,6 @@ // "Create extension function 'foo'" "false" // ACTION: Create member function 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo fun test() { diff --git a/idea/testData/quickfix/createFromUsage/createFunction/call/staticFunOnJavaInterface.before.Main.kt b/idea/testData/quickfix/createFromUsage/createFunction/call/staticFunOnJavaInterface.before.Main.kt index 723e9ab13dc..ecd1eb1451b 100644 --- a/idea/testData/quickfix/createFromUsage/createFunction/call/staticFunOnJavaInterface.before.Main.kt +++ b/idea/testData/quickfix/createFromUsage/createFunction/call/staticFunOnJavaInterface.before.Main.kt @@ -1,5 +1,6 @@ // "Create function 'foo'" "false" // "Create member function 'foo'" "false" +// ACTION: Rename reference // ERROR: Unresolved reference: foo fun test() { diff --git a/idea/testData/quickfix/createFromUsage/createVariable/localVariable/inClass.kt b/idea/testData/quickfix/createFromUsage/createVariable/localVariable/inClass.kt index 6de5cd68e95..ad14b0d5b3c 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/localVariable/inClass.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/localVariable/inClass.kt @@ -1,6 +1,7 @@ // "Create local variable 'foo'" "false" // ACTION: Create parameter 'foo' // ACTION: Create property 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo class A { diff --git a/idea/testData/quickfix/createFromUsage/createVariable/localVariable/onTopLevel.kt b/idea/testData/quickfix/createFromUsage/createVariable/localVariable/onTopLevel.kt index aec94ab0364..b4673054388 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/localVariable/onTopLevel.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/localVariable/onTopLevel.kt @@ -1,5 +1,6 @@ // "Create local variable 'foo'" "false" // ACTION: Create property 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo val t: Int = foo \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createVariable/localVariable/qualifiedInFun.kt b/idea/testData/quickfix/createFromUsage/createVariable/localVariable/qualifiedInFun.kt index 838b89c9c90..985885b8e8a 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/localVariable/qualifiedInFun.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/localVariable/qualifiedInFun.kt @@ -2,6 +2,7 @@ // ACTION: Create extension property 'foo' // ACTION: Create member property 'foo' // ACTION: Create property 'foo' as constructor parameter +// ACTION: Rename reference // ERROR: Unresolved reference: foo class A diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/assignedInFun.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/assignedInFun.kt index 5279dad2738..67b55ea89cf 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/parameter/assignedInFun.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/assignedInFun.kt @@ -1,6 +1,7 @@ // "Create parameter 'foo'" "false" // ACTION: Create local variable 'foo' // ACTION: Create property 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo fun test(n: Int) { diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorInClassObject.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorInClassObject.kt index 40fc81dee95..cf5c520a80b 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorInClassObject.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorInClassObject.kt @@ -2,6 +2,7 @@ // ACTION: Convert to expression body // ACTION: Create local variable 'foo' // ACTION: Create property 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo class A { diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorInObject.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorInObject.kt index 3b8da1a9fec..62aa2b62d05 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorInObject.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorInObject.kt @@ -2,6 +2,7 @@ // ACTION: Convert to expression body // ACTION: Create local variable 'foo' // ACTION: Create property 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo object A { diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorInTrait.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorInTrait.kt index ef859cb03ee..cf2a9eb729a 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorInTrait.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorInTrait.kt @@ -2,6 +2,7 @@ // ACTION: Convert to expression body // ACTION: Create local variable 'foo' // ACTION: Create property 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo interface A { diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorNoClass.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorNoClass.kt index bd101615d38..b7257350f4c 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorNoClass.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inAccessorNoClass.kt @@ -2,6 +2,7 @@ // ACTION: Convert to expression body // ACTION: Create local variable 'foo' // ACTION: Create property 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo val test: Int get() { diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inClassObjectInitializer.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inClassObjectInitializer.kt index 007637315d3..86eaf8f70de 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inClassObjectInitializer.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inClassObjectInitializer.kt @@ -2,6 +2,7 @@ // ACTION: Create local variable 'foo' // ACTION: Create property 'foo' // ACTION: Split property declaration +// ACTION: Rename reference // ERROR: Unresolved reference: foo class A { diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inGenAccessorInClass.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inGenAccessorInClass.kt index 9f79fc57eb1..b7cbd1e3d09 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inGenAccessorInClass.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inGenAccessorInClass.kt @@ -2,6 +2,7 @@ // ACTION: Convert to expression body // ACTION: Create local variable 'foo' // ACTION: Create property 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo class A { diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inGenAccessorInGenClass.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inGenAccessorInGenClass.kt index b5396688ff8..4287402dfaa 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inGenAccessorInGenClass.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inGenAccessorInGenClass.kt @@ -2,6 +2,7 @@ // ACTION: Convert to expression body // ACTION: Create local variable 'foo' // ACTION: Create property 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo class A { diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inPropertyInitializerInClassObject.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inPropertyInitializerInClassObject.kt index dc9b3649593..1f86cc144a2 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inPropertyInitializerInClassObject.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inPropertyInitializerInClassObject.kt @@ -1,5 +1,6 @@ // "Create parameter 'foo'" "false" // ACTION: Create property 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo class A { diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inPropertyInitializerInObject.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inPropertyInitializerInObject.kt index 82981a1bd9b..2dcc26ae408 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inPropertyInitializerInObject.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inPropertyInitializerInObject.kt @@ -1,5 +1,6 @@ // "Create parameter 'foo'" "false" // ACTION: Create property 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo object A { diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inPropertyInitializerNoClass.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inPropertyInitializerNoClass.kt index f000ac58d76..ce789e73881 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/parameter/inPropertyInitializerNoClass.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/inPropertyInitializerNoClass.kt @@ -1,5 +1,6 @@ // "Create parameter 'foo'" "false" // ACTION: Create property 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo val test: Int = foo \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/parameterFromEnumEntryDelegationSpecifier.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/parameterFromEnumEntryDelegationSpecifier.kt index 34c2c851668..4b92beafa7d 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/parameter/parameterFromEnumEntryDelegationSpecifier.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/parameterFromEnumEntryDelegationSpecifier.kt @@ -1,6 +1,7 @@ // "Create parameter 'x'" "false" // ERROR: Unresolved reference: x // ACTION: Create property 'x' +// ACTION: Rename reference enum class E(n: Int) { X(x) diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/parameterFromObjectDelegationSpecifier.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/parameterFromObjectDelegationSpecifier.kt index 12a7e5e340a..a461eac5cb7 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/parameter/parameterFromObjectDelegationSpecifier.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/parameterFromObjectDelegationSpecifier.kt @@ -1,6 +1,7 @@ // "Create parameter 'b'" "false" // ERROR: Unresolved reference: b // ACTION: Create property 'b' +// ACTION: Rename reference open class A(val a: Int) { diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/qualifiedInFun.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/qualifiedInFun.kt index 71b4ba02f21..701f9cbd293 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/parameter/qualifiedInFun.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/qualifiedInFun.kt @@ -2,6 +2,7 @@ // ACTION: Create extension property 'foo' // ACTION: Create member property 'foo' // ACTION: Create property 'foo' as constructor parameter +// ACTION: Rename reference // ERROR: Unresolved reference: foo class A diff --git a/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/localValNoReceiver.kt b/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/localValNoReceiver.kt index 89dbd9c73df..e90820b3086 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/localValNoReceiver.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/localValNoReceiver.kt @@ -2,6 +2,7 @@ // ACTION: Convert to expression body // ACTION: Create parameter 'foo' // ACTION: Create local variable 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo fun test() { diff --git a/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/objectMemberValNoReceiver.kt b/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/objectMemberValNoReceiver.kt index 7130468dff8..49721670948 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/objectMemberValNoReceiver.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/objectMemberValNoReceiver.kt @@ -3,6 +3,7 @@ // ACTION: Create local variable 'foo' // ACTION: Create parameter 'foo' // ACTION: Create property 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo class A { diff --git a/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/staticValOnJavaClass.before.Main.kt b/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/staticValOnJavaClass.before.Main.kt index 245406fc648..4acd046bfa1 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/staticValOnJavaClass.before.Main.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/staticValOnJavaClass.before.Main.kt @@ -1,5 +1,6 @@ // "Create member property 'foo' as constructor parameter" "false" // ACTION: Create member property 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo fun test() { diff --git a/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/topLevelValNoReceiver.kt b/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/topLevelValNoReceiver.kt index f634f28908f..05e46c61def 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/topLevelValNoReceiver.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/topLevelValNoReceiver.kt @@ -3,6 +3,7 @@ // ACTION: Convert to expression body // ACTION: Create local variable 'foo' // ACTION: Create parameter 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo fun test(): Int { diff --git a/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/valOnCompanionObject.kt b/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/valOnCompanionObject.kt index 3e8820e291a..8366c4d1caf 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/valOnCompanionObject.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/valOnCompanionObject.kt @@ -1,6 +1,7 @@ // "Create member property 'foo' as constructor parameter" "false" // ACTION: Create member property 'foo' // ACTION: Create extension property 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo class A(val n: T) { diff --git a/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/valOnJavaType.before.Main.kt b/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/valOnJavaType.before.Main.kt index 95f4584b0a8..9f1f1b46949 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/valOnJavaType.before.Main.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/valOnJavaType.before.Main.kt @@ -2,6 +2,7 @@ // ACTION: Create member property 'foo' // ACTION: Convert to expression body // ACTION: Create extension property 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo fun test(): String? { diff --git a/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/valOnLibType.kt b/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/valOnLibType.kt index b1b040ff90b..3cd42fd4f6d 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/valOnLibType.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/primaryParameter/valOnLibType.kt @@ -1,5 +1,6 @@ // "Create property 'foo' as constructor parameter" "false" // ACTION: Create extension property 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo class A(val n: T) diff --git a/idea/testData/quickfix/createFromUsage/createVariable/property/callOnUserType.kt b/idea/testData/quickfix/createFromUsage/createVariable/property/callOnUserType.kt index b214f1b2c26..fc54387c7c2 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/property/callOnUserType.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/property/callOnUserType.kt @@ -1,6 +1,7 @@ // "Create property 'foo'" "false" // ACTION: Create extension function 'bar' // ACTION: Create member function 'bar' +// ACTION: Rename reference // ERROR: Unresolved reference: bar // ERROR: Unresolved reference: foo diff --git a/idea/testData/quickfix/createFromUsage/createVariable/property/extensionRefInImport.kt b/idea/testData/quickfix/createFromUsage/createVariable/property/extensionRefInImport.kt index 5fa19de30a5..5a5d6a4abcb 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/property/extensionRefInImport.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/property/extensionRefInImport.kt @@ -1,4 +1,5 @@ // "Create extension property 'foo'" "false" +// ACTION: Rename reference // ERROR: Unresolved reference: foo package p diff --git a/idea/testData/quickfix/createFromUsage/createVariable/property/localValNoReceiver.kt b/idea/testData/quickfix/createFromUsage/createVariable/property/localValNoReceiver.kt index 76d544c7dc6..f3bb4d2c1c8 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/property/localValNoReceiver.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/property/localValNoReceiver.kt @@ -2,6 +2,7 @@ // ACTION: Convert to expression body // ACTION: Create parameter 'foo' // ACTION: Create local variable 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo fun test() { diff --git a/idea/testData/quickfix/createFromUsage/createVariable/property/refInImport.kt b/idea/testData/quickfix/createFromUsage/createVariable/property/refInImport.kt index 41db718d3df..3b1c01c9459 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/property/refInImport.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/property/refInImport.kt @@ -1,4 +1,5 @@ // "Create property 'foo'" "false" +// ACTION: Rename reference // ERROR: Unresolved reference: foo package p diff --git a/idea/testData/quickfix/createFromUsage/createVariable/property/staticExtensionValOnJavaType.before.Main.kt b/idea/testData/quickfix/createFromUsage/createVariable/property/staticExtensionValOnJavaType.before.Main.kt index 87dd72af802..ac6ede148bf 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/property/staticExtensionValOnJavaType.before.Main.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/property/staticExtensionValOnJavaType.before.Main.kt @@ -1,5 +1,6 @@ // "Create extension property 'foo'" "false" // ACTION: Create member property 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo fun test() { diff --git a/idea/testData/quickfix/createFromUsage/createVariable/property/staticVarOnJavaInterface.before.Main.kt b/idea/testData/quickfix/createFromUsage/createVariable/property/staticVarOnJavaInterface.before.Main.kt index 7db2f839ebb..854e4696c57 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/property/staticVarOnJavaInterface.before.Main.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/property/staticVarOnJavaInterface.before.Main.kt @@ -1,4 +1,5 @@ // "Create property 'foo'" "false" +// ACTION: Rename reference // ERROR: Unresolved reference: foo fun test() { diff --git a/idea/testData/quickfix/createFromUsage/createVariable/property/valOnClassNoClassObject.kt b/idea/testData/quickfix/createFromUsage/createVariable/property/valOnClassNoClassObject.kt index d1f1c02614a..74281f9ccd6 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/property/valOnClassNoClassObject.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/property/valOnClassNoClassObject.kt @@ -1,4 +1,5 @@ // "Create property 'foo'" "false" +// ACTION: Rename reference // ERROR: Unresolved reference: foo class A(val n: T) diff --git a/idea/testData/quickfix/createFromUsage/createVariable/property/valOnGroovyType.before.Main.kt b/idea/testData/quickfix/createFromUsage/createVariable/property/valOnGroovyType.before.Main.kt index 4d4a60331df..ee4d826b791 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/property/valOnGroovyType.before.Main.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/property/valOnGroovyType.before.Main.kt @@ -1,6 +1,7 @@ // "Create property 'foo'" "false" // ACTION: Convert to expression body // ACTION: Create extension property 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo fun test(): String? { 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 cb8c48d5b0d..b1fc074d90e 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/property/valOnJavaInterface.before.Main.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/property/valOnJavaInterface.before.Main.kt @@ -1,6 +1,7 @@ // "Create property 'foo'" "false" // ACTION: Convert to expression body // ACTION: Create extension property 'foo' +// ACTION: Rename reference // ERROR: Unresolved reference: foo internal fun test(a: A): String? { diff --git a/idea/testData/quickfix/renameUnresolvedReference/qualifiedFunRef.kt b/idea/testData/quickfix/renameUnresolvedReference/qualifiedFunRef.kt new file mode 100644 index 00000000000..ba2cc3aec8f --- /dev/null +++ b/idea/testData/quickfix/renameUnresolvedReference/qualifiedFunRef.kt @@ -0,0 +1,33 @@ +// "Rename reference" "true" +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +class A { + fun f() = 1 + fun g() = "" +} + +class B + +fun bar(i: Int) { + +} + +fun baz(i: Int) { + +} + +fun foo(a: A, b: B) { + val aa = A() + bar(a.x) + baz(a.x) + bar(a.x()) + baz(a.x()) + bar(a.x(1)) + baz(a.x(1)) + bar(aa.x()) + bar(b.x()) +} \ No newline at end of file diff --git a/idea/testData/quickfix/renameUnresolvedReference/qualifiedFunRef.kt.after b/idea/testData/quickfix/renameUnresolvedReference/qualifiedFunRef.kt.after new file mode 100644 index 00000000000..76bdb49c580 --- /dev/null +++ b/idea/testData/quickfix/renameUnresolvedReference/qualifiedFunRef.kt.after @@ -0,0 +1,33 @@ +// "Rename reference" "true" +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +class A { + fun f() = 1 + fun g() = "" +} + +class B + +fun bar(i: Int) { + +} + +fun baz(i: Int) { + +} + +fun foo(a: A, b: B) { + val aa = A() + bar(a.x) + baz(a.x) + bar(a.f()) + baz(a.f()) + bar(a.x(1)) + baz(a.x(1)) + bar(aa.x()) + bar(b.x()) +} \ No newline at end of file diff --git a/idea/testData/quickfix/renameUnresolvedReference/qualifiedPropertyRef.kt b/idea/testData/quickfix/renameUnresolvedReference/qualifiedPropertyRef.kt new file mode 100644 index 00000000000..38f1ca55ea2 --- /dev/null +++ b/idea/testData/quickfix/renameUnresolvedReference/qualifiedPropertyRef.kt @@ -0,0 +1,29 @@ +// "Rename reference" "true" +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +class A { + val a = 1 + val s = "" +} + +class B + +fun bar(i: Int) { + +} + +fun baz(i: Int) { + +} + +fun foo(a: A, b: B) { + val aa = A() + bar(a.x) + baz(a.x) + bar(a.x()) + baz(a.x(1)) + bar(aa.x) + bar(b.x) +} \ No newline at end of file diff --git a/idea/testData/quickfix/renameUnresolvedReference/qualifiedPropertyRef.kt.after b/idea/testData/quickfix/renameUnresolvedReference/qualifiedPropertyRef.kt.after new file mode 100644 index 00000000000..90d089fa358 --- /dev/null +++ b/idea/testData/quickfix/renameUnresolvedReference/qualifiedPropertyRef.kt.after @@ -0,0 +1,29 @@ +// "Rename reference" "true" +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +class A { + val a = 1 + val s = "" +} + +class B + +fun bar(i: Int) { + +} + +fun baz(i: Int) { + +} + +fun foo(a: A, b: B) { + val aa = A() + bar(a.a) + baz(a.a) + bar(a.x()) + baz(a.x(1)) + bar(aa.x) + bar(b.x) +} \ No newline at end of file diff --git a/idea/testData/quickfix/renameUnresolvedReference/typeRef.kt b/idea/testData/quickfix/renameUnresolvedReference/typeRef.kt new file mode 100644 index 00000000000..420b2e10dfc --- /dev/null +++ b/idea/testData/quickfix/renameUnresolvedReference/typeRef.kt @@ -0,0 +1,18 @@ +// "Rename reference" "false" +// ACTION: Create annotation 'X' +// ACTION: Create class 'X' +// ACTION: Create enum 'X' +// ACTION: Create interface 'X' +// ERROR: Unresolved reference: X +// ERROR: Unresolved reference: X +class A { + class B + + fun foo() { + + } +} + +fun test(x: A.X) { + val t: A.X +} \ No newline at end of file diff --git a/idea/testData/quickfix/renameUnresolvedReference/unqualifiedFunRef.kt b/idea/testData/quickfix/renameUnresolvedReference/unqualifiedFunRef.kt new file mode 100644 index 00000000000..1e633e3b516 --- /dev/null +++ b/idea/testData/quickfix/renameUnresolvedReference/unqualifiedFunRef.kt @@ -0,0 +1,26 @@ +// "Rename reference" "true" +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +class A { + fun f() = 1 + fun g() = "" + + fun bar(i: Int) { + + } + + fun baz(i: Int) { + + } + + fun foo() { + bar(x) + baz(x) + bar(x()) + baz(x()) + bar(x(1)) + baz(x(1)) + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/renameUnresolvedReference/unqualifiedFunRef.kt.after b/idea/testData/quickfix/renameUnresolvedReference/unqualifiedFunRef.kt.after new file mode 100644 index 00000000000..9b07df576b9 --- /dev/null +++ b/idea/testData/quickfix/renameUnresolvedReference/unqualifiedFunRef.kt.after @@ -0,0 +1,26 @@ +// "Rename reference" "true" +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +class A { + fun f() = 1 + fun g() = "" + + fun bar(i: Int) { + + } + + fun baz(i: Int) { + + } + + fun foo() { + bar(x) + baz(x) + bar(f()) + baz(f()) + bar(x(1)) + baz(x(1)) + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/renameUnresolvedReference/unqualifiedPropertyRef.kt b/idea/testData/quickfix/renameUnresolvedReference/unqualifiedPropertyRef.kt new file mode 100644 index 00000000000..16cd0b1519d --- /dev/null +++ b/idea/testData/quickfix/renameUnresolvedReference/unqualifiedPropertyRef.kt @@ -0,0 +1,22 @@ +// "Rename reference" "true" +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +class A { + val a = 1 + val s = "" + + fun bar(i: Int) { + + } + + fun baz(i: Int) { + + } + + fun foo() { + bar(x) + baz(x) + bar(x()) + baz(x(1)) + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/renameUnresolvedReference/unqualifiedPropertyRef.kt.after b/idea/testData/quickfix/renameUnresolvedReference/unqualifiedPropertyRef.kt.after new file mode 100644 index 00000000000..91e8906dc7c --- /dev/null +++ b/idea/testData/quickfix/renameUnresolvedReference/unqualifiedPropertyRef.kt.after @@ -0,0 +1,22 @@ +// "Rename reference" "true" +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +class A { + val a = 1 + val s = "" + + fun bar(i: Int) { + + } + + fun baz(i: Int) { + + } + + fun foo() { + bar(a) + baz(a) + bar(x()) + baz(x(1)) + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/renameUnresolvedReference/unqualifiedPropertyRefWithPackageError.kt b/idea/testData/quickfix/renameUnresolvedReference/unqualifiedPropertyRefWithPackageError.kt new file mode 100644 index 00000000000..9cfb31ac83e --- /dev/null +++ b/idea/testData/quickfix/renameUnresolvedReference/unqualifiedPropertyRefWithPackageError.kt @@ -0,0 +1,24 @@ +// "Rename reference" "true" +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +package x + +class A { + val a = 1 + val s = "" + + fun bar(i: Int) { + + } + + fun baz(i: Int) { + + } + + fun foo() { + bar(x) + baz(x) + bar(x()) + baz(x(1)) + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/renameUnresolvedReference/unqualifiedPropertyRefWithPackageError.kt.after b/idea/testData/quickfix/renameUnresolvedReference/unqualifiedPropertyRefWithPackageError.kt.after new file mode 100644 index 00000000000..852a90fa15a --- /dev/null +++ b/idea/testData/quickfix/renameUnresolvedReference/unqualifiedPropertyRefWithPackageError.kt.after @@ -0,0 +1,24 @@ +// "Rename reference" "true" +// ERROR: Unresolved reference: x +// ERROR: Unresolved reference: x +package x + +class A { + val a = 1 + val s = "" + + fun bar(i: Int) { + + } + + fun baz(i: Int) { + + } + + fun foo() { + bar(a) + baz(a) + bar(x()) + baz(x(1)) + } +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java index adc52b014bc..fff2effa529 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java @@ -5758,6 +5758,51 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { } } + @TestMetadata("idea/testData/quickfix/renameUnresolvedReference") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class RenameUnresolvedReference extends AbstractQuickFixTest { + public void testAllFilesPresentInRenameUnresolvedReference() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/renameUnresolvedReference"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), true); + } + + @TestMetadata("qualifiedFunRef.kt") + public void testQualifiedFunRef() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/renameUnresolvedReference/qualifiedFunRef.kt"); + doTest(fileName); + } + + @TestMetadata("qualifiedPropertyRef.kt") + public void testQualifiedPropertyRef() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/renameUnresolvedReference/qualifiedPropertyRef.kt"); + doTest(fileName); + } + + @TestMetadata("typeRef.kt") + public void testTypeRef() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/renameUnresolvedReference/typeRef.kt"); + doTest(fileName); + } + + @TestMetadata("unqualifiedFunRef.kt") + public void testUnqualifiedFunRef() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/renameUnresolvedReference/unqualifiedFunRef.kt"); + doTest(fileName); + } + + @TestMetadata("unqualifiedPropertyRef.kt") + public void testUnqualifiedPropertyRef() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/renameUnresolvedReference/unqualifiedPropertyRef.kt"); + doTest(fileName); + } + + @TestMetadata("unqualifiedPropertyRefWithPackageError.kt") + public void testUnqualifiedPropertyRefWithPackageError() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/renameUnresolvedReference/unqualifiedPropertyRefWithPackageError.kt"); + doTest(fileName); + } + } + @TestMetadata("idea/testData/quickfix/supercalls") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)