teach 'create from usage' to add 'operator' modifier when necessary
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
||||
// "Create member function 'compareTo'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
fun compareTo(t: T): Int {
|
||||
operator fun compareTo(t: T): Int {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,7 +1,7 @@
|
||||
// "Create member function 'contains'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
fun contains(t: T): Boolean {
|
||||
operator fun contains(t: T): Boolean {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,7 +1,7 @@
|
||||
// "Create member function 'compareTo'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
fun compareTo(t: T): Int {
|
||||
operator fun compareTo(t: T): Int {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,7 +1,7 @@
|
||||
// "Create member function 'contains'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
fun contains(t: T): Boolean {
|
||||
operator fun contains(t: T): Boolean {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
|
||||
idea/testData/quickfix/createFromUsage/createFunction/binaryOperations/plusAssignOnUserType.kt.after
Vendored
+1
-1
@@ -1,7 +1,7 @@
|
||||
// "Create member function 'plusAssign'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
fun plusAssign(t: T) {
|
||||
operator fun plusAssign(t: T) {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -3,7 +3,7 @@
|
||||
class A<T>(val n: T) {
|
||||
fun plus(): A<T> = throw Exception()
|
||||
|
||||
fun plus(t: T): A<T> {
|
||||
operator fun plus(t: T): A<T> {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// "Create member function 'plus'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
fun plus(t: T): A<T> {
|
||||
operator fun plus(t: T): A<T> {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -3,7 +3,7 @@
|
||||
class A<T>(val n: T) {
|
||||
fun plus(i: Int, s: String): A<T> = throw Exception()
|
||||
|
||||
fun plus(t: T): A<T> {
|
||||
operator fun plus(t: T): A<T> {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -6,6 +6,6 @@ fun test() {
|
||||
val a: A<Int> = 2 + A(1)
|
||||
}
|
||||
|
||||
fun Int.plus(a: A<Int>): A<Int> {
|
||||
operator fun Int.plus(a: A<Int>): A<Int> {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,7 +1,7 @@
|
||||
// "Create member function 'plus'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
fun plus(t: T): A<T> {
|
||||
operator fun plus(t: T): A<T> {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// "Create member function 'plus'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
fun plus(i: Int): A<T> {
|
||||
operator fun plus(i: Int): A<T> {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,7 +1,7 @@
|
||||
// "Create member function 'contains'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
fun contains(t: T): Boolean {
|
||||
operator fun contains(t: T): Boolean {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,7 +1,7 @@
|
||||
// "Create member function 'contains'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
fun contains(t: T): Boolean {
|
||||
operator fun contains(t: T): Boolean {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -3,7 +3,7 @@ class Foo<T> {
|
||||
fun component1(): Int { return 0 }
|
||||
fun component2(): Int { return 0 }
|
||||
|
||||
fun component3(): Any {
|
||||
operator fun component3(): Any {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -3,7 +3,7 @@ class Foo<T> {
|
||||
fun component1(): Int { return 0 }
|
||||
fun component2(): Int { return 0 }
|
||||
|
||||
fun component3(): String {
|
||||
operator fun component3(): String {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -17,6 +17,6 @@ fun foo() {
|
||||
for ((i: Int, j: Int) in Foo<Int>()) { }
|
||||
}
|
||||
|
||||
fun Any.component2(): Int {
|
||||
operator fun Any.component2(): Int {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
+1
-1
@@ -6,6 +6,6 @@ fun test(): A<String> {
|
||||
return 1(2, "2")
|
||||
}
|
||||
|
||||
fun Int.invoke(i: Int, s: String): A<String> {
|
||||
operator fun Int.invoke(i: Int, s: String): A<String> {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// "Create member function 'invoke'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
fun invoke(t: T, s: String): B<String> {
|
||||
operator fun invoke(t: T, s: String): B<String> {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
|
||||
idea/testData/quickfix/createFromUsage/createFunction/invoke/invokeOnUserTypeWithTypeParams.kt.after
Vendored
+1
-1
@@ -1,7 +1,7 @@
|
||||
// "Create member function 'invoke'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
fun <V> invoke(u: T, s: String): B<V> {
|
||||
operator fun <V> invoke(u: T, s: String): B<V> {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// "Create member function 'invoke'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
fun invoke(abc: T, ghi: A<T>, def: String): A<T> {
|
||||
operator fun invoke(abc: T, ghi: A<T>, def: String): A<T> {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// "Create member function 'iterator'" "true"
|
||||
class Foo<T> {
|
||||
fun iterator(): Iterator<T> {
|
||||
operator fun iterator(): Iterator<T> {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// "Create member function 'iterator'" "true"
|
||||
class Foo<T> {
|
||||
fun iterator(): Iterator<String> {
|
||||
operator fun iterator(): Iterator<String> {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,7 +1,7 @@
|
||||
// "Create member function 'inc'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
fun inc(): A<T> {
|
||||
operator fun inc(): A<T> {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -3,7 +3,7 @@
|
||||
class A<T>(val n: T) {
|
||||
fun minus(n: Int): A<T> = throw Exception()
|
||||
|
||||
fun minus(): A<T> {
|
||||
operator fun minus(): A<T> {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -4,6 +4,6 @@ fun test() {
|
||||
val a = -false
|
||||
}
|
||||
|
||||
fun Boolean.minus(): Any {
|
||||
operator fun Boolean.minus(): Any {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,7 +1,7 @@
|
||||
// "Create member function 'minus'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
fun minus(): Any {
|
||||
operator fun minus(): Any {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// "Create member function 'minus'" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
fun minus(): A<T> {
|
||||
operator fun minus(): A<T> {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user