quickfix for usages of operators that don't have the proper annotation

This commit is contained in:
Dmitry Jemerov
2015-09-25 19:31:30 +02:00
parent 8b0ccce4f1
commit 3d0e91065a
15 changed files with 132 additions and 9 deletions
+8
View File
@@ -0,0 +1,8 @@
// "Add 'operator' modifier" "true"
class A {
fun plus(a: A): A = A()
}
fun foo() {
A() <caret>+ A()
}
@@ -0,0 +1,8 @@
// "Add 'operator' modifier" "true"
class A {
operator fun plus(a: A): A = A()
}
fun foo() {
A() <caret>+ A()
}
@@ -0,0 +1,6 @@
// "Add 'operator' modifier" "true"
class A {
fun contains(x: Any): Boolean = false
}
fun foo() = 0 i<caret>n A()
@@ -0,0 +1,6 @@
// "Add 'operator' modifier" "true"
class A {
operator fun contains(x: Any): Boolean = false
}
fun foo() = 0 in A()
@@ -0,0 +1,10 @@
// "Add 'operator' modifier" "true"
class A {
fun component1(): Int = 0
fun component2(): Int = 1
}
fun foo() {
val (<caret>zero, one) = A()
}
@@ -0,0 +1,10 @@
// "Add 'operator' modifier" "true"
class A {
operator fun component1(): Int = 0
fun component2(): Int = 1
}
fun foo() {
val (zero, one) = A()
}
@@ -0,0 +1,6 @@
// "Add 'operator' modifier" "true"
class A {
fun get(i: Int): String = ""
}
fun foo() = A()<caret>[0]
@@ -0,0 +1,6 @@
// "Add 'operator' modifier" "true"
class A {
operator fun get(i: Int): String = ""
}
fun foo() = A()[0]