teach 'create from usage' to add 'operator' modifier when necessary

This commit is contained in:
Dmitry Jemerov
2015-09-24 16:28:03 +02:00
parent bda0bd1de1
commit 3dbb74bf0c
35 changed files with 54 additions and 47 deletions
@@ -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.
}
}
@@ -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.
}
}
@@ -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.
}
}
@@ -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.
}
}
@@ -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.
}
}
@@ -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,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.
}
}
@@ -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.
}
}
@@ -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.
}
@@ -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,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.
}
}
@@ -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.
}
}
@@ -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.
}
}