Revert unification of operations on Array<T> and Array<out T> (copyOf, copyOfRange) which return the same type as the receiver.

Leave sortedArray, reversedArray and sliceArray only for covariant projection of array as the receiver.
This commit is contained in:
Ilya Gorbunov
2015-09-17 18:12:21 +03:00
committed by Alexander Udalov
parent c12f44fa22
commit e95be9096e
9 changed files with 73 additions and 68 deletions
@@ -819,7 +819,7 @@ class ArraysTest {
with (arrayData("ac", "aD", "aba") { toList().toTypedArray() }) {
checkSorted<List<String>>({ sorted() }, { sortedDescending() }, { iterator() })
checkSorted<Array<String>>({ sortedArray() }, { sortedArrayDescending()}, { iterator() } )
checkSorted<Array<out String>>({ sortedArray() }, { sortedArrayDescending()}, { iterator() } )
}
with (arrayData(3, 7, 1) { toIntArray() }) {
@@ -873,7 +873,7 @@ class ArraysTest {
.checkSorted<List<Int>>( { sortedWith(comparator) }, { sortedWith(comparator.reversed()) }, { iterator() })
arrayData(arrayOf(0, 1, 2, 3, 4, 5), comparator)
.checkSorted<Array<Int>>( { sortedArrayWith(comparator) }, { sortedArrayWith(comparator.reversed()) }, { iterator() })
.checkSorted<Array<out Int>>( { sortedArrayWith(comparator) }, { sortedArrayWith(comparator.reversed()) }, { iterator() })
}
}