Inline-only in generated code

This commit is contained in:
Ilya Gorbunov
2016-01-27 21:27:54 +03:00
parent 8c0008aa2e
commit c7bd70732c
16 changed files with 350 additions and 175 deletions
File diff suppressed because it is too large Load Diff
+25 -13
View File
@@ -16,7 +16,7 @@ import java.util.Collections // TODO: it's temporary while we have java.util.Col
/**
* Returns 1st *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
@kotlin.internal.InlineOnly
public inline operator fun <T> List<T>.component1(): T {
return get(0)
}
@@ -24,7 +24,7 @@ public inline operator fun <T> List<T>.component1(): T {
/**
* Returns 2nd *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
@kotlin.internal.InlineOnly
public inline operator fun <T> List<T>.component2(): T {
return get(1)
}
@@ -32,7 +32,7 @@ public inline operator fun <T> List<T>.component2(): T {
/**
* Returns 3rd *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
@kotlin.internal.InlineOnly
public inline operator fun <T> List<T>.component3(): T {
return get(2)
}
@@ -40,7 +40,7 @@ public inline operator fun <T> List<T>.component3(): T {
/**
* Returns 4th *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
@kotlin.internal.InlineOnly
public inline operator fun <T> List<T>.component4(): T {
return get(3)
}
@@ -48,7 +48,7 @@ public inline operator fun <T> List<T>.component4(): T {
/**
* Returns 5th *element* from the collection.
*/
@Suppress("NOTHING_TO_INLINE")
@kotlin.internal.InlineOnly
public inline operator fun <T> List<T>.component5(): T {
return get(4)
}
@@ -74,7 +74,8 @@ public fun <T> Iterable<T>.elementAt(index: Int): T {
/**
* Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this list.
*/
public fun <T> List<T>.elementAt(index: Int): T {
@kotlin.internal.InlineOnly
public inline fun <T> List<T>.elementAt(index: Int): T {
return get(index)
}
@@ -99,6 +100,7 @@ public fun <T> Iterable<T>.elementAtOrElse(index: Int, defaultValue: (Int) -> T)
/**
* Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this list.
*/
@kotlin.internal.InlineOnly
public inline fun <T> List<T>.elementAtOrElse(index: Int, defaultValue: (Int) -> T): T {
return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)
}
@@ -124,13 +126,15 @@ public fun <T> Iterable<T>.elementAtOrNull(index: Int): T? {
/**
* Returns an element at the given [index] or `null` if the [index] is out of bounds of this list.
*/
public fun <T> List<T>.elementAtOrNull(index: Int): T? {
return if (index >= 0 && index <= lastIndex) get(index) else null
@kotlin.internal.InlineOnly
public inline fun <T> List<T>.elementAtOrNull(index: Int): T? {
return this.getOrNull(index)
}
/**
* Returns the first element matching the given [predicate], or `null` if no such element was found.
*/
@kotlin.internal.InlineOnly
public inline fun <T> Iterable<T>.find(predicate: (T) -> Boolean): T? {
return firstOrNull(predicate)
}
@@ -138,6 +142,7 @@ public inline fun <T> Iterable<T>.find(predicate: (T) -> Boolean): T? {
/**
* Returns the last element matching the given [predicate], or `null` if no such element was found.
*/
@kotlin.internal.InlineOnly
public inline fun <T> Iterable<T>.findLast(predicate: (T) -> Boolean): T? {
return lastOrNull(predicate)
}
@@ -145,6 +150,7 @@ public inline fun <T> Iterable<T>.findLast(predicate: (T) -> Boolean): T? {
/**
* Returns the last element matching the given [predicate], or `null` if no such element was found.
*/
@kotlin.internal.InlineOnly
public inline fun <T> List<T>.findLast(predicate: (T) -> Boolean): T? {
return lastOrNull(predicate)
}
@@ -227,6 +233,7 @@ public inline fun <T> Iterable<T>.firstOrNull(predicate: (T) -> Boolean): T? {
/**
* Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this list.
*/
@kotlin.internal.InlineOnly
public inline fun <T> List<T>.getOrElse(index: Int, defaultValue: (Int) -> T): T {
return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)
}
@@ -1320,7 +1327,8 @@ public inline fun <T> Iterable<T>.any(predicate: (T) -> Boolean): Boolean {
/**
* Returns the number of elements in this collection.
*/
public fun <T> Collection<T>.count(): Int {
@kotlin.internal.InlineOnly
public inline fun <T> Collection<T>.count(): Int {
return size
}
@@ -1657,7 +1665,8 @@ public operator fun <T> Iterable<T>.minus(elements: Sequence<T>): List<T> {
/**
* Returns a list containing all elements of the original collection without the first occurrence of the given [element].
*/
public fun <T> Iterable<T>.minusElement(element: T): List<T> {
@kotlin.internal.InlineOnly
public inline fun <T> Iterable<T>.minusElement(element: T): List<T> {
return minus(element)
}
@@ -1771,14 +1780,16 @@ public operator fun <T> Iterable<T>.plus(elements: Sequence<T>): List<T> {
/**
* Returns a list containing all elements of the original collection and then the given [element].
*/
public fun <T> Collection<T>.plusElement(element: T): List<T> {
@kotlin.internal.InlineOnly
public inline fun <T> Collection<T>.plusElement(element: T): List<T> {
return plus(element)
}
/**
* Returns a list containing all elements of the original collection and then the given [element].
*/
public fun <T> Iterable<T>.plusElement(element: T): List<T> {
@kotlin.internal.InlineOnly
public inline fun <T> Iterable<T>.plusElement(element: T): List<T> {
return plus(element)
}
@@ -1857,7 +1868,8 @@ public fun <T> Iterable<T>.joinToString(separator: CharSequence = ", ", prefix:
/**
* Returns this collection as an [Iterable].
*/
public fun <T> Iterable<T>.asIterable(): Iterable<T> {
@kotlin.internal.InlineOnly
public inline fun <T> Iterable<T>.asIterable(): Iterable<T> {
return this
}
+7 -3
View File
@@ -103,7 +103,8 @@ public inline fun <K, V> Map<K, V>.any(predicate: (Map.Entry<K, V>) -> Boolean):
/**
* Returns the number of entries in this map.
*/
public fun <K, V> Map<K, V>.count(): Int {
@kotlin.internal.InlineOnly
public inline fun <K, V> Map<K, V>.count(): Int {
return size
}
@@ -127,6 +128,7 @@ public inline fun <K, V> Map<K, V>.forEach(action: (Map.Entry<K, V>) -> Unit): U
/**
* Returns the first entry yielding the largest value of the given function or `null` if there are no entries.
*/
@kotlin.internal.InlineOnly
public inline fun <K, V, R : Comparable<R>> Map<K, V>.maxBy(selector: (Map.Entry<K, V>) -> R): Map.Entry<K, V>? {
return entries.maxBy(selector)
}
@@ -134,7 +136,8 @@ public inline fun <K, V, R : Comparable<R>> Map<K, V>.maxBy(selector: (Map.Entry
/**
* Returns the first entry having the largest value according to the provided [comparator] or `null` if there are no entries.
*/
public fun <K, V> Map<K, V>.maxWith(comparator: Comparator<in Map.Entry<K, V>>): Map.Entry<K, V>? {
@kotlin.internal.InlineOnly
public inline fun <K, V> Map<K, V>.maxWith(comparator: Comparator<in Map.Entry<K, V>>): Map.Entry<K, V>? {
return entries.maxWith(comparator)
}
@@ -171,7 +174,8 @@ public inline fun <K, V> Map<K, V>.none(predicate: (Map.Entry<K, V>) -> Boolean)
/**
* Creates an [Iterable] instance that wraps the original map returning its entries when being iterated.
*/
public fun <K, V> Map<K, V>.asIterable(): Iterable<Map.Entry<K, V>> {
@kotlin.internal.InlineOnly
public inline fun <K, V> Map<K, V>.asIterable(): Iterable<Map.Entry<K, V>> {
return entries
}
+8 -3
View File
@@ -62,6 +62,7 @@ public fun <T> Sequence<T>.elementAtOrNull(index: Int): T? {
/**
* Returns the first element matching the given [predicate], or `null` if no such element was found.
*/
@kotlin.internal.InlineOnly
public inline fun <T> Sequence<T>.find(predicate: (T) -> Boolean): T? {
return firstOrNull(predicate)
}
@@ -69,6 +70,7 @@ public inline fun <T> Sequence<T>.find(predicate: (T) -> Boolean): T? {
/**
* Returns the last element matching the given [predicate], or `null` if no such element was found.
*/
@kotlin.internal.InlineOnly
public inline fun <T> Sequence<T>.findLast(predicate: (T) -> Boolean): T? {
return lastOrNull(predicate)
}
@@ -1053,7 +1055,8 @@ public operator fun <T> Sequence<T>.minus(elements: Sequence<T>): Sequence<T> {
/**
* Returns a sequence containing all elements of the original sequence without the first occurrence of the given [element].
*/
public fun <T> Sequence<T>.minusElement(element: T): Sequence<T> {
@kotlin.internal.InlineOnly
public inline fun <T> Sequence<T>.minusElement(element: T): Sequence<T> {
return minus(element)
}
@@ -1112,7 +1115,8 @@ public operator fun <T> Sequence<T>.plus(elements: Sequence<T>): Sequence<T> {
/**
* Returns a sequence containing all elements of the original sequence and then the given [element].
*/
public fun <T> Sequence<T>.plusElement(element: T): Sequence<T> {
@kotlin.internal.InlineOnly
public inline fun <T> Sequence<T>.plusElement(element: T): Sequence<T> {
return plus(element)
}
@@ -1174,7 +1178,8 @@ public fun <T> Sequence<T>.asIterable(): Iterable<T> {
/**
* Returns this sequence as a [Sequence].
*/
public fun <T> Sequence<T>.asSequence(): Sequence<T> {
@kotlin.internal.InlineOnly
public inline fun <T> Sequence<T>.asSequence(): Sequence<T> {
return this
}
+4 -2
View File
@@ -57,7 +57,8 @@ public operator fun <T> Set<T>.minus(elements: Sequence<T>): Set<T> {
/**
* Returns a set containing all elements of the original set except the given [element].
*/
public fun <T> Set<T>.minusElement(element: T): Set<T> {
@kotlin.internal.InlineOnly
public inline fun <T> Set<T>.minusElement(element: T): Set<T> {
return minus(element)
}
@@ -104,7 +105,8 @@ public operator fun <T> Set<T>.plus(elements: Sequence<T>): Set<T> {
/**
* Returns a set containing all elements of the original set and then the given [element].
*/
public fun <T> Set<T>.plusElement(element: T): Set<T> {
@kotlin.internal.InlineOnly
public inline fun <T> Set<T>.plusElement(element: T): Set<T> {
return plus(element)
}
+17 -14
View File
@@ -16,13 +16,15 @@ import java.util.Collections // TODO: it's temporary while we have java.util.Col
/**
* Returns a character at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this char sequence.
*/
public fun CharSequence.elementAt(index: Int): Char {
@kotlin.internal.InlineOnly
public inline fun CharSequence.elementAt(index: Int): Char {
return get(index)
}
/**
* Returns a character at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this char sequence.
*/
@kotlin.internal.InlineOnly
public inline fun CharSequence.elementAtOrElse(index: Int, defaultValue: (Int) -> Char): Char {
return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)
}
@@ -30,13 +32,15 @@ public inline fun CharSequence.elementAtOrElse(index: Int, defaultValue: (Int) -
/**
* Returns a character at the given [index] or `null` if the [index] is out of bounds of this char sequence.
*/
public fun CharSequence.elementAtOrNull(index: Int): Char? {
return if (index >= 0 && index <= lastIndex) get(index) else null
@kotlin.internal.InlineOnly
public inline fun CharSequence.elementAtOrNull(index: Int): Char? {
return this.getOrNull(index)
}
/**
* Returns the first character matching the given [predicate], or `null` if no such character was found.
*/
@kotlin.internal.InlineOnly
public inline fun CharSequence.find(predicate: (Char) -> Boolean): Char? {
return firstOrNull(predicate)
}
@@ -44,6 +48,7 @@ public inline fun CharSequence.find(predicate: (Char) -> Boolean): Char? {
/**
* Returns the last character matching the given [predicate], or `null` if no such character was found.
*/
@kotlin.internal.InlineOnly
public inline fun CharSequence.findLast(predicate: (Char) -> Boolean): Char? {
return lastOrNull(predicate)
}
@@ -85,6 +90,7 @@ public inline fun CharSequence.firstOrNull(predicate: (Char) -> Boolean): Char?
/**
* Returns a character at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this char sequence.
*/
@kotlin.internal.InlineOnly
public inline fun CharSequence.getOrElse(index: Int, defaultValue: (Int) -> Char): Char {
return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)
}
@@ -387,14 +393,9 @@ public fun CharSequence.slice(indices: Iterable<Int>): CharSequence {
/**
* Returns a string containing characters of the original string at specified [indices].
*/
public fun String.slice(indices: Iterable<Int>): String {
val size = indices.collectionSizeOrDefault(10)
if (size == 0) return ""
val result = StringBuilder(size)
for (i in indices) {
result.append(get(i))
}
return result.toString()
@kotlin.internal.InlineOnly
public inline fun String.slice(indices: Iterable<Int>): String {
return (this as CharSequence).slice(indices).toString()
}
/**
@@ -487,8 +488,9 @@ public fun CharSequence.reversed(): CharSequence {
/**
* Returns a string with characters in reversed order.
*/
public fun String.reversed(): String {
return StringBuilder(this).reverse().toString()
@kotlin.internal.InlineOnly
public inline fun String.reversed(): String {
return (this as CharSequence).reversed().toString()
}
/**
@@ -809,7 +811,8 @@ public inline fun CharSequence.any(predicate: (Char) -> Boolean): Boolean {
/**
* Returns the length of this char sequence.
*/
public fun CharSequence.count(): Int {
@kotlin.internal.InlineOnly
public inline fun CharSequence.count(): Int {
return length
}
@@ -145,7 +145,7 @@ public fun <@kotlin.internal.OnlyInputTypes K, V> MutableMap<out K, V>.remove(ke
* }
* ```
*/
@Suppress("NOTHING_TO_INLINE")
@kotlin.internal.InlineOnly
public inline operator fun <K, V> Map.Entry<K, V>.component1(): K = key
/**
@@ -157,7 +157,7 @@ public inline operator fun <K, V> Map.Entry<K, V>.component1(): K = key
* }
* ```
*/
@Suppress("NOTHING_TO_INLINE")
@kotlin.internal.InlineOnly
public inline operator fun <K, V> Map.Entry<K, V>.component2(): V = value
/**
@@ -94,15 +94,25 @@ public interface MatchResult {
@Suppress("NOTHING_TO_INLINE")
@kotlin.jvm.JvmVersion
public class Destructured internal constructor(public val match: MatchResult) {
@kotlin.internal.InlineOnly
public operator inline fun component1(): String = match.groupValues[1]
@kotlin.internal.InlineOnly
public operator inline fun component2(): String = match.groupValues[2]
@kotlin.internal.InlineOnly
public operator inline fun component3(): String = match.groupValues[3]
@kotlin.internal.InlineOnly
public operator inline fun component4(): String = match.groupValues[4]
@kotlin.internal.InlineOnly
public operator inline fun component5(): String = match.groupValues[5]
@kotlin.internal.InlineOnly
public operator inline fun component6(): String = match.groupValues[6]
@kotlin.internal.InlineOnly
public operator inline fun component7(): String = match.groupValues[7]
@kotlin.internal.InlineOnly
public operator inline fun component8(): String = match.groupValues[8]
@kotlin.internal.InlineOnly
public operator inline fun component9(): String = match.groupValues[9]
@kotlin.internal.InlineOnly
public operator inline fun component10(): String = match.groupValues[10]
/**
* Returns destructured group values as a list of strings.
@@ -95,6 +95,7 @@ fun aggregates(): List<GenericFunction> {
return count
"""
}
inline(CharSequences, Maps, Collections, ArraysOfObjects, ArraysOfPrimitives) { Inline.Only }
doc(CharSequences) { "Returns the length of this char sequence."}
body(CharSequences) {
"return length"
@@ -315,6 +316,7 @@ fun aggregates(): List<GenericFunction> {
return maxElem
"""
}
inline(Maps) { Inline.Only }
body(Maps) { "return entries.maxBy(selector)" }
}
@@ -346,6 +348,7 @@ fun aggregates(): List<GenericFunction> {
return max
"""
}
inline(Maps) { Inline.Only }
body(Maps) { "return entries.maxWith(comparator)" }
}
@@ -6,6 +6,7 @@ fun arrays(): List<GenericFunction> {
val templates = arrayListOf<GenericFunction>()
templates add f("isEmpty()") {
inline(Inline.Only)
only(ArraysOfObjects, ArraysOfPrimitives)
doc { "Returns `true` if the array is empty." }
returns("Boolean")
@@ -15,6 +16,7 @@ fun arrays(): List<GenericFunction> {
}
templates add f("isNotEmpty()") {
inline(Inline.Only)
only(ArraysOfObjects, ArraysOfPrimitives)
doc { "Returns `true` if the array is not empty." }
returns("Boolean")
@@ -204,6 +204,7 @@ fun elements(): List<GenericFunction> {
return elementAtOrElse(index) { throw IndexOutOfBoundsException("Sequence doesn't contain element at index $index.") }
"""
}
inline(CharSequences, Lists, ArraysOfObjects, ArraysOfPrimitives) { Inline.Only }
body(CharSequences, Lists, ArraysOfObjects, ArraysOfPrimitives) {
"""
return get(index)
@@ -244,7 +245,7 @@ fun elements(): List<GenericFunction> {
return defaultValue(index)
"""
}
inline(true, CharSequences, Lists, ArraysOfObjects, ArraysOfPrimitives)
inline(CharSequences, Lists, ArraysOfObjects, ArraysOfPrimitives) { Inline.Only }
body(CharSequences, Lists, ArraysOfObjects, ArraysOfPrimitives) {
"""
return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)
@@ -255,7 +256,7 @@ fun elements(): List<GenericFunction> {
templates add f("getOrElse(index: Int, defaultValue: (Int) -> T)") {
doc { f -> "Returns ${f.element.prefixWithArticle()} at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this ${f.collection}." }
returns("T")
inline(true)
inline(Inline.Only)
only(CharSequences, Lists, ArraysOfObjects, ArraysOfPrimitives)
body {
"""
@@ -298,9 +299,10 @@ fun elements(): List<GenericFunction> {
return null
"""
}
inline(CharSequences, Lists, ArraysOfObjects, ArraysOfPrimitives) { Inline.Only }
body(CharSequences, Lists, ArraysOfObjects, ArraysOfPrimitives) {
"""
return if (index >= 0 && index <= lastIndex) get(index) else null
return this.getOrNull(index)
"""
}
}
@@ -422,7 +424,7 @@ fun elements(): List<GenericFunction> {
}
templates add f("find(predicate: (T) -> Boolean)") {
inline(true)
inline(Inline.Only)
include(CharSequences)
doc { f -> "Returns the first ${f.element} matching the given [predicate], or `null` if no such ${f.element} was found." }
returns("T?")
@@ -590,7 +592,7 @@ fun elements(): List<GenericFunction> {
}
templates add f("findLast(predicate: (T) -> Boolean)") {
inline(true)
inline(Inline.Only)
include(Lists, CharSequences)
doc { f -> "Returns the last ${f.element} matching the given [predicate], or `null` if no such ${f.element} was found." }
returns("T?")
@@ -740,8 +742,7 @@ fun elements(): List<GenericFunction> {
templates addAll (1..5).map { n ->
f("component$n()") {
operator(true)
inline(true)
annotations("""@Suppress("NOTHING_TO_INLINE")""")
inline(Inline.Only)
fun getOrdinal(n: Int) = n.toString() + when (n) {
1 -> "st"
2 -> "nd"
@@ -542,7 +542,7 @@ fun filtering(): List<GenericFunction> {
doc(CharSequences, Strings) { f -> "Returns a ${f.collection} containing ${f.element.pluralize()} of the original ${f.collection} at specified [indices]." }
returns(CharSequences, Strings) { "SELF" }
body(CharSequences, Strings) { f ->
body(CharSequences) {
"""
val size = indices.collectionSizeOrDefault(10)
if (size == 0) return ""
@@ -550,9 +550,13 @@ fun filtering(): List<GenericFunction> {
for (i in indices) {
result.append(get(i))
}
return result${toResult(f)}
return result
"""
}
inline(Strings) { Inline.Only }
body(Strings) {
"return (this as CharSequence).slice(indices).toString()"
}
}
templates add f("slice(indices: IntRange)") {
@@ -6,6 +6,8 @@ fun generators(): List<GenericFunction> {
val templates = arrayListOf<GenericFunction>()
templates add f("plusElement(element: T)") {
inline(Inline.Only)
only(Iterables, Collections, Sets, Sequences)
doc { "Returns a list containing all elements of the original collection and then the given [element]." }
doc(Sets) { "Returns a set containing all elements of the original set and then the given [element]." }
@@ -218,6 +220,8 @@ fun generators(): List<GenericFunction> {
}
templates add f("minusElement(element: T)") {
inline(Inline.Only)
only(Iterables, Sets, Sequences)
doc { "Returns a list containing all elements of the original collection without the first occurrence of the given [element]." }
doc(Sets) { "Returns a set containing all elements of the original set except the given [element]." }
@@ -49,11 +49,15 @@ fun ordering(): List<GenericFunction> {
doc(CharSequences, Strings) { f -> "Returns a ${f.collection} with characters in reversed order." }
returns(CharSequences, Strings) { "SELF" }
body(CharSequences, Strings) { f ->
body(CharSequences) { f ->
"""
return StringBuilder(this).reverse()${ if (f == Strings) ".toString()" else "" }
return StringBuilder(this).reverse()
"""
}
inline(Strings) { Inline.Only }
body(Strings) {
"return (this as CharSequence).reversed().toString()"
}
exclude(Sequences)
}
@@ -21,6 +21,9 @@ fun sequences(): List<GenericFunction> {
}
"""
}
inline(Iterables, Maps) { Inline.Only }
doc(Iterables) { "Returns this collection as an [Iterable]." }
body(Iterables) { "return this" }
body(Maps) { "return entries" }
@@ -59,6 +62,7 @@ fun sequences(): List<GenericFunction> {
}
doc(Sequences) { "Returns this sequence as a [Sequence]."}
inline(Sequences) { Inline.Only }
body(Sequences) { "return this" }
}
@@ -6,6 +6,8 @@ fun specialJVM(): List<GenericFunction> {
val templates = arrayListOf<GenericFunction>()
templates add f("plusElement(element: T)") {
inline(Inline.Only)
only(InvariantArraysOfObjects)
returns("SELF")
doc { "Returns an array containing all elements of the original array and then the given [element]." }
@@ -64,6 +66,8 @@ fun specialJVM(): List<GenericFunction> {
templates add f("copyOfRange(fromIndex: Int, toIndex: Int)") {
inline(Inline.Only)
only(InvariantArraysOfObjects, ArraysOfPrimitives)
doc { "Returns new array which is a copy of range of original array." }
returns("SELF")
@@ -73,6 +77,8 @@ fun specialJVM(): List<GenericFunction> {
}
templates add f("copyOf()") {
inline(Inline.Only)
only(InvariantArraysOfObjects, ArraysOfPrimitives)
doc { "Returns new array which is a copy of the original array." }
returns("SELF")
@@ -83,6 +89,8 @@ fun specialJVM(): List<GenericFunction> {
// This overload can cause nulls if array size is expanding, hence different return overload
templates add f("copyOf(newSize: Int)") {
inline(Inline.Only)
only(InvariantArraysOfObjects, ArraysOfPrimitives)
doc { "Returns new array which is a copy of the original array." }
returns("SELF")