Replace with binary operator: don't suggest for non-operator function

#KT-12273 Fixed
This commit is contained in:
Toshiaki Kameyama
2018-12-12 19:06:25 +09:00
committed by Mikhail Glukhikh
parent ea0f9d124d
commit f2cf3a8e7b
14 changed files with 102 additions and 13 deletions
@@ -0,0 +1,5 @@
public class Operation {
public int compareTo(Operation other) {
return 0;
}
}
@@ -0,0 +1,5 @@
public class Operation {
public int compareTo(Operation other) {
return 0;
}
}
@@ -0,0 +1,5 @@
// FIX: Replace with '<'
fun test(p1: Operation, p2: Operation) {
p1.<caret>compareTo(p2) < 0
}
@@ -0,0 +1,5 @@
// FIX: Replace with '<'
fun test(p1: Operation, p2: Operation) {
p1 < p2
}
@@ -0,0 +1,9 @@
// PROBLEM: none
fun test(p1: Operation, p2: Operation) {
p1.<caret>compareTo(p2) < 0
}
class Operation {
fun compareTo(other: Operation) = 0
}
@@ -0,0 +1,9 @@
// PROBLEM: none
fun test(p1: Operation, p2: Operation) {
p1.<caret>plus(p2)
}
class Operation {
fun plus(other: Operation) = 0
}
@@ -0,0 +1,5 @@
public class Operation {
public int plus(Operation other) {
return 0;
}
}
@@ -0,0 +1,5 @@
public class Operation {
public int plus(Operation other) {
return 0;
}
}
@@ -0,0 +1,5 @@
// FIX: Replace with '+'
fun test(p1: Operation, p2: Operation) {
p1.<caret>plus(p2)
}
@@ -0,0 +1,5 @@
// FIX: Replace with '+'
fun test(p1: Operation, p2: Operation) {
p1 + p2
}