Allow to specify optional from and to indices for filling an array.

#KT-8382 Fixed
This commit is contained in:
Ilya Gorbunov
2015-07-21 02:28:19 +03:00
parent c1975d0b2e
commit 46858ddabd
2 changed files with 20 additions and 20 deletions
@@ -83,13 +83,13 @@ fun specialJVM(): List<GenericFunction> {
annotations(InvariantArraysOfObjects) { """platformName("mutableCopyOf")"""}
}
templates add f("fill(element: T)") {
templates add f("fill(element: T, fromIndex: Int = 0, toIndex: Int = size())") {
only(InvariantArraysOfObjects, ArraysOfPrimitives)
doc { "Fills original array with the provided value." }
returns { "Unit" }
body {
"""
Arrays.fill(this, element)
Arrays.fill(this, fromIndex, toIndex, element)
"""
}
}