From c1975d0b2e0e7cc3fa051a1c04922320b3fd886f Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Tue, 21 Jul 2015 02:36:16 +0300 Subject: [PATCH] Array.fill returns Unit since it's an in-place array operation. Revised #KT-4760 --- libraries/stdlib/src/generated/_SpecialJVM.kt | 27 +++++++------------ .../src/templates/SpecialJVM.kt | 3 +-- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/libraries/stdlib/src/generated/_SpecialJVM.kt b/libraries/stdlib/src/generated/_SpecialJVM.kt index 260d2271b8b..135cb18ece9 100644 --- a/libraries/stdlib/src/generated/_SpecialJVM.kt +++ b/libraries/stdlib/src/generated/_SpecialJVM.kt @@ -409,73 +409,64 @@ public fun Array.copyOfRange(from: Int, to: Int): Array { /** * Fills original array with the provided value. */ -public fun BooleanArray.fill(element: Boolean): BooleanArray { +public fun BooleanArray.fill(element: Boolean): Unit { Arrays.fill(this, element) - return this } /** * Fills original array with the provided value. */ -public fun ByteArray.fill(element: Byte): ByteArray { +public fun ByteArray.fill(element: Byte): Unit { Arrays.fill(this, element) - return this } /** * Fills original array with the provided value. */ -public fun CharArray.fill(element: Char): CharArray { +public fun CharArray.fill(element: Char): Unit { Arrays.fill(this, element) - return this } /** * Fills original array with the provided value. */ -public fun DoubleArray.fill(element: Double): DoubleArray { +public fun DoubleArray.fill(element: Double): Unit { Arrays.fill(this, element) - return this } /** * Fills original array with the provided value. */ -public fun FloatArray.fill(element: Float): FloatArray { +public fun FloatArray.fill(element: Float): Unit { Arrays.fill(this, element) - return this } /** * Fills original array with the provided value. */ -public fun IntArray.fill(element: Int): IntArray { +public fun IntArray.fill(element: Int): Unit { Arrays.fill(this, element) - return this } /** * Fills original array with the provided value. */ -public fun LongArray.fill(element: Long): LongArray { +public fun LongArray.fill(element: Long): Unit { Arrays.fill(this, element) - return this } /** * Fills original array with the provided value. */ -public fun ShortArray.fill(element: Short): ShortArray { +public fun ShortArray.fill(element: Short): Unit { Arrays.fill(this, element) - return this } /** * Fills original array with the provided value. */ -public fun Array.fill(element: T): Array { +public fun Array.fill(element: T): Unit { Arrays.fill(this, element) - return this } /** diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/SpecialJVM.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/SpecialJVM.kt index 829947d49b7..c8bb90feff2 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/SpecialJVM.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/SpecialJVM.kt @@ -86,11 +86,10 @@ fun specialJVM(): List { templates add f("fill(element: T)") { only(InvariantArraysOfObjects, ArraysOfPrimitives) doc { "Fills original array with the provided value." } - returns { "SELF" } + returns { "Unit" } body { """ Arrays.fill(this, element) - return this """ } }