Introduce Parameter: Initial support

This commit is contained in:
Alexey Sedunov
2015-04-03 17:32:39 +03:00
parent 06960be3ad
commit 53a6827ad8
30 changed files with 711 additions and 13 deletions
@@ -0,0 +1,9 @@
class A(a: Int) {
init {
val t = <selection>1 + 2</selection>
}
}
fun test() {
A(1)
}
@@ -0,0 +1,9 @@
class A(a: Int, i: Int = 1 + 2) {
init {
val t = i
}
}
fun test() {
A(1)
}
@@ -0,0 +1,7 @@
class A(a: Int) {
val x = <selection>1 + 2</selection>
}
fun test() {
A(1)
}
@@ -0,0 +1,7 @@
class A(a: Int, i: Int = 1 + 2) {
val x = i
}
fun test() {
A(1)
}
@@ -0,0 +1,7 @@
class A {
val a = <selection>1 + 2</selection>
}
fun test() {
A()
}
@@ -0,0 +1,7 @@
class A(i: Int = 1 + 2) {
val a = i
}
fun test() {
A()
}
@@ -0,0 +1,8 @@
// TARGET:
class A(a: Int) {
fun foo() = <selection>1 + 2</selection>
}
fun test() {
A(1)
}
@@ -0,0 +1,8 @@
// TARGET:
class A(a: Int, val i: Int = 1 + 2) {
fun foo() = i
}
fun test() {
A(1)
}
@@ -0,0 +1,8 @@
fun foo(a: Int): Int {
val b = <selection>(a + 1)</selection> * 2
return a + b
}
fun test() {
foo(1)
}
@@ -0,0 +1,8 @@
fun foo(a: Int, i: Int = a + 1): Int {
val b = (i) * 2
return a + b
}
fun test() {
foo(1)
}
@@ -0,0 +1,5 @@
trait T
fun foo() {
val a = <selection>object: T {}</selection>
}
@@ -0,0 +1,5 @@
trait T
fun foo(t: T = object : T {}) {
val a = t
}
@@ -0,0 +1,8 @@
fun foo(a: Int): Int {
val b = (<selection>a + 1</selection>) * 2
return a + b
}
fun test() {
foo(1)
}
@@ -0,0 +1,8 @@
fun foo(a: Int, i: Int = a + 1): Int {
val b = (i) * 2
return a + b
}
fun test() {
foo(1)
}
@@ -0,0 +1,4 @@
var foo: Int = 1
set(m: Int) {
val t = <selection>m + 1</selection>
}
@@ -0,0 +1 @@
Cannot refactor in this place
@@ -0,0 +1,10 @@
class A {
constructor(a: Int) {
val b = (<selection>a + 1</selection>) * 2
val t = a + b
}
}
fun test() {
A(1)
}
@@ -0,0 +1,10 @@
class A {
constructor(a: Int, i: Int = a + 1) {
val b = (i) * 2
val t = a + b
}
}
fun test() {
A(1)
}