DeprecatedSymbolUsageFix: can drop more arguments when function literal argument exist

This commit is contained in:
Valentin Kipyatkov
2015-05-22 17:13:33 +03:00
parent 2e2701aa61
commit a9e00a3264
7 changed files with 73 additions and 7 deletions
@@ -0,0 +1,12 @@
// "Replace with 'newFun(p1, p2)'" "true"
interface I {
@deprecated("", ReplaceWith("newFun(p1, p2)"))
fun oldFun(p1: String = "", p2: Int = 0)
fun newFun(p1: String = "", p2: Int = 0, p3: Int = -1)
}
fun foo(i: I) {
i.<caret>oldFun()
}
@@ -0,0 +1,12 @@
// "Replace with 'newFun(p1, p2)'" "true"
interface I {
@deprecated("", ReplaceWith("newFun(p1, p2)"))
fun oldFun(p1: String = "", p2: Int = 0)
fun newFun(p1: String = "", p2: Int = 0, p3: Int = -1)
}
fun foo(i: I) {
i.<caret>newFun()
}
@@ -0,0 +1,12 @@
// "Replace with 'newFun(p2, p1, handler)'" "true"
interface I {
@deprecated("", ReplaceWith("newFun(p2, p1, handler)"))
fun oldFun(p1: String = "", p2: Int = 0, handler: () -> Unit)
fun newFun(a: Int = 0, b: String = "", handler: () -> Unit)
}
fun foo(i: I) {
i.<caret>oldFun { }
}
@@ -0,0 +1,12 @@
// "Replace with 'newFun(p2, p1, handler)'" "true"
interface I {
@deprecated("", ReplaceWith("newFun(p2, p1, handler)"))
fun oldFun(p1: String = "", p2: Int = 0, handler: () -> Unit)
fun newFun(a: Int = 0, b: String = "", handler: () -> Unit)
}
fun foo(i: I) {
i.<caret>newFun { }
}