Fix several tests by adding missing stdlib pieces. (#239)

This commit is contained in:
Nikolay Igotti
2017-02-14 19:31:29 +03:00
committed by GitHub
parent 061a8a0b55
commit a7bad9a950
2 changed files with 115 additions and 12 deletions
+5 -1
View File
@@ -16,6 +16,10 @@ For an optimized compilation use -opt:
./dist/bin/konanc hello.kt -o hello -opt
For more tests, use:
For some tests, use:
./gradlew backend.native:tests:run
To run blackbox compiler tests from JVM Kotlin use (takes time):
./gradlew run_external
+110 -11
View File
@@ -491,17 +491,6 @@ public inline fun <T> Array<out T>.lastOrNull(predicate: (T) -> Boolean): T? {
return null
}
/**
* Returns the range of valid indices for the array.
*/
public val <T> Array<out T>.indices: IntRange
get() = IntRange(0, lastIndex)
/**
* Returns the last valid index for the array.
*/
public val <T> Array<out T>.lastIndex: Int
get() = size - 1
/**
* Applies the given [transform] function to each element of the original array
@@ -589,6 +578,61 @@ public fun Array<out Double>.sum(): Double {
// From _Arrays.kt.
/**
* Returns the range of valid indices for the array.
*/
public val <T> Array<out T>.indices: IntRange
get() = IntRange(0, lastIndex)
/**
* Returns the range of valid indices for the array.
*/
public val ByteArray.indices: IntRange
get() = IntRange(0, lastIndex)
/**
* Returns the range of valid indices for the array.
*/
public val ShortArray.indices: IntRange
get() = IntRange(0, lastIndex)
/**
* Returns the range of valid indices for the array.
*/
public val IntArray.indices: IntRange
get() = IntRange(0, lastIndex)
/**
* Returns the range of valid indices for the array.
*/
public val LongArray.indices: IntRange
get() = IntRange(0, lastIndex)
/**
* Returns the range of valid indices for the array.
*/
public val FloatArray.indices: IntRange
get() = IntRange(0, lastIndex)
/**
* Returns the range of valid indices for the array.
*/
public val DoubleArray.indices: IntRange
get() = IntRange(0, lastIndex)
/**
* Returns the range of valid indices for the array.
*/
public val BooleanArray.indices: IntRange
get() = IntRange(0, lastIndex)
/**
* Returns the range of valid indices for the array.
*/
public val CharArray.indices: IntRange
get() = IntRange(0, lastIndex)
/**
* Returns `true` if the array is empty.
*/
@@ -732,6 +776,61 @@ public inline fun CharArray.isNotEmpty(): Boolean {
return !isEmpty()
}
/**
* Returns the last valid index for the array.
*/
public val <T> Array<out T>.lastIndex: Int
get() = size - 1
/**
* Returns the last valid index for the array.
*/
public val ByteArray.lastIndex: Int
get() = size - 1
/**
* Returns the last valid index for the array.
*/
public val ShortArray.lastIndex: Int
get() = size - 1
/**
* Returns the last valid index for the array.
*/
public val IntArray.lastIndex: Int
get() = size - 1
/**
* Returns the last valid index for the array.
*/
public val LongArray.lastIndex: Int
get() = size - 1
/**
* Returns the last valid index for the array.
*/
public val FloatArray.lastIndex: Int
get() = size - 1
/**
* Returns the last valid index for the array.
*/
public val DoubleArray.lastIndex: Int
get() = size - 1
/**
* Returns the last valid index for the array.
*/
public val BooleanArray.lastIndex: Int
get() = size - 1
/**
* Returns the last valid index for the array.
*/
public val CharArray.lastIndex: Int
get() = size - 1
/**
* Appends all elements to the given [destination] collection.
*/