stdlib fixes:

- 'sequence(initialValue: T?, ...)' should have LowPriorityInOverloadResolution
(otherwise 'sequence({...}, {...})' is ambiguous).
- 'copyOf' and 'copyOfRange' should be defined for 'Array<T>' only
('Array<out T>' version always loses to 'Array<T>', since the second one
is always more specific).
This commit is contained in:
Dmitry Petrov
2015-12-28 15:12:35 +03:00
parent 02daeac41b
commit c97294a066
3 changed files with 4 additions and 27 deletions
-24
View File
@@ -11254,14 +11254,6 @@ public fun ShortArray.binarySearch(element: Short, fromIndex: Int = 0, toIndex:
return Arrays.binarySearch(this, fromIndex, toIndex, element)
}
/**
* Returns new array which is a copy of the original array.
*/
@kotlin.jvm.JvmVersion
public fun <T> Array<out T>.copyOf(): Array<out T> {
return Arrays.copyOf(this, size)
}
/**
* Returns new array which is a copy of the original array.
*/
@@ -11335,14 +11327,6 @@ public fun <T> Array<T>.copyOf(): Array<T> {
return Arrays.copyOf(this, size)
}
/**
* Returns new array which is a copy of the original array.
*/
@kotlin.jvm.JvmVersion
public fun <T> Array<out T>.copyOf(newSize: Int): Array<out T?> {
return Arrays.copyOf(this, newSize)
}
/**
* Returns new array which is a copy of the original array.
*/
@@ -11416,14 +11400,6 @@ public fun <T> Array<T>.copyOf(newSize: Int): Array<T?> {
return Arrays.copyOf(this, newSize)
}
/**
* Returns new array which is a copy of range of original array.
*/
@kotlin.jvm.JvmVersion
public fun <T> Array<out T>.copyOfRange(fromIndex: Int, toIndex: Int): Array<out T> {
return Arrays.copyOfRange(this, fromIndex, toIndex)
}
/**
* Returns new array which is a copy of range of original array.
*/
@@ -502,6 +502,7 @@ public fun <T : Any> sequence(nextFunction: () -> T?): Sequence<T> {
*
* The sequence can be iterated multiple times, each time starting with the [initialValue].
*/
@kotlin.internal.LowPriorityInOverloadResolution
public fun <T : Any> sequence(initialValue: T?, nextFunction: (T) -> T?): Sequence<T> =
if (initialValue == null)
EmptySequence