Push Down: Conflict analysis

This commit is contained in:
Alexey Sedunov
2015-08-11 14:05:27 +03:00
parent a66ef47887
commit 96f255225b
22 changed files with 502 additions and 34 deletions
@@ -0,0 +1,24 @@
abstract class <caret>A {
// INFO: {"checked": "true"}
abstract val y: Boolean
// INFO: {"checked": "true", "toAbstract": "true"}
val z: Int = 1
// INFO: {"checked": "true"}
abstract fun foo(n: Int, m: Int)
// INFO: {"checked": "true", "toAbstract": "true"}
fun foo(b: Boolean) = !b
}
class B : A {
val x: Int = 2
val y: Boolean get() = x > 0
val z: Int = 3
fun foo(n: Int) = n + 2
fun foo(n: Int, m: Int) = n + m
fun foo(b: Boolean) = true
}
@@ -0,0 +1,4 @@
Function 'fun foo(Boolean): Boolean' in class B will override corresponding member of class A after refactoring
Function 'fun foo(Int, Int): Int' in class B will override corresponding member of class A after refactoring
Property 'val y: Boolean' in class B will override corresponding member of class A after refactoring
Property 'val z: Int' in class B will override corresponding member of class A after refactoring
+32
View File
@@ -0,0 +1,32 @@
abstract class <caret>A {
// INFO: {"checked": "true"}
open val x: Int = 1
// INFO: {"checked": "true"}
abstract val y: Boolean
// INFO: {"checked": "true", "toAbstract": "true"}
open val z: Int = 1
// INFO: {"checked": "true"}
open fun foo(n: Int) = n + 1
// INFO: {"checked": "true"}
abstract fun foo(n: Int, m: Int)
// INFO: {"checked": "true", "toAbstract": "true"}
open fun foo(b: Boolean) = !b
// INFO: {"checked": "true"}
class X
}
class B : A {
override val x: Int = 2
override val y: Boolean get() = x > 0
override val z: Int = 3
override fun foo(n: Int) = n + 2
override fun foo(n: Int, m: Int) = n + m
override fun foo(b: Boolean) = true
class X
}
@@ -0,0 +1,3 @@
Class B already contains function 'fun foo(Int): Int'
Class B already contains nested class named X
Class B already contains property 'val x: Int'
@@ -0,0 +1,6 @@
open class <caret>A {
// INFO: {"checked": "true"}
val x: Int
}
interface I : A
@@ -0,0 +1,2 @@
Interface I inherits from class A.
It won't be affected by the refactoring
@@ -0,0 +1,30 @@
open class A {
open fun foo(n: Int) {
}
open fun bar(n: Int) {
}
}
open class <caret>B : A() {
// INFO: {"checked": "true"}
fun foo() {
super.foo(1)
super.bar(1)
}
// INFO: {"checked": "true"}
override fun foo(n: Int) {
}
override fun bar(n: Int) {
}
}
class C : B() {
}
@@ -0,0 +1 @@
Pushed member won't be available in 'super.bar(1)'
+3
View File
@@ -0,0 +1,3 @@
class B extends A {
}
+3
View File
@@ -0,0 +1,3 @@
open class <caret>A {
val x: Int = 1
}
@@ -0,0 +1 @@
Non-Kotlin class B won't be affected by the refactoring
+4 -4
View File
@@ -1,12 +1,12 @@
open class <caret>A {
// INFO: {"checked": "true", "toAbstract": "true"}
private fun foo() {
private open fun foo() {
}
}
class B : A {
fun foo() {
inner class B : A() {
override fun foo() {
}
}
}
+3 -3
View File
@@ -1,10 +1,10 @@
open class A {
// INFO: {"checked": "true", "toAbstract": "true"}
protected abstract fun foo()
}
class B : A {
override fun foo() {
inner class B : A() {
override fun foo() {
}
}
}
@@ -0,0 +1,14 @@
open class <caret>A {
private fun foo() {
}
// INFO: {"checked": "true"}
fun bar() {
foo()
}
}
class B : A() {
}
@@ -0,0 +1 @@
Function 'fun bar()' uses function 'fun foo()', which is not accessible from the class B
@@ -0,0 +1,37 @@
open class <caret>A {
fun foo() {
}
// INFO: {"checked": "true"}
fun foo(n: Int) {
}
fun test() {
foo()
foo(1)
}
}
open class B : A() {
}
class C : B() {
}
fun A.test() {
foo()
foo(2)
}
fun test() {
A().foo()
A().foo(3)
B().foo()
B().foo(4)
C().foo()
C().foo(5)
}
@@ -0,0 +1,3 @@
Pushed member won't be available in 'foo(1)'
Pushed member won't be available in 'foo(2)'
Pushed member won't be available in 'foo(3)'