Rename: Drop 'operator' keyword if new name doesn't correspond to any convention
#KT-9357 Fixed
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
class A(val n: Int) {
|
||||
fun compareTo(other: A): Int = n.compareTo(other.n)
|
||||
operator fun compareTo(other: A): Int = n.compareTo(other.n)
|
||||
}
|
||||
|
||||
fun test() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class A(val n: Int) {
|
||||
fun contains(k: Int): Boolean = k <= n
|
||||
operator fun contains(k: Int): Boolean = k <= n
|
||||
}
|
||||
|
||||
fun test() {
|
||||
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
class A(val n: Int) {
|
||||
fun contains(k: Int): Boolean = k <= n
|
||||
operator fun contains(k: Int): Boolean = k <= n
|
||||
}
|
||||
|
||||
fun test() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class A(val n: Int) {
|
||||
override fun equals(other: Any?): Boolean = other is A && other.n == n
|
||||
override operator fun equals(other: Any?): Boolean = other is A && other.n == n
|
||||
}
|
||||
|
||||
fun test() {
|
||||
|
||||
idea/testData/refactoring/rename/renameExplicitComponentFunction/before/explicitComponentFunction.kt
Vendored
+3
-3
@@ -1,7 +1,7 @@
|
||||
class A(val n: Int, val s: String, val o: Any) {
|
||||
fun component1(): Int = n
|
||||
fun component2(): String = s
|
||||
fun component3(): Any = o
|
||||
operator fun component1(): Int = n
|
||||
operator fun component2(): String = s
|
||||
operator fun component3(): Any = o
|
||||
}
|
||||
|
||||
fun test() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class A(val n: Int) {
|
||||
fun get(i: Int): A = A(i)
|
||||
operator fun get(i: Int): A = A(i)
|
||||
}
|
||||
|
||||
fun test() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class A(val n: Int) {
|
||||
fun inc(): A = A(n + 1)
|
||||
operator fun inc(): A = A(n + 1)
|
||||
}
|
||||
|
||||
fun test() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class A(val n: Int) {
|
||||
fun invoke(i: Int): A = A(i)
|
||||
operator fun invoke(i: Int): A = A(i)
|
||||
}
|
||||
|
||||
fun test() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class A {
|
||||
public fun iterator(): Iterator<String> = throw IllegalStateException("")
|
||||
public operator fun iterator(): Iterator<String> = throw IllegalStateException("")
|
||||
}
|
||||
|
||||
fun test() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class A(val n: Int) {
|
||||
fun plus(m: Int): A = A(n + m)
|
||||
operator fun plus(m: Int): A = A(n + m)
|
||||
}
|
||||
|
||||
fun test() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class A(var n: Int) {
|
||||
fun plusAssign(m: Int) {
|
||||
operator fun plusAssign(m: Int) {
|
||||
n += m
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class A(val n: Int) {
|
||||
fun set(i: Int, a: A) {}
|
||||
operator fun set(i: Int, a: A) {}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class A(val n: Int) {
|
||||
fun minus(): A = this
|
||||
operator fun minus(): A = this
|
||||
}
|
||||
|
||||
fun test() {
|
||||
|
||||
Reference in New Issue
Block a user