Rename: Implement Rename conflict analysis for classes. Qualify class references to resove rename conflicts when possible
#KT-8611 Fixed #KT-8562 Fixed (cherry picked from commit 8989ccc)
This commit is contained in:
+9
@@ -0,0 +1,9 @@
|
||||
package test
|
||||
|
||||
class A {
|
||||
class A {
|
||||
class C {
|
||||
val a: A = A()
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package test
|
||||
|
||||
class A {
|
||||
class /*rename*/B {
|
||||
class C {
|
||||
val b: B = B()
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"type": "MARKED_ELEMENT",
|
||||
"mainFile": "test/test.kt",
|
||||
"newName": "A",
|
||||
"withRuntime": "true"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package test
|
||||
|
||||
class A {
|
||||
inner class C {
|
||||
inner class C {
|
||||
val c: A.C = this@A.C()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package test
|
||||
|
||||
class A {
|
||||
inner class /*rename*/B {
|
||||
inner class C {
|
||||
val b: B = B()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"type": "MARKED_ELEMENT",
|
||||
"mainFile": "test/test.kt",
|
||||
"newName": "C",
|
||||
"withRuntime": "true"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package test
|
||||
|
||||
class A {
|
||||
class C {
|
||||
class C {
|
||||
val c: A.C = A.C()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package test
|
||||
|
||||
class A {
|
||||
class /*rename*/B {
|
||||
class C {
|
||||
val b: B = B()
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"type": "MARKED_ELEMENT",
|
||||
"mainFile": "test/test.kt",
|
||||
"newName": "C",
|
||||
"withRuntime": "true"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package test
|
||||
|
||||
class A {
|
||||
inner class A {
|
||||
inner class C {
|
||||
val a: A = A()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package test
|
||||
|
||||
class A {
|
||||
inner class /*rename*/B {
|
||||
inner class C {
|
||||
val b: B = B()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"type": "MARKED_ELEMENT",
|
||||
"mainFile": "test/test.kt",
|
||||
"newName": "A",
|
||||
"withRuntime": "true"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package test
|
||||
|
||||
class A {
|
||||
class Foo
|
||||
class /*rename*/Bar
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"type": "MARKED_ELEMENT",
|
||||
"mainFile": "test/test.kt",
|
||||
"newName": "Foo",
|
||||
"withRuntime": "true",
|
||||
"hint": "Class 'Foo' is already declared in class 'A'"
|
||||
}
|
||||
idea/testData/refactoring/rename/renamedClassShadowingImplicitlyImportedClassUsage/after/test/lib.kt
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
package lib
|
||||
|
||||
class LibType
|
||||
idea/testData/refactoring/rename/renamedClassShadowingImplicitlyImportedClassUsage/after/test/ref.kt
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
package ref
|
||||
|
||||
import lib.LibType
|
||||
|
||||
class String {}
|
||||
|
||||
class Referrer1 { fun method(p1a: String, p1b: kotlin.String) {} }
|
||||
class Referrer2 { fun method(p2a: String, p2b: LibType) {} }
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package lib
|
||||
|
||||
class LibType
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package ref
|
||||
|
||||
import lib.LibType
|
||||
|
||||
class /*rename*/CustomType {}
|
||||
|
||||
class Referrer1 { fun method(p1a: CustomType, p1b: String) {} }
|
||||
class Referrer2 { fun method(p2a: CustomType, p2b: LibType) {} }
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"type": "MARKED_ELEMENT",
|
||||
"mainFile": "test/ref.kt",
|
||||
"newName": "String",
|
||||
"withRuntime": "true"
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package lib
|
||||
|
||||
class LibType
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package ref
|
||||
|
||||
import lib.LibType
|
||||
|
||||
class LibType {}
|
||||
|
||||
class Referrer1 { fun method(p1a: ref.LibType, p1b: String) {} }
|
||||
class Referrer2 { fun method(p2a: ref.LibType, p2b: LibType) {} }
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
package lib
|
||||
|
||||
class LibType
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
package ref
|
||||
|
||||
import lib.LibType
|
||||
|
||||
class /*rename*/CustomType {}
|
||||
|
||||
class Referrer1 { fun method(p1a: CustomType, p1b: String) {} }
|
||||
class Referrer2 { fun method(p2a: CustomType, p2b: LibType) {} }
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"type": "MARKED_ELEMENT",
|
||||
"mainFile": "test/ref.kt",
|
||||
"newName": "LibType",
|
||||
"withRuntime": "true"
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package test
|
||||
|
||||
class Foo
|
||||
class /*rename*/Bar
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"type": "MARKED_ELEMENT",
|
||||
"mainFile": "test/test.kt",
|
||||
"newName": "Foo",
|
||||
"withRuntime": "true",
|
||||
"hint": "Class 'Foo' is already declared in package 'test'"
|
||||
}
|
||||
Reference in New Issue
Block a user