Implemented "Change signature" refactoring

This commit is contained in:
Alexander Kirillin
2013-04-25 20:45:35 +04:00
parent 500a165191
commit 0a597e563a
62 changed files with 2671 additions and 45 deletions
@@ -0,0 +1,5 @@
class C1 protected (val x: Any){}
fun f() {
val c = C1(12);
}
@@ -0,0 +1,5 @@
class <caret>C1{}
fun f() {
val c = C1();
}
@@ -0,0 +1,3 @@
fun x(a: Int): Float {
x(1);
}
@@ -0,0 +1,3 @@
fun x(a: Int) {
<caret>x(1);
}
@@ -0,0 +1,3 @@
fun<caret> x(a: Int): Float {
x(1);
}
@@ -0,0 +1 @@
class C1 protected (){}
@@ -0,0 +1 @@
class <caret>C1(){}
@@ -0,0 +1,3 @@
fun x(a: Int): Float {
x(1);
}
@@ -0,0 +1,3 @@
fun <caret>x(a: Int): Int {
x(1);
}
@@ -0,0 +1,14 @@
open class C0(val x: Any?) {}
open class C1 (var _x1: Int = 1, _x2: Float?, val _x3: ((Int) -> Int)?) : C0(_x3){
fun bar() {
val y1 = _x1;
val y2 = _x2;
}
}
class C2 : C1(1, 2.5, null<caret>) {
fun foo() {
var c = C1(2, 3.5, null);
c = C1(_x1 = 2, _x2 = 3.5, _x3 = null);
}
}
@@ -0,0 +1,14 @@
open class C0(val x: Any?) {}
open class C1 protected (val x1: Int = 1, var x2: Float, x3: ((Int) -> Int)?) : C0(x3){
fun bar() {
val y1 = x1;
val y2 = x2;
}
}
class C2 : C1(1, 2.5, null<caret>) {
fun foo() {
var c = C1(2, 3.5, null);
c = C1(x1 = 2, x2 = 3.5, x3 = null);
}
}
@@ -0,0 +1,14 @@
open class C1 protected (x3: ((Int) -> Int)?,
var _x2: Float,
val _x1: Int = 1){
fun bar() {
val y1 = _x1;
val y2 = _x2;
}
}
class C2 : C1(null, 2.5, 1) {
fun foo() {
var c = C1(null, 3.5, 2);
c = C1(x3 = null, _x2 = 3.5, _x1 = 2);
}
}
@@ -0,0 +1,12 @@
open class C1 protected (<caret>val x1: Int = 1, var x2: Float, x3: ((Int) -> Int)?){
fun bar() {
val y1 = x1;
val y2 = x2;
}
}
class C2 : C1(1, 2.5, null) {
fun foo() {
var c = C1(2, 3.5, null);
c = C1(x1 = 2, x2 = 3.5, x3 = null);
}
}
@@ -0,0 +1,5 @@
open class Class(<caret>x: Int, val y: Int, val z: Int, _y: Int, var i: Int) {
var _x: Int = 0;
var _y: Int = 0;
var _z: Int = 0;
}
@@ -0,0 +1,3 @@
Duplicating parameter '_y'
Duplicating property '_y'
Duplicating property '_z'
@@ -0,0 +1,2 @@
fun fun1(x1: Int,
y1: Int): Int = x1 * 2 + fun1(x1, )
@@ -0,0 +1 @@
fun fun1(<caret>x : Int) : Int = x * 2 + fun1(x)
@@ -0,0 +1,5 @@
fun foo() {
val v1 = {(z: Int,
y1: String,
x: Any): Int -> println(z); println(y1) }
}
@@ -0,0 +1,3 @@
fun foo() {
val v1 = {(<caret>z: Int, y: String) -> println(z); println(y) }
}
@@ -0,0 +1,12 @@
fun foo(x0: Any?,
x1: Int = 1,
x2: Float) {
foo(null, 2, 3.5);
val y1 = x1;
val y2 = x2;
val y3 = x3;
}
fun bar() {
foo(null, x1 = 2, x2 = 3.5);
}
@@ -0,0 +1,10 @@
protected fun foo(x1: Int = 1, x2: Float, x3: ((Int) -> Int)?) {
foo(<caret>2, 3.5, null);
val y1 = x1;
val y2 = x2;
val y3 = x3;
}
fun bar() {
foo(x1 = 2, x2 = 3.5, x3 = null);
}
@@ -0,0 +1,10 @@
public fun foo(_x1: Int = 1, _x2: Float?, _x3: ((Int) -> Int)?) {
foo(2, 3.5, null);
val y1 = _x1;
val y2 = _x2;
val y3 = _x3;
}
fun bar() {
foo(_x1 = 2, _x2 = 3.5, _x3 = null);
}
@@ -0,0 +1,10 @@
fun foo(<caret>x1: Int = 1, x2: Float, x3: ((Int) -> Int)?) {
foo(2, 3.5, null);
val y1 = x1;
val y2 = x2;
val y3 = x3;
}
fun bar() {
foo(x1 = 2, x2 = 3.5, x3 = null);
}
@@ -0,0 +1,4 @@
fun outer() {
fun <caret>inner1(x: Int, y: Int): Int { val y: Int; }
fun inner2(x: Int, y: Int): Any { }
}
@@ -0,0 +1,3 @@
Duplicating local variable 'y'
Duplicating parameter 'y'
Function already exists: 'local final fun inner2(x : Int, y : Int) : Any defined in outer'
@@ -0,0 +1,4 @@
class outer() {
fun <caret>inner1(x: Int, z: Int) { fun inner3() { val y: Int; }}
fun inner2(x: Int, y: Int) { }
}
@@ -0,0 +1 @@
Function already exists: 'internal final fun inner2(x : Int, y : Int) : Unit defined in outer'
@@ -0,0 +1,3 @@
fun x(a: Int) {
x(1);
}
@@ -0,0 +1,3 @@
fun x(a: Int): Float {
x(<caret>1);
}
@@ -0,0 +1,6 @@
fun after(a: Int) {
after(1);
}
fun after(a: Int, b: Int) {
}
@@ -0,0 +1,6 @@
fun x(<caret>a: Int) {
x(1);
}
fun after(a: Int, b: Int) {
}
@@ -0,0 +1,2 @@
fun <caret>fun1() { }
fun fun2() { }
@@ -0,0 +1 @@
Function already exists: 'internal fun fun2() : Unit defined in root package'
@@ -0,0 +1,2 @@
fun foo(<caret>x1: Int = 1, vararg x2: Float, x3: ((Int) -> Int)?) {
}