From f2bb6e4dacf3c839abe44c986ede8083fa542134 Mon Sep 17 00:00:00 2001 From: Alexey Sedunov Date: Tue, 25 Apr 2017 20:27:58 +0300 Subject: [PATCH] Rename: Support import aliases #KT-4379 Fixed --- .../org/jetbrains/kotlin/psi/KtImportAlias.kt | 9 ++++++ .../idea/references/KtSimpleNameReference.kt | 17 +++++++++++ .../kotlin/idea/references/referenceUtil.kt | 28 ++++++++++++----- idea/src/META-INF/plugin.xml | 1 + .../KotlinElementDescriptionProvider.kt | 1 + .../findUsages/KotlinFindUsagesProvider.kt | 1 + .../KotlinRefactoringSupportProvider.kt | 2 +- .../RenameImportAliasByReferenceHandler.kt | 30 +++++++++++++++++++ .../KotlinTargetElementEvaluator.kt | 10 +++++-- .../rename/importAlias/after/Foo.kt | 3 ++ .../rename/importAlias/after/test.kt | 5 ++++ .../rename/importAlias/before/Foo.kt | 3 ++ .../rename/importAlias/before/test.kt | 5 ++++ .../rename/importAlias/importAlias.test | 5 ++++ .../rename/importAliasByRef/after/Foo.kt | 3 ++ .../rename/importAliasByRef/after/test.kt | 5 ++++ .../rename/importAliasByRef/before/Foo.kt | 3 ++ .../rename/importAliasByRef/before/test.kt | 5 ++++ .../importAliasByRef/importAliasByRef.test | 5 ++++ idea/testData/usageHighlighter/importAlias.kt | 7 +++++ .../UsageHighlightingTestGenerated.java | 6 ++++ .../rename/RenameTestGenerated.java | 12 ++++++++ 22 files changed, 156 insertions(+), 10 deletions(-) create mode 100644 idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameImportAliasByReferenceHandler.kt create mode 100644 idea/testData/refactoring/rename/importAlias/after/Foo.kt create mode 100644 idea/testData/refactoring/rename/importAlias/after/test.kt create mode 100644 idea/testData/refactoring/rename/importAlias/before/Foo.kt create mode 100644 idea/testData/refactoring/rename/importAlias/before/test.kt create mode 100644 idea/testData/refactoring/rename/importAlias/importAlias.test create mode 100644 idea/testData/refactoring/rename/importAliasByRef/after/Foo.kt create mode 100644 idea/testData/refactoring/rename/importAliasByRef/after/test.kt create mode 100644 idea/testData/refactoring/rename/importAliasByRef/before/Foo.kt create mode 100644 idea/testData/refactoring/rename/importAliasByRef/before/test.kt create mode 100644 idea/testData/refactoring/rename/importAliasByRef/importAliasByRef.test create mode 100644 idea/testData/usageHighlighter/importAlias.kt diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtImportAlias.kt b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtImportAlias.kt index bbbd206fd8c..3f78de63db5 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtImportAlias.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtImportAlias.kt @@ -19,7 +19,9 @@ package org.jetbrains.kotlin.psi import com.intellij.lang.ASTNode import com.intellij.psi.PsiElement import com.intellij.psi.PsiNameIdentifierOwner +import com.intellij.psi.search.LocalSearchScope import org.jetbrains.kotlin.lexer.KtTokens +import org.jetbrains.kotlin.psi.psiUtil.startOffset import org.jetbrains.kotlin.psi.stubs.KotlinImportAliasStub import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes @@ -31,6 +33,9 @@ class KtImportAlias : KtElementImplStub, PsiNameIdentifie return visitor.visitImportAlias(this, data) } + val importDirective: KtImportDirective? + get() = parent as? KtImportDirective + override fun getName() = stub?.getName() ?: nameIdentifier?.text override fun setName(name: String): PsiElement { @@ -39,4 +44,8 @@ class KtImportAlias : KtElementImplStub, PsiNameIdentifie } override fun getNameIdentifier(): PsiElement? = findChildByType(KtTokens.IDENTIFIER) + + override fun getTextOffset() = nameIdentifier?.textOffset ?: startOffset + + override fun getUseScope() = LocalSearchScope(containingFile) } \ No newline at end of file diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/references/KtSimpleNameReference.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/references/KtSimpleNameReference.kt index 0ff562164e2..7356f90d235 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/references/KtSimpleNameReference.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/references/KtSimpleNameReference.kt @@ -23,6 +23,8 @@ import com.intellij.psi.util.PsiTreeUtil import com.intellij.util.IncorrectOperationException import com.intellij.util.SmartList import org.jetbrains.kotlin.descriptors.DeclarationDescriptor +import org.jetbrains.kotlin.idea.caches.resolve.analyze +import org.jetbrains.kotlin.idea.caches.resolve.resolveImportReference import org.jetbrains.kotlin.idea.codeInsight.shorten.addToShorteningWaitSet import org.jetbrains.kotlin.idea.core.ShortenReferences import org.jetbrains.kotlin.idea.core.copied @@ -43,6 +45,8 @@ import org.jetbrains.kotlin.psi.psiUtil.getQualifiedElementSelector import org.jetbrains.kotlin.psi.psiUtil.startOffset import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.DataClassDescriptorResolver +import org.jetbrains.kotlin.resolve.descriptorUtil.getImportableDescriptor +import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode import org.jetbrains.kotlin.types.expressions.OperatorConventions class KtSimpleNameReference(expression: KtSimpleNameExpression) : KtSimpleReference(expression) { @@ -235,4 +239,17 @@ class KtSimpleNameReference(expression: KtSimpleNameExpression) : KtSimpleRefere return listOf(element.getReferencedNameAsName()) } + + fun getImportAlias(): KtImportAlias? { + val element = element + val name = element.getReferencedName() + val file = element.containingKtFile + val importDirective = file.findImportByAlias(name) ?: return null + val fqName = importDirective.importedFqName ?: return null + val importedDescriptors = file.resolveImportReference(fqName) + if (getTargetDescriptors(element.analyze(BodyResolveMode.PARTIAL)).any { it.getImportableDescriptor() in importedDescriptors }) { + return importDirective.alias + } + return null + } } diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/references/referenceUtil.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/references/referenceUtil.kt index cdad154089d..c59304ccea6 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/references/referenceUtil.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/references/referenceUtil.kt @@ -20,8 +20,11 @@ import com.intellij.psi.* import org.jetbrains.kotlin.asJava.unwrapped import org.jetbrains.kotlin.builtins.isExtensionFunctionType import org.jetbrains.kotlin.descriptors.DeclarationDescriptor +import org.jetbrains.kotlin.descriptors.DeclarationDescriptorWithSource import org.jetbrains.kotlin.descriptors.PropertyDescriptor import org.jetbrains.kotlin.idea.caches.resolve.analyze +import org.jetbrains.kotlin.idea.caches.resolve.resolveImportReference +import org.jetbrains.kotlin.idea.codeInsight.DescriptorToSourceUtilsIde import org.jetbrains.kotlin.idea.imports.canBeReferencedViaImport import org.jetbrains.kotlin.idea.intentions.OperatorToFunctionIntention import org.jetbrains.kotlin.idea.kdoc.KDocReference @@ -35,6 +38,7 @@ import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall import org.jetbrains.kotlin.resolve.calls.model.isReallySuccess import org.jetbrains.kotlin.resolve.descriptorUtil.isExtension import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode +import org.jetbrains.kotlin.resolve.source.getPsi import org.jetbrains.kotlin.types.expressions.OperatorConventions import org.jetbrains.kotlin.util.OperatorNameConventions import org.jetbrains.kotlin.utils.addToStdlib.constant @@ -88,18 +92,22 @@ fun PsiReference.matchesTarget(candidateTarget: PsiElement): Boolean { } } - val targets = unwrappedTargets + val element = element - val manager = candidateTarget.manager - if (targets.any { manager.areElementsEquivalent(unwrappedCandidate, it) }) { - return true + if (candidateTarget is KtImportAlias && element is KtSimpleNameExpression && element.getReferencedName() == candidateTarget.name) { + val importDirective = candidateTarget.importDirective ?: return false + val importedFqName = importDirective.importedFqName ?: return false + val importedDescriptors = importDirective.containingKtFile.resolveImportReference(importedFqName) + val importableTargets = unwrappedTargets.mapNotNull { + if (it is KtConstructor<*>) it.containingClassOrObject else it + } + return importedDescriptors.any { (it as? DeclarationDescriptorWithSource)?.source?.getPsi() in importableTargets } } - val element = element if (element is KtLabelReferenceExpression) { val labelParent = (element.parent as? KtContainerNode)?.parent when (labelParent) { - is KtReturnExpression -> targets.forEach { + is KtReturnExpression -> unwrappedTargets.forEach { if (it !is KtFunctionLiteral && !(it is KtNamedFunction && it.name.isNullOrEmpty())) return@forEach it as KtFunction @@ -110,13 +118,19 @@ fun PsiReference.matchesTarget(candidateTarget: PsiElement): Boolean { val calleeReference = it.getCalleeByLambdaArgument()?.mainReference ?: return@forEach if (calleeReference.matchesTarget(candidateTarget)) return true } - is KtBreakExpression, is KtContinueExpression -> targets.forEach { + is KtBreakExpression, is KtContinueExpression -> unwrappedTargets.forEach { val labeledExpression = (it as? KtExpression)?.getLabeledParent(element.getReferencedName()) ?: return@forEach if (candidateTarget == labeledExpression) return true } } } + val targets = unwrappedTargets + val manager = candidateTarget.manager + if (targets.any { manager.areElementsEquivalent(unwrappedCandidate, it) }) { + return true + } + if (this is KtReference) { return targets.any { it.isConstructorOf(unwrappedCandidate) diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index a249e905ec3..c7389765a62 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -498,6 +498,7 @@ + diff --git a/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinElementDescriptionProvider.kt b/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinElementDescriptionProvider.kt index 94092398016..68df81c9868 100644 --- a/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinElementDescriptionProvider.kt +++ b/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinElementDescriptionProvider.kt @@ -125,6 +125,7 @@ class KotlinElementDescriptionProvider : ElementDescriptionProvider { is KtDestructuringDeclarationEntry -> "variable" is KtTypeAlias -> "type alias" is KtLabeledExpression -> "label" + is KtImportAlias -> "import alias" is RenameJavaSyntheticPropertyHandler.SyntheticPropertyWrapper -> "property" is KtLightClassForFacade -> "facade class" is RenameKotlinPropertyProcessor.PropertyMethodWrapper -> "property accessor" diff --git a/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinFindUsagesProvider.kt b/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinFindUsagesProvider.kt index bf504086b2d..ee082dd296e 100644 --- a/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinFindUsagesProvider.kt +++ b/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinFindUsagesProvider.kt @@ -80,6 +80,7 @@ class KotlinFindUsagesProvider : FindUsagesProvider { return funDescription + (element.containerDescription?.let { " of $it" } ?: "") } is KtLabeledExpression -> element.getLabelName() ?: "" + is KtImportAlias -> element.getName() ?: "" is KtLightElement<*, *> -> element.kotlinOrigin?.let { getDescriptiveName(it) } ?: "" else -> "" } diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/KotlinRefactoringSupportProvider.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/KotlinRefactoringSupportProvider.kt index b8b296b4ffb..ee3e39db354 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/KotlinRefactoringSupportProvider.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/KotlinRefactoringSupportProvider.kt @@ -71,7 +71,7 @@ class KotlinRefactoringSupportProvider : RefactoringSupportProvider() { return grandparent is KtCatchClause || grandparent is KtFunctionLiteral } } - is KtLabeledExpression -> return true + is KtLabeledExpression, is KtImportAlias -> return true } return false } diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameImportAliasByReferenceHandler.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameImportAliasByReferenceHandler.kt new file mode 100644 index 00000000000..8d8997e8ca1 --- /dev/null +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameImportAliasByReferenceHandler.kt @@ -0,0 +1,30 @@ +/* + * Copyright 2010-2017 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.refactoring.rename + +import com.intellij.openapi.actionSystem.DataContext +import com.intellij.psi.PsiElement +import com.intellij.refactoring.rename.inplace.VariableInplaceRenameHandler +import org.jetbrains.kotlin.idea.references.mainReference +import org.jetbrains.kotlin.psi.KtSimpleNameExpression + +class RenameImportAliasByReferenceHandler : AbstractReferenceSubstitutionRenameHandler(VariableInplaceRenameHandler()) { + override fun getElementToRename(dataContext: DataContext): PsiElement? { + val refExpr = getReferenceExpression(dataContext) as? KtSimpleNameExpression ?: return null + return refExpr.mainReference.getImportAlias() + } +} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinTargetElementEvaluator.kt b/idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinTargetElementEvaluator.kt index f73cee7b8ef..133d9d963e9 100644 --- a/idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinTargetElementEvaluator.kt +++ b/idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinTargetElementEvaluator.kt @@ -29,6 +29,7 @@ import org.jetbrains.kotlin.descriptors.DeclarationDescriptorWithSource import org.jetbrains.kotlin.idea.intentions.isAutoCreatedItUsage import org.jetbrains.kotlin.idea.references.KtDestructuringDeclarationReference import org.jetbrains.kotlin.idea.references.KtSimpleNameReference +import org.jetbrains.kotlin.idea.references.mainReference import org.jetbrains.kotlin.idea.references.resolveMainReferenceToDescriptors import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.* @@ -38,6 +39,7 @@ import org.jetbrains.kotlin.resolve.source.getPsi class KotlinTargetElementEvaluator : TargetElementEvaluatorEx, TargetElementUtilExtender { companion object { val DO_NOT_UNWRAP_LABELED_EXPRESSION = 0x100 + val BYPASS_IMPORT_ALIAS = 0x200 // Place caret after the open curly brace in lambda for generated 'it' fun findLambdaOpenLBraceForGeneratedIt(ref: PsiReference): PsiElement? { @@ -69,9 +71,9 @@ class KotlinTargetElementEvaluator : TargetElementEvaluatorEx, TargetElementUtil override fun getAdditionalDefinitionSearchFlags() = 0 - override fun getAdditionalReferenceSearchFlags() = DO_NOT_UNWRAP_LABELED_EXPRESSION + override fun getAdditionalReferenceSearchFlags() = DO_NOT_UNWRAP_LABELED_EXPRESSION or BYPASS_IMPORT_ALIAS - override fun getAllAdditionalFlags() = DO_NOT_UNWRAP_LABELED_EXPRESSION + override fun getAllAdditionalFlags() = additionalDefinitionSearchFlags + additionalReferenceSearchFlags override fun includeSelfInGotoImplementation(element: PsiElement): Boolean = !(element is KtClass && element.isAbstract()) @@ -84,6 +86,10 @@ class KotlinTargetElementEvaluator : TargetElementEvaluatorEx, TargetElementUtil return refTarget } + if (!BitUtil.isSet(flags, BYPASS_IMPORT_ALIAS)) { + (ref.element as? KtSimpleNameExpression)?.mainReference?.getImportAlias()?.let { return it } + } + // prefer destructing declaration entry to its target if element name is accepted if (ref is KtDestructuringDeclarationReference && BitUtil.isSet(flags, TargetElementUtil.ELEMENT_NAME_ACCEPTED)) { return ref.element diff --git a/idea/testData/refactoring/rename/importAlias/after/Foo.kt b/idea/testData/refactoring/rename/importAlias/after/Foo.kt new file mode 100644 index 00000000000..f4c5585faad --- /dev/null +++ b/idea/testData/refactoring/rename/importAlias/after/Foo.kt @@ -0,0 +1,3 @@ +package foo + +class Foo \ No newline at end of file diff --git a/idea/testData/refactoring/rename/importAlias/after/test.kt b/idea/testData/refactoring/rename/importAlias/after/test.kt new file mode 100644 index 00000000000..fdca3c2b43f --- /dev/null +++ b/idea/testData/refactoring/rename/importAlias/after/test.kt @@ -0,0 +1,5 @@ +import foo.Foo as Baz + +fun test() { + val bar: Baz = Baz() +} \ No newline at end of file diff --git a/idea/testData/refactoring/rename/importAlias/before/Foo.kt b/idea/testData/refactoring/rename/importAlias/before/Foo.kt new file mode 100644 index 00000000000..f4c5585faad --- /dev/null +++ b/idea/testData/refactoring/rename/importAlias/before/Foo.kt @@ -0,0 +1,3 @@ +package foo + +class Foo \ No newline at end of file diff --git a/idea/testData/refactoring/rename/importAlias/before/test.kt b/idea/testData/refactoring/rename/importAlias/before/test.kt new file mode 100644 index 00000000000..d77022920e6 --- /dev/null +++ b/idea/testData/refactoring/rename/importAlias/before/test.kt @@ -0,0 +1,5 @@ +import foo.Foo as /*rename*/Bar + +fun test() { + val bar: Bar = Bar() +} \ No newline at end of file diff --git a/idea/testData/refactoring/rename/importAlias/importAlias.test b/idea/testData/refactoring/rename/importAlias/importAlias.test new file mode 100644 index 00000000000..fae0e39d66e --- /dev/null +++ b/idea/testData/refactoring/rename/importAlias/importAlias.test @@ -0,0 +1,5 @@ +{ + "type": "MARKED_ELEMENT", + "mainFile": "test.kt", + "newName": "Baz" +} \ No newline at end of file diff --git a/idea/testData/refactoring/rename/importAliasByRef/after/Foo.kt b/idea/testData/refactoring/rename/importAliasByRef/after/Foo.kt new file mode 100644 index 00000000000..f4c5585faad --- /dev/null +++ b/idea/testData/refactoring/rename/importAliasByRef/after/Foo.kt @@ -0,0 +1,3 @@ +package foo + +class Foo \ No newline at end of file diff --git a/idea/testData/refactoring/rename/importAliasByRef/after/test.kt b/idea/testData/refactoring/rename/importAliasByRef/after/test.kt new file mode 100644 index 00000000000..fdca3c2b43f --- /dev/null +++ b/idea/testData/refactoring/rename/importAliasByRef/after/test.kt @@ -0,0 +1,5 @@ +import foo.Foo as Baz + +fun test() { + val bar: Baz = Baz() +} \ No newline at end of file diff --git a/idea/testData/refactoring/rename/importAliasByRef/before/Foo.kt b/idea/testData/refactoring/rename/importAliasByRef/before/Foo.kt new file mode 100644 index 00000000000..f4c5585faad --- /dev/null +++ b/idea/testData/refactoring/rename/importAliasByRef/before/Foo.kt @@ -0,0 +1,3 @@ +package foo + +class Foo \ No newline at end of file diff --git a/idea/testData/refactoring/rename/importAliasByRef/before/test.kt b/idea/testData/refactoring/rename/importAliasByRef/before/test.kt new file mode 100644 index 00000000000..827945a3f47 --- /dev/null +++ b/idea/testData/refactoring/rename/importAliasByRef/before/test.kt @@ -0,0 +1,5 @@ +import foo.Foo as Bar + +fun test() { + val bar: /*rename*/Bar = Bar() +} \ No newline at end of file diff --git a/idea/testData/refactoring/rename/importAliasByRef/importAliasByRef.test b/idea/testData/refactoring/rename/importAliasByRef/importAliasByRef.test new file mode 100644 index 00000000000..11866799bf6 --- /dev/null +++ b/idea/testData/refactoring/rename/importAliasByRef/importAliasByRef.test @@ -0,0 +1,5 @@ +{ + "type": "AUTO_DETECT", + "mainFile": "test.kt", + "newName": "Baz" +} \ No newline at end of file diff --git a/idea/testData/usageHighlighter/importAlias.kt b/idea/testData/usageHighlighter/importAlias.kt new file mode 100644 index 00000000000..7b4e58b4725 --- /dev/null +++ b/idea/testData/usageHighlighter/importAlias.kt @@ -0,0 +1,7 @@ +import Foo as ~Bar + +class Foo + +fun test() { + val bar: Bar = Bar() +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/highlighter/UsageHighlightingTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/highlighter/UsageHighlightingTestGenerated.java index 87f05a87bd5..7ca6a151d1f 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/highlighter/UsageHighlightingTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/highlighter/UsageHighlightingTestGenerated.java @@ -36,6 +36,12 @@ public class UsageHighlightingTestGenerated extends AbstractUsageHighlightingTes KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/usageHighlighter"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); } + @TestMetadata("importAlias.kt") + public void testImportAlias() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/usageHighlighter/importAlias.kt"); + doTest(fileName); + } + @TestMetadata("labeledAnonymousFun.kt") public void testLabeledAnonymousFun() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/usageHighlighter/labeledAnonymousFun.kt"); diff --git a/idea/tests/org/jetbrains/kotlin/idea/refactoring/rename/RenameTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/refactoring/rename/RenameTestGenerated.java index 76f9e90a48a..321ed0621db 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/refactoring/rename/RenameTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/refactoring/rename/RenameTestGenerated.java @@ -204,6 +204,18 @@ public class RenameTestGenerated extends AbstractRenameTest { doTest(fileName); } + @TestMetadata("importAlias/importAlias.test") + public void testImportAlias_ImportAlias() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/rename/importAlias/importAlias.test"); + doTest(fileName); + } + + @TestMetadata("importAliasByRef/importAliasByRef.test") + public void testImportAliasByRef_ImportAliasByRef() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/rename/importAliasByRef/importAliasByRef.test"); + doTest(fileName); + } + @TestMetadata("labeledAnonymousFunByLabel/labeledLambdaByLabel.test") public void testLabeledAnonymousFunByLabel_LabeledLambdaByLabel() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/rename/labeledAnonymousFunByLabel/labeledLambdaByLabel.test");