ReplaceWith: suggest to replace for 'get/set' operator functions
#KT-15944 Fixed
This commit is contained in:
committed by
Dmitry Gridin
parent
82b6ecfa64
commit
e31ea0c243
@@ -0,0 +1,11 @@
|
||||
// "Replace with 'get2(i)'" "true"
|
||||
interface T {
|
||||
@Deprecated("", replaceWith = ReplaceWith("get2(i)"))
|
||||
operator fun get(i: Int): String
|
||||
|
||||
fun get2(i: Int): String
|
||||
}
|
||||
|
||||
fun test(t: T) {
|
||||
val s = <caret>t[0]
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Replace with 'get2(i)'" "true"
|
||||
interface T {
|
||||
@Deprecated("", replaceWith = ReplaceWith("get2(i)"))
|
||||
operator fun get(i: Int): String
|
||||
|
||||
fun get2(i: Int): String
|
||||
}
|
||||
|
||||
fun test(t: T) {
|
||||
val s = t.get2(0)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// "Replace usages of 'set(Int, Int): Unit' in whole project" "true"
|
||||
interface T {
|
||||
@Deprecated("", replaceWith = ReplaceWith("set2(i, v)"))
|
||||
operator fun set(i: Int, v: Int)
|
||||
|
||||
fun set2(i: Int, v: Int)
|
||||
}
|
||||
|
||||
fun test(t: T) {
|
||||
<caret>t[0] = 1
|
||||
t[1] = 2
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// "Replace usages of 'set(Int, Int): Unit' in whole project" "true"
|
||||
interface T {
|
||||
@Deprecated("", replaceWith = ReplaceWith("set2(i, v)"))
|
||||
operator fun set(i: Int, v: Int)
|
||||
|
||||
fun set2(i: Int, v: Int)
|
||||
}
|
||||
|
||||
fun test(t: T) {
|
||||
t.set2(0, 1)
|
||||
t.set2(1, 2)
|
||||
}
|
||||
Reference in New Issue
Block a user