Mark builtins and stblib functions with 'operator'

This commit is contained in:
Yan Zhulanow
2015-09-18 21:38:35 +03:00
parent ce4bcbba6d
commit 1139a8dd0e
39 changed files with 609 additions and 579 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ public open class Any {
* Note that the `==` operator in Kotlin code is translated into a call to [equals] when objects on both sides of the
* operator are not null.
*/
public open fun equals(other: Any?): Boolean
public open operator fun equals(other: Any?): Boolean
/**
* Returns a hash code value for the object. The general contract of hashCode is:
+3 -3
View File
@@ -31,7 +31,7 @@ public class Array<reified T> private (): Cloneable {
* value = arr[index]
* ```
*/
public fun get(index: Int): T
public operator fun get(index: Int): T
/**
* Sets the array element at the specified [index] to the specified [value]. This method can
@@ -40,7 +40,7 @@ public class Array<reified T> private (): Cloneable {
* arr[index] = value
* ```
*/
public fun set(index: Int, value: T): Unit
public operator fun set(index: Int, value: T): Unit
/**
* Returns the number of elements in the array.
@@ -50,7 +50,7 @@ public class Array<reified T> private (): Cloneable {
/**
* Creates an iterator for iterating over the elements of the array.
*/
public fun iterator(): Iterator<T>
public operator fun iterator(): Iterator<T>
/**
* Creates a shallow copy of the array.
+24 -24
View File
@@ -24,15 +24,15 @@ package kotlin
*/
public class ByteArray(size: Int) : Cloneable {
/** Returns the array element at the given [index]. This method can be called using the index operator. */
public fun get(index: Int): Byte
public operator fun get(index: Int): Byte
/** Sets the element at the given [index] to the given [value]. This method can be called using the index operator. */
public fun set(index: Int, value: Byte): Unit
public operator fun set(index: Int, value: Byte): Unit
/** Returns the number of elements in the array. */
public fun size(): Int
/** Creates an iterator over the elements of the array. */
public fun iterator(): ByteIterator
public operator fun iterator(): ByteIterator
public override fun clone(): ByteArray
}
@@ -43,15 +43,15 @@ public class ByteArray(size: Int) : Cloneable {
*/
public class CharArray(size: Int) : Cloneable {
/** Returns the array element at the given [index]. This method can be called using the index operator. */
public fun get(index: Int): Char
public operator fun get(index: Int): Char
/** Sets the element at the given [index] to the given [value]. This method can be called using the index operator. */
public fun set(index: Int, value: Char): Unit
public operator fun set(index: Int, value: Char): Unit
/** Returns the number of elements in the array. */
public fun size(): Int
/** Creates an iterator over the elements of the array. */
public fun iterator(): CharIterator
public operator fun iterator(): CharIterator
public override fun clone(): CharArray
}
@@ -62,15 +62,15 @@ public class CharArray(size: Int) : Cloneable {
*/
public class ShortArray(size: Int) : Cloneable {
/** Returns the array element at the given [index]. This method can be called using the index operator. */
public fun get(index: Int): Short
public operator fun get(index: Int): Short
/** Sets the element at the given [index] to the given [value]. This method can be called using the index operator. */
public fun set(index: Int, value: Short): Unit
public operator fun set(index: Int, value: Short): Unit
/** Returns the number of elements in the array. */
public fun size(): Int
/** Creates an iterator over the elements of the array. */
public fun iterator(): ShortIterator
public operator fun iterator(): ShortIterator
public override fun clone(): ShortArray
}
@@ -81,15 +81,15 @@ public class ShortArray(size: Int) : Cloneable {
*/
public class IntArray(size: Int) : Cloneable {
/** Returns the array element at the given [index]. This method can be called using the index operator. */
public fun get(index: Int): Int
public operator fun get(index: Int): Int
/** Sets the element at the given [index] to the given [value]. This method can be called using the index operator. */
public fun set(index: Int, value: Int): Unit
public operator fun set(index: Int, value: Int): Unit
/** Returns the number of elements in the array. */
public fun size(): Int
/** Creates an iterator over the elements of the array. */
public fun iterator(): IntIterator
public operator fun iterator(): IntIterator
public override fun clone(): IntArray
}
@@ -100,15 +100,15 @@ public class IntArray(size: Int) : Cloneable {
*/
public class LongArray(size: Int) : Cloneable {
/** Returns the array element at the given [index]. This method can be called using the index operator. */
public fun get(index: Int): Long
public operator fun get(index: Int): Long
/** Sets the element at the given [index] to the given [value]. This method can be called using the index operator. */
public fun set(index: Int, value: Long): Unit
public operator fun set(index: Int, value: Long): Unit
/** Returns the number of elements in the array. */
public fun size(): Int
/** Creates an iterator over the elements of the array. */
public fun iterator(): LongIterator
public operator fun iterator(): LongIterator
public override fun clone(): LongArray
}
@@ -119,15 +119,15 @@ public class LongArray(size: Int) : Cloneable {
*/
public class FloatArray(size: Int) : Cloneable {
/** Returns the array element at the given [index]. This method can be called using the index operator. */
public fun get(index: Int): Float
public operator fun get(index: Int): Float
/** Sets the element at the given [index] to the given [value]. This method can be called using the index operator. */
public fun set(index: Int, value: Float): Unit
public operator fun set(index: Int, value: Float): Unit
/** Returns the number of elements in the array. */
public fun size(): Int
/** Creates an iterator over the elements of the array. */
public fun iterator(): FloatIterator
public operator fun iterator(): FloatIterator
public override fun clone(): FloatArray
}
@@ -138,15 +138,15 @@ public class FloatArray(size: Int) : Cloneable {
*/
public class DoubleArray(size: Int) : Cloneable {
/** Returns the array element at the given [index]. This method can be called using the index operator. */
public fun get(index: Int): Double
public operator fun get(index: Int): Double
/** Sets the element at the given [index] to the given [value]. This method can be called using the index operator. */
public fun set(index: Int, value: Double): Unit
public operator fun set(index: Int, value: Double): Unit
/** Returns the number of elements in the array. */
public fun size(): Int
/** Creates an iterator over the elements of the array. */
public fun iterator(): DoubleIterator
public operator fun iterator(): DoubleIterator
public override fun clone(): DoubleArray
}
@@ -157,15 +157,15 @@ public class DoubleArray(size: Int) : Cloneable {
*/
public class BooleanArray(size: Int) : Cloneable {
/** Returns the array element at the given [index]. This method can be called using the index operator. */
public fun get(index: Int): Boolean
public operator fun get(index: Int): Boolean
/** Sets the element at the given [index] to the given [value]. This method can be called using the index operator. */
public fun set(index: Int, value: Boolean): Unit
public operator fun set(index: Int, value: Boolean): Unit
/** Returns the number of elements in the array. */
public fun size(): Int
/** Creates an iterator over the elements of the array. */
public fun iterator(): BooleanIterator
public operator fun iterator(): BooleanIterator
public override fun clone(): BooleanArray
}
+1 -1
View File
@@ -24,7 +24,7 @@ public class Boolean private () : Comparable<Boolean> {
/**
* Returns the inverse of this boolean.
*/
public fun not(): Boolean
public operator fun not(): Boolean
/**
* Performs a logical `and` operation between this Boolean and the [other] one.
+6 -6
View File
@@ -31,20 +31,20 @@ public class Char private () : Comparable<Char> {
public override fun compareTo(other: Char): Int
/** Adds the other Int value to this value resulting a Char. */
public fun plus(other: Int): Char
public operator fun plus(other: Int): Char
/** Subtracts the other Char value from this value resulting an Int. */
public fun minus(other: Char): Int
public operator fun minus(other: Char): Int
/** Subtracts the other Int value from this value resulting a Char. */
public fun minus(other: Int): Char
public operator fun minus(other: Int): Char
/** Increments this value. */
public fun inc(): Char
public operator fun inc(): Char
/** Decrements this value. */
public fun dec(): Char
public operator fun dec(): Char
/** Creates a range from this value to the specified [other] value. */
public fun rangeTo(other: Char): CharRange
public operator fun rangeTo(other: Char): CharRange
/** Returns the value of this character as a `Byte`. */
public override fun toByte(): Byte
+5 -5
View File
@@ -25,7 +25,7 @@ public interface Iterable<out T> {
/**
* Returns an iterator over the elements of this object.
*/
public fun iterator(): Iterator<T>
public operator fun iterator(): Iterator<T>
}
/**
@@ -59,7 +59,7 @@ public interface Collection<out E> : Iterable<E> {
/**
* Checks if the specified element is contained in this collection.
*/
public fun contains(o: Any?): Boolean
public operator fun contains(o: Any?): Boolean
override fun iterator(): Iterator<E>
// Bulk Operations
@@ -140,7 +140,7 @@ public interface List<out E> : Collection<E> {
/**
* Returns the element at the specified index in the list.
*/
public fun get(index: Int): E
public operator fun get(index: Int): E
// Search Operations
/**
@@ -202,7 +202,7 @@ public interface MutableList<E> : List<E>, MutableCollection<E> {
*
* @return the element previously at the specified position.
*/
public fun set(index: Int, element: E): E
public operator fun set(index: Int, element: E): E
/**
* Inserts an element into the list at the specified [index].
@@ -294,7 +294,7 @@ public interface Map<K, out V> {
/**
* Returns the value corresponding to the given [key], or `null` if such a key is not present in the map.
*/
public fun get(key: Any?): V?
public operator fun get(key: Any?): V?
// Views
/**
+1 -1
View File
@@ -25,5 +25,5 @@ public interface Comparable<in T> {
* to the specified [other] object, a negative number if it's less than [other], or a positive number
* if it's greater than [other].
*/
public fun compareTo(other: T): Int
public operator fun compareTo(other: T): Int
}
+2 -2
View File
@@ -24,12 +24,12 @@ public interface Iterator<out T> {
/**
* Returns the next element in the iteration.
*/
public fun next(): T
public operator fun next(): T
/**
* Returns `true` if the iteration has more elements.
*/
public fun hasNext(): Boolean
public operator fun hasNext(): Boolean
}
/**
+1 -1
View File
@@ -32,7 +32,7 @@ public fun Any?.toString(): String
* Concatenates this string with the string representation of the given [other] object. If either the receiver
* or the [other] object are null, they are represented as the string "null".
*/
public fun String?.plus(other: Any?): String
public operator fun String?.plus(other: Any?): String
/**
* Returns an array of objects of the given type with the given [size], initialized with null values.
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -26,12 +26,12 @@ public class String : Comparable<String>, CharSequence {
/**
* Returns a string obtained by concatenating this string with the string representation of the given [other] object.
*/
public fun plus(other: Any?): String
public operator fun plus(other: Any?): String
/**
* Returns the character at the specified [index].
*/
public fun get(index: Int): Char
public operator fun get(index: Int): Char
public override fun length(): Int