Move: Fix lengthening of qualified type references
KT-14519 Fixed
This commit is contained in:
@@ -190,6 +190,16 @@ class KtSimpleNameReference(expression: KtSimpleNameExpression) : KtSimpleRefere
|
|||||||
val shortName = fqName.shortName().asString()
|
val shortName = fqName.shortName().asString()
|
||||||
val psiFactory = KtPsiFactory(this)
|
val psiFactory = KtPsiFactory(this)
|
||||||
val parent = parent
|
val parent = parent
|
||||||
|
|
||||||
|
if (parent is KtUserType && !fqName.isOneSegmentFQN()) {
|
||||||
|
val qualifier = parent.qualifier
|
||||||
|
val qualifierReference = qualifier?.referenceExpression as? KtNameReferenceExpression
|
||||||
|
if (qualifierReference != null && qualifier.typeArguments.isNotEmpty()) {
|
||||||
|
qualifierReference.changeQualifiedName(fqName.parent())
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var parentDelimiter = "."
|
var parentDelimiter = "."
|
||||||
val fqNameBase = when {
|
val fqNameBase = when {
|
||||||
parent is KtCallElement -> {
|
parent is KtCallElement -> {
|
||||||
|
|||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
package target
|
||||||
|
|
||||||
|
class OuterClass<T1> {
|
||||||
|
inner class InnerClass<T2>
|
||||||
|
|
||||||
|
class NestedClass<T3>
|
||||||
|
typealias NestedType<T> = NestedClass<T>
|
||||||
|
}
|
||||||
|
typealias OI<T1, T2> = OuterClass<T1>.InnerClass<T2> // (1)
|
||||||
|
typealias ON1<T1, T2> = OuterClass<T1>.NestedClass<T2> // (2)
|
||||||
|
typealias ON2<T1, T2> = OuterClass<T1>.NestedType<T2>
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
package source
|
||||||
|
|
||||||
|
class OuterClass<T1> {
|
||||||
|
inner class InnerClass<T2>
|
||||||
|
|
||||||
|
class NestedClass<T3>
|
||||||
|
typealias NestedType<T> = NestedClass<T>
|
||||||
|
}
|
||||||
|
typealias OI<T1, T2> = OuterClass<T1>.InnerClass<T2> // (1)
|
||||||
|
typealias ON1<T1, T2> = OuterClass<T1>.NestedClass<T2> // (2)
|
||||||
|
typealias ON2<T1, T2> = OuterClass<T1>.NestedType<T2>
|
||||||
Vendored
Vendored
+5
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"mainFile": "source/Foo.kt",
|
||||||
|
"type": "MOVE_FILES",
|
||||||
|
"targetPackage": "target"
|
||||||
|
}
|
||||||
@@ -307,6 +307,12 @@ public class MoveTestGenerated extends AbstractMoveTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kotlin/moveFile/typeRefWithArguments/typeRefWithArguments.test")
|
||||||
|
public void testKotlin_moveFile_typeRefWithArguments_TypeRefWithArguments() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/move/kotlin/moveFile/typeRefWithArguments/typeRefWithArguments.test");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kotlin/moveNestedClass/deepInnerToTopLevelWithOuterOuterThis/deepInnerToTopLevelWithOuterOuterThis.test")
|
@TestMetadata("kotlin/moveNestedClass/deepInnerToTopLevelWithOuterOuterThis/deepInnerToTopLevelWithOuterOuterThis.test")
|
||||||
public void testKotlin_moveNestedClass_deepInnerToTopLevelWithOuterOuterThis_DeepInnerToTopLevelWithOuterOuterThis() throws Exception {
|
public void testKotlin_moveNestedClass_deepInnerToTopLevelWithOuterOuterThis_DeepInnerToTopLevelWithOuterOuterThis() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/move/kotlin/moveNestedClass/deepInnerToTopLevelWithOuterOuterThis/deepInnerToTopLevelWithOuterOuterThis.test");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/move/kotlin/moveNestedClass/deepInnerToTopLevelWithOuterOuterThis/deepInnerToTopLevelWithOuterOuterThis.test");
|
||||||
|
|||||||
Reference in New Issue
Block a user