Introduce Parameter: Suggest removing extension receiver which becomes unused after new parameter is added

This commit is contained in:
Alexey Sedunov
2015-06-17 16:05:50 +03:00
parent 5409b19abc
commit 378c1744cb
12 changed files with 168 additions and 34 deletions
@@ -2,19 +2,19 @@
public inline fun <T, R> with(receiver: T, f: T.() -> R): R = receiver.f()
class A(val a: Int) {
fun A.foo(i: Int): Int {
fun foo(i: Int): Int {
return i / 2
}
fun test() {
val a1 = A(1)
a1.foo(a + a1.a)
foo(a + a1.a)
}
}
fun test() {
val t = with(A(1)) {
val a = A(2)
a.foo(this.a + a.a)
foo(this.a + a.a)
}
}
@@ -0,0 +1,14 @@
// WITH_RUNTIME
// WITH_DEFAULT_VALUE: false
class A(val n: Int) {
fun foo(): Int {
return <selection>n + 1</selection>
}
}
fun test() {
A(1).foo()
with(A(1)) {
foo()
}
}
@@ -0,0 +1,15 @@
// WITH_RUNTIME
// WITH_DEFAULT_VALUE: false
class A(val n: Int) {
fun foo(i: Int): Int {
return i
}
}
fun test() {
val a = A(1)
a.foo(a.n + 1)
with(A(1)) {
foo(n + 1)
}
}
@@ -0,0 +1,14 @@
// WITH_RUNTIME
// WITH_DEFAULT_VALUE: false
class A(val n: Int)
fun A.foo(): Int {
return <selection>n + 1</selection>
}
fun test() {
A(1).foo()
with(A(1)) {
foo()
}
}
@@ -0,0 +1,15 @@
// WITH_RUNTIME
// WITH_DEFAULT_VALUE: false
class A(val n: Int)
fun foo(i: Int): Int {
return i
}
fun test() {
val a = A(1)
foo(a.n + 1)
with(A(1)) {
foo(n + 1)
}
}