DeprecatedSymbolUsageFix - handling of complex expressions used twice
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
// "Replace with 'newFun(p, p)'" "true"
|
||||
|
||||
@deprecated("", ReplaceWith("newFun(p, p)"))
|
||||
fun oldFun(p: Int) {
|
||||
newFun(p, p)
|
||||
}
|
||||
|
||||
fun newFun(p1: Int, p2: Int){}
|
||||
|
||||
fun foo() {
|
||||
<caret>oldFun(bar())
|
||||
}
|
||||
|
||||
fun bar(): Int = 0
|
||||
@@ -0,0 +1,15 @@
|
||||
// "Replace with 'newFun(p, p)'" "true"
|
||||
|
||||
@deprecated("", ReplaceWith("newFun(p, p)"))
|
||||
fun oldFun(p: Int) {
|
||||
newFun(p, p)
|
||||
}
|
||||
|
||||
fun newFun(p1: Int, p2: Int){}
|
||||
|
||||
fun foo() {
|
||||
val p = bar()
|
||||
<caret>newFun(p, p)
|
||||
}
|
||||
|
||||
fun bar(): Int = 0
|
||||
@@ -0,0 +1,15 @@
|
||||
// "Replace with 'newFun(this)'" "true"
|
||||
|
||||
class C {
|
||||
@deprecated("", ReplaceWith("newFun(this)"))
|
||||
fun oldFun(){}
|
||||
}
|
||||
|
||||
fun C.newFun(c: C){}
|
||||
|
||||
fun foo() {
|
||||
val bar = 0
|
||||
getBar().<caret>oldFun()
|
||||
}
|
||||
|
||||
fun getBar(): C = C()
|
||||
@@ -0,0 +1,16 @@
|
||||
// "Replace with 'newFun(this)'" "true"
|
||||
|
||||
class C {
|
||||
@deprecated("", ReplaceWith("newFun(this)"))
|
||||
fun oldFun(){}
|
||||
}
|
||||
|
||||
fun C.newFun(c: C){}
|
||||
|
||||
fun foo() {
|
||||
val bar = 0
|
||||
val bar1 = getBar()
|
||||
bar1.<caret>newFun(bar1)
|
||||
}
|
||||
|
||||
fun getBar(): C = C()
|
||||
@@ -0,0 +1,13 @@
|
||||
// "Replace with 'newFun(p, p)'" "true"
|
||||
|
||||
@deprecated("", ReplaceWith("newFun(p, p)"))
|
||||
fun oldFun(p: Int): Int {
|
||||
return newFun(p, p)
|
||||
}
|
||||
|
||||
fun newFun(p1: Int, p2: Int): Int = 0
|
||||
|
||||
fun foo(): Int {
|
||||
var v = 0
|
||||
return <caret>oldFun(v++)
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with 'newFun(p, p)'" "true"
|
||||
|
||||
@deprecated("", ReplaceWith("newFun(p, p)"))
|
||||
fun oldFun(p: Int): Int {
|
||||
return newFun(p, p)
|
||||
}
|
||||
|
||||
fun newFun(p1: Int, p2: Int): Int = 0
|
||||
|
||||
fun foo(): Int {
|
||||
var v = 0
|
||||
return v++.let { newFun(it, it) }
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// "Replace with 'newFun(this, p)'" "true"
|
||||
|
||||
class C {
|
||||
@deprecated("", ReplaceWith("newFun(this, p)"))
|
||||
fun oldFun(p: Int){}
|
||||
}
|
||||
|
||||
fun C.newFun(c: C, p: Int){}
|
||||
|
||||
val bar = 0
|
||||
|
||||
fun foo() {
|
||||
getBar().<caret>oldFun(bar)
|
||||
}
|
||||
|
||||
fun getBar(): C = C()
|
||||
@@ -0,0 +1,17 @@
|
||||
// "Replace with 'newFun(this, p)'" "true"
|
||||
|
||||
class C {
|
||||
@deprecated("", ReplaceWith("newFun(this, p)"))
|
||||
fun oldFun(p: Int){}
|
||||
}
|
||||
|
||||
fun C.newFun(c: C, p: Int){}
|
||||
|
||||
val bar = 0
|
||||
|
||||
fun foo() {
|
||||
val bar1 = getBar()
|
||||
bar1.<caret>newFun(bar1, bar)
|
||||
}
|
||||
|
||||
fun getBar(): C = C()
|
||||
@@ -0,0 +1,16 @@
|
||||
// "Replace with 'newFun(p, p)'" "true"
|
||||
|
||||
import java.util.*
|
||||
|
||||
@deprecated("", ReplaceWith("newFun(p, p)"))
|
||||
fun oldFun(p: List<String>) {
|
||||
newFun(p, p)
|
||||
}
|
||||
|
||||
fun newFun(p1: List<String>, p2: List<String>){}
|
||||
|
||||
fun foo() {
|
||||
<caret>oldFun(bar())
|
||||
}
|
||||
|
||||
fun <T> bar(): List<T> = ArrayList()
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// "Replace with 'newFun(p, p)'" "true"
|
||||
|
||||
import java.util.*
|
||||
|
||||
@deprecated("", ReplaceWith("newFun(p, p)"))
|
||||
fun oldFun(p: List<String>) {
|
||||
newFun(p, p)
|
||||
}
|
||||
|
||||
fun newFun(p1: List<String>, p2: List<String>){}
|
||||
|
||||
fun foo() {
|
||||
val p: List<String> = bar()
|
||||
<caret>newFun(p, p)
|
||||
}
|
||||
|
||||
fun <T> bar(): List<T> = ArrayList()
|
||||
@@ -0,0 +1,16 @@
|
||||
// "Replace with 'newFun(p, p)'" "true"
|
||||
|
||||
@deprecated("", ReplaceWith("newFun(p, p)"))
|
||||
fun oldFun(p: Int) {
|
||||
newFun(p, p)
|
||||
}
|
||||
|
||||
fun newFun(p1: Int, p2: Int){}
|
||||
|
||||
fun foo(c: C) {
|
||||
<caret>oldFun(c.bar)
|
||||
}
|
||||
|
||||
class C {
|
||||
var bar = 0
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// "Replace with 'newFun(p, p)'" "true"
|
||||
|
||||
@deprecated("", ReplaceWith("newFun(p, p)"))
|
||||
fun oldFun(p: Int) {
|
||||
newFun(p, p)
|
||||
}
|
||||
|
||||
fun newFun(p1: Int, p2: Int){}
|
||||
|
||||
fun foo(c: C) {
|
||||
<caret>newFun(c.bar, c.bar)
|
||||
}
|
||||
|
||||
class C {
|
||||
var bar = 0
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// "Replace with 'newFun(p, p)'" "true"
|
||||
|
||||
@deprecated("", ReplaceWith("newFun(p, p)"))
|
||||
fun oldFun(p: String) {
|
||||
newFun(p, p)
|
||||
}
|
||||
|
||||
fun newFun(p1: String, p2: String){}
|
||||
|
||||
fun foo() {
|
||||
<caret>oldFun("x")
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// "Replace with 'newFun(p, p)'" "true"
|
||||
|
||||
@deprecated("", ReplaceWith("newFun(p, p)"))
|
||||
fun oldFun(p: String) {
|
||||
newFun(p, p)
|
||||
}
|
||||
|
||||
fun newFun(p1: String, p2: String){}
|
||||
|
||||
fun foo() {
|
||||
newFun("x", "x")
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// "Replace with 'newFun(p, p)'" "true"
|
||||
|
||||
@deprecated("", ReplaceWith("newFun(p, p)"))
|
||||
fun oldFun(p: String) {
|
||||
newFun(p, p)
|
||||
}
|
||||
|
||||
fun newFun(p1: String, p2: String){}
|
||||
|
||||
fun foo(p: Int) {
|
||||
<caret>oldFun("p=$p")
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// "Replace with 'newFun(p, p)'" "true"
|
||||
|
||||
@deprecated("", ReplaceWith("newFun(p, p)"))
|
||||
fun oldFun(p: String) {
|
||||
newFun(p, p)
|
||||
}
|
||||
|
||||
fun newFun(p1: String, p2: String){}
|
||||
|
||||
fun foo(p: Int) {
|
||||
val p1 = "p=$p"
|
||||
<caret>newFun(p1, p1)
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// "Replace with 'newFun(p, p)'" "true"
|
||||
|
||||
@deprecated("", ReplaceWith("newFun(p, p)"))
|
||||
fun oldFun(p: String) {
|
||||
newFun(p, p)
|
||||
}
|
||||
|
||||
fun newFun(p1: String, p2: String){}
|
||||
|
||||
fun foo(p: Int) {
|
||||
<caret>oldFun("${p.bar()}")
|
||||
}
|
||||
|
||||
fun Int.bar(): String = ""
|
||||
@@ -0,0 +1,15 @@
|
||||
// "Replace with 'newFun(p, p)'" "true"
|
||||
|
||||
@deprecated("", ReplaceWith("newFun(p, p)"))
|
||||
fun oldFun(p: String) {
|
||||
newFun(p, p)
|
||||
}
|
||||
|
||||
fun newFun(p1: String, p2: String){}
|
||||
|
||||
fun foo(p: Int) {
|
||||
val p1 = "${p.bar()}"
|
||||
<caret>newFun(p1, p1)
|
||||
}
|
||||
|
||||
fun Int.bar(): String = ""
|
||||
Reference in New Issue
Block a user