Correctly indent upper bound separator in the generated stdlib code

This commit is contained in:
Ilya Gorbunov
2018-04-20 23:10:47 +03:00
parent 5381d0ed58
commit c239d346f7
15 changed files with 48 additions and 48 deletions
@@ -6139,7 +6139,7 @@ public expect fun CharArray.sort(): Unit
/**
* Sorts the array in-place according to the natural order of its elements.
*/
public expect fun <T: Comparable<T>> Array<out T>.sort(): Unit
public expect fun <T : Comparable<T>> Array<out T>.sort(): Unit
/**
* Sorts the array in-place according to the order specified by the given [comparator].
@@ -11304,7 +11304,7 @@ public inline fun CharArray.none(predicate: (Char) -> Boolean): Boolean {
/**
* Accumulates value starting with the first element and applying [operation] from left to right to current accumulator value and each element.
*/
public inline fun <S, T: S> Array<out T>.reduce(operation: (acc: S, T) -> S): S {
public inline fun <S, T : S> Array<out T>.reduce(operation: (acc: S, T) -> S): S {
if (isEmpty())
throw UnsupportedOperationException("Empty array can't be reduced.")
var accumulator: S = this[0]
@@ -11424,7 +11424,7 @@ public inline fun CharArray.reduce(operation: (acc: Char, Char) -> Char): Char {
* @param [operation] function that takes the index of an element, current accumulator value
* and the element itself and calculates the next accumulator value.
*/
public inline fun <S, T: S> Array<out T>.reduceIndexed(operation: (index: Int, acc: S, T) -> S): S {
public inline fun <S, T : S> Array<out T>.reduceIndexed(operation: (index: Int, acc: S, T) -> S): S {
if (isEmpty())
throw UnsupportedOperationException("Empty array can't be reduced.")
var accumulator: S = this[0]
@@ -11565,7 +11565,7 @@ public inline fun CharArray.reduceIndexed(operation: (index: Int, acc: Char, Cha
/**
* Accumulates value starting with last element and applying [operation] from right to left to each element and current accumulator value.
*/
public inline fun <S, T: S> Array<out T>.reduceRight(operation: (T, acc: S) -> S): S {
public inline fun <S, T : S> Array<out T>.reduceRight(operation: (T, acc: S) -> S): S {
var index = lastIndex
if (index < 0) throw UnsupportedOperationException("Empty array can't be reduced.")
var accumulator: S = get(index--)
@@ -11685,7 +11685,7 @@ public inline fun CharArray.reduceRight(operation: (Char, acc: Char) -> Char): C
* @param [operation] function that takes the index of an element, the element itself
* and current accumulator value, and calculates the next accumulator value.
*/
public inline fun <S, T: S> Array<out T>.reduceRightIndexed(operation: (index: Int, T, acc: S) -> S): S {
public inline fun <S, T : S> Array<out T>.reduceRightIndexed(operation: (index: Int, T, acc: S) -> S): S {
var index = lastIndex
if (index < 0) throw UnsupportedOperationException("Empty array can't be reduced.")
var accumulator: S = get(index--)
@@ -1698,7 +1698,7 @@ public inline fun <T, C : Iterable<T>> C.onEach(action: (T) -> Unit): C {
/**
* Accumulates value starting with the first element and applying [operation] from left to right to current accumulator value and each element.
*/
public inline fun <S, T: S> Iterable<T>.reduce(operation: (acc: S, T) -> S): S {
public inline fun <S, T : S> Iterable<T>.reduce(operation: (acc: S, T) -> S): S {
val iterator = this.iterator()
if (!iterator.hasNext()) throw UnsupportedOperationException("Empty collection can't be reduced.")
var accumulator: S = iterator.next()
@@ -1714,7 +1714,7 @@ public inline fun <S, T: S> Iterable<T>.reduce(operation: (acc: S, T) -> S): S {
* @param [operation] function that takes the index of an element, current accumulator value
* and the element itself and calculates the next accumulator value.
*/
public inline fun <S, T: S> Iterable<T>.reduceIndexed(operation: (index: Int, acc: S, T) -> S): S {
public inline fun <S, T : S> Iterable<T>.reduceIndexed(operation: (index: Int, acc: S, T) -> S): S {
val iterator = this.iterator()
if (!iterator.hasNext()) throw UnsupportedOperationException("Empty collection can't be reduced.")
var index = 1
@@ -1728,7 +1728,7 @@ public inline fun <S, T: S> Iterable<T>.reduceIndexed(operation: (index: Int, ac
/**
* Accumulates value starting with last element and applying [operation] from right to left to each element and current accumulator value.
*/
public inline fun <S, T: S> List<T>.reduceRight(operation: (T, acc: S) -> S): S {
public inline fun <S, T : S> List<T>.reduceRight(operation: (T, acc: S) -> S): S {
val iterator = listIterator(size)
if (!iterator.hasPrevious())
throw UnsupportedOperationException("Empty list can't be reduced.")
@@ -1745,7 +1745,7 @@ public inline fun <S, T: S> List<T>.reduceRight(operation: (T, acc: S) -> S): S
* @param [operation] function that takes the index of an element, the element itself
* and current accumulator value, and calculates the next accumulator value.
*/
public inline fun <S, T: S> List<T>.reduceRightIndexed(operation: (index: Int, T, acc: S) -> S): S {
public inline fun <S, T : S> List<T>.reduceRightIndexed(operation: (index: Int, T, acc: S) -> S): S {
val iterator = listIterator(size)
if (!iterator.hasPrevious())
throw UnsupportedOperationException("Empty list can't be reduced.")
@@ -17,7 +17,7 @@ import kotlin.comparisons.*
* If values are equal, returns the first one.
*/
@SinceKotlin("1.1")
public expect fun <T: Comparable<T>> maxOf(a: T, b: T): T
public expect fun <T : Comparable<T>> maxOf(a: T, b: T): T
/**
* Returns the greater of two values.
@@ -65,7 +65,7 @@ public expect inline fun maxOf(a: Double, b: Double): Double
* Returns the greater of three values.
*/
@SinceKotlin("1.1")
public expect fun <T: Comparable<T>> maxOf(a: T, b: T, c: T): T
public expect fun <T : Comparable<T>> maxOf(a: T, b: T, c: T): T
/**
* Returns the greater of three values.
@@ -131,7 +131,7 @@ public fun <T> maxOf(a: T, b: T, comparator: Comparator<in T>): T {
* If values are equal, returns the first one.
*/
@SinceKotlin("1.1")
public expect fun <T: Comparable<T>> minOf(a: T, b: T): T
public expect fun <T : Comparable<T>> minOf(a: T, b: T): T
/**
* Returns the smaller of two values.
@@ -179,7 +179,7 @@ public expect inline fun minOf(a: Double, b: Double): Double
* Returns the smaller of three values.
*/
@SinceKotlin("1.1")
public expect fun <T: Comparable<T>> minOf(a: T, b: T, c: T): T
public expect fun <T : Comparable<T>> minOf(a: T, b: T, c: T): T
/**
* Returns the smaller of three values.
@@ -707,7 +707,7 @@ public infix fun Short.until(to: Short): IntRange {
*
* @sample samples.comparisons.ComparableOps.coerceAtLeastComparable
*/
public fun <T: Comparable<T>> T.coerceAtLeast(minimumValue: T): T {
public fun <T : Comparable<T>> T.coerceAtLeast(minimumValue: T): T {
return if (this < minimumValue) minimumValue else this
}
@@ -784,7 +784,7 @@ public fun Double.coerceAtLeast(minimumValue: Double): Double {
*
* @sample samples.comparisons.ComparableOps.coerceAtMostComparable
*/
public fun <T: Comparable<T>> T.coerceAtMost(maximumValue: T): T {
public fun <T : Comparable<T>> T.coerceAtMost(maximumValue: T): T {
return if (this > maximumValue) maximumValue else this
}
@@ -861,7 +861,7 @@ public fun Double.coerceAtMost(maximumValue: Double): Double {
*
* @sample samples.comparisons.ComparableOps.coerceInComparable
*/
public fun <T: Comparable<T>> T.coerceIn(minimumValue: T?, maximumValue: T?): T {
public fun <T : Comparable<T>> T.coerceIn(minimumValue: T?, maximumValue: T?): T {
if (minimumValue !== null && maximumValue !== null) {
if (minimumValue > maximumValue) throw IllegalArgumentException("Cannot coerce value to an empty range: maximum $maximumValue is less than minimum $minimumValue.")
if (this < minimumValue) return minimumValue
@@ -966,7 +966,7 @@ public fun Double.coerceIn(minimumValue: Double, maximumValue: Double): Double {
* @sample samples.comparisons.ComparableOps.coerceInFloatingPointRange
*/
@SinceKotlin("1.1")
public fun <T: Comparable<T>> T.coerceIn(range: ClosedFloatingPointRange<T>): T {
public fun <T : Comparable<T>> T.coerceIn(range: ClosedFloatingPointRange<T>): T {
if (range.isEmpty()) throw IllegalArgumentException("Cannot coerce value to an empty range: $range.")
return when {
// this < start equiv to this <= start && !(this >= start)
@@ -984,7 +984,7 @@ public fun <T: Comparable<T>> T.coerceIn(range: ClosedFloatingPointRange<T>): T
*
* @sample samples.comparisons.ComparableOps.coerceInComparable
*/
public fun <T: Comparable<T>> T.coerceIn(range: ClosedRange<T>): T {
public fun <T : Comparable<T>> T.coerceIn(range: ClosedRange<T>): T {
if (range is ClosedFloatingPointRange) {
return this.coerceIn<T>(range)
}
@@ -1264,7 +1264,7 @@ public fun <T> Sequence<T>.onEach(action: (T) -> Unit): Sequence<T> {
*
* The operation is _terminal_.
*/
public inline fun <S, T: S> Sequence<T>.reduce(operation: (acc: S, T) -> S): S {
public inline fun <S, T : S> Sequence<T>.reduce(operation: (acc: S, T) -> S): S {
val iterator = this.iterator()
if (!iterator.hasNext()) throw UnsupportedOperationException("Empty sequence can't be reduced.")
var accumulator: S = iterator.next()
@@ -1282,7 +1282,7 @@ public inline fun <S, T: S> Sequence<T>.reduce(operation: (acc: S, T) -> S): S {
*
* The operation is _terminal_.
*/
public inline fun <S, T: S> Sequence<T>.reduceIndexed(operation: (index: Int, acc: S, T) -> S): S {
public inline fun <S, T : S> Sequence<T>.reduceIndexed(operation: (index: Int, acc: S, T) -> S): S {
val iterator = this.iterator()
if (!iterator.hasNext()) throw UnsupportedOperationException("Empty sequence can't be reduced.")
var index = 1
@@ -879,7 +879,7 @@ public actual fun CharArray.sort(): Unit {
/**
* Sorts the array in-place according to the natural order of its elements.
*/
public actual fun <T: Comparable<T>> Array<out T>.sort(): Unit {
public actual fun <T : Comparable<T>> Array<out T>.sort(): Unit {
if (size > 1)
sort { a: T, b: T -> a.compareTo(b) }
}
@@ -18,7 +18,7 @@ import kotlin.comparisons.*
* If values are equal, returns the first one.
*/
@SinceKotlin("1.1")
public actual fun <T: Comparable<T>> maxOf(a: T, b: T): T {
public actual fun <T : Comparable<T>> maxOf(a: T, b: T): T {
return if (a >= b) a else b
}
@@ -80,7 +80,7 @@ public actual inline fun maxOf(a: Double, b: Double): Double {
* Returns the greater of three values.
*/
@SinceKotlin("1.1")
public actual fun <T: Comparable<T>> maxOf(a: T, b: T, c: T): T {
public actual fun <T : Comparable<T>> maxOf(a: T, b: T, c: T): T {
return maxOf(a, maxOf(b, c))
}
@@ -143,7 +143,7 @@ public actual inline fun maxOf(a: Double, b: Double, c: Double): Double {
* If values are equal, returns the first one.
*/
@SinceKotlin("1.1")
public actual fun <T: Comparable<T>> minOf(a: T, b: T): T {
public actual fun <T : Comparable<T>> minOf(a: T, b: T): T {
return if (a <= b) a else b
}
@@ -205,7 +205,7 @@ public actual inline fun minOf(a: Double, b: Double): Double {
* Returns the smaller of three values.
*/
@SinceKotlin("1.1")
public actual fun <T: Comparable<T>> minOf(a: T, b: T, c: T): T {
public actual fun <T : Comparable<T>> minOf(a: T, b: T, c: T): T {
return minOf(a, minOf(b, c))
}
@@ -1212,7 +1212,7 @@ public actual fun CharArray.sort(): Unit {
* Sorts the array in-place according to the natural order of its elements.
*/
@kotlin.internal.InlineOnly
public actual inline fun <T: Comparable<T>> Array<out T>.sort(): Unit {
public actual inline fun <T : Comparable<T>> Array<out T>.sort(): Unit {
@Suppress("UNCHECKED_CAST")
(this as Array<Any?>).sort()
}
@@ -1387,7 +1387,7 @@ public actual fun CharArray.toTypedArray(): Array<Char> {
/**
* Returns a [SortedSet][java.util.SortedSet] of all elements.
*/
public fun <T: Comparable<T>> Array<out T>.toSortedSet(): java.util.SortedSet<T> {
public fun <T : Comparable<T>> Array<out T>.toSortedSet(): java.util.SortedSet<T> {
return toCollection(java.util.TreeSet<T>())
}
@@ -39,7 +39,7 @@ public actual fun <T> MutableList<T>.reverse(): Unit {
/**
* Returns a [SortedSet][java.util.SortedSet] of all elements.
*/
public fun <T: Comparable<T>> Iterable<T>.toSortedSet(): java.util.SortedSet<T> {
public fun <T : Comparable<T>> Iterable<T>.toSortedSet(): java.util.SortedSet<T> {
return toCollection(java.util.TreeSet<T>())
}
@@ -18,7 +18,7 @@ import kotlin.comparisons.*
* If values are equal, returns the first one.
*/
@SinceKotlin("1.1")
public actual fun <T: Comparable<T>> maxOf(a: T, b: T): T {
public actual fun <T : Comparable<T>> maxOf(a: T, b: T): T {
return if (a >= b) a else b
}
@@ -80,7 +80,7 @@ public actual inline fun maxOf(a: Double, b: Double): Double {
* Returns the greater of three values.
*/
@SinceKotlin("1.1")
public actual fun <T: Comparable<T>> maxOf(a: T, b: T, c: T): T {
public actual fun <T : Comparable<T>> maxOf(a: T, b: T, c: T): T {
return maxOf(a, maxOf(b, c))
}
@@ -143,7 +143,7 @@ public actual inline fun maxOf(a: Double, b: Double, c: Double): Double {
* If values are equal, returns the first one.
*/
@SinceKotlin("1.1")
public actual fun <T: Comparable<T>> minOf(a: T, b: T): T {
public actual fun <T : Comparable<T>> minOf(a: T, b: T): T {
return if (a <= b) a else b
}
@@ -205,7 +205,7 @@ public actual inline fun minOf(a: Double, b: Double): Double {
* Returns the smaller of three values.
*/
@SinceKotlin("1.1")
public actual fun <T: Comparable<T>> minOf(a: T, b: T, c: T): T {
public actual fun <T : Comparable<T>> minOf(a: T, b: T, c: T): T {
return minOf(a, minOf(b, c))
}
@@ -40,7 +40,7 @@ public fun <C : MutableCollection<in R>, R> Sequence<*>.filterIsInstanceTo(desti
*
* The operation is _terminal_.
*/
public fun <T: Comparable<T>> Sequence<T>.toSortedSet(): java.util.SortedSet<T> {
public fun <T : Comparable<T>> Sequence<T>.toSortedSet(): java.util.SortedSet<T> {
return toCollection(java.util.TreeSet<T>())
}
@@ -625,7 +625,7 @@ object Aggregates : TemplateGroupBase() {
"""
}
typeParam("S")
typeParam("T: S")
typeParam("T : S")
returns("S")
body {
"""
@@ -698,7 +698,7 @@ object Aggregates : TemplateGroupBase() {
"""
}
typeParam("S")
typeParam("T: S")
typeParam("T : S")
returns("S")
body {
"""
@@ -759,7 +759,7 @@ object Aggregates : TemplateGroupBase() {
doc { "Accumulates value starting with the first ${f.element} and applying [operation] from left to right to current accumulator value and each ${f.element}." }
typeParam("S")
typeParam("T: S")
typeParam("T : S")
returns("S")
body {
"""
@@ -815,7 +815,7 @@ object Aggregates : TemplateGroupBase() {
inline()
doc { "Accumulates value starting with last ${f.element} and applying [operation] from right to left to each ${f.element} and current accumulator value." }
typeParam("S")
typeParam("T: S")
typeParam("T : S")
returns("S")
body {
"""
@@ -496,7 +496,7 @@ object ArrayOps : TemplateGroupBase() {
include(ArraysOfPrimitives, PrimitiveType.numericPrimitives + PrimitiveType.Char)
include(ArraysOfObjects)
} builder {
typeParam("T: Comparable<T>")
typeParam("T : Comparable<T>")
doc { "Sorts the array in-place according to the natural order of its elements." }
specialFor(ArraysOfPrimitives) {
doc { "Sorts the array in-place." }
@@ -30,7 +30,7 @@ object ComparableOps : TemplateGroupBase() {
} builder {
sourceFile(SourceFile.Ranges)
returns("SELF")
typeParam("T: Comparable<T>")
typeParam("T : Comparable<T>")
doc {
"""
Ensures that this value is not less than the specified [minimumValue].
@@ -52,7 +52,7 @@ object ComparableOps : TemplateGroupBase() {
} builder {
sourceFile(SourceFile.Ranges)
returns("SELF")
typeParam("T: Comparable<T>")
typeParam("T : Comparable<T>")
doc {
"""
Ensures that this value is not greater than the specified [maximumValue].
@@ -74,7 +74,7 @@ object ComparableOps : TemplateGroupBase() {
} builder {
sourceFile(SourceFile.Ranges)
returns("SELF")
typeParam("T: Comparable<T>")
typeParam("T : Comparable<T>")
doc {
"""
Ensures that this value lies in the specified [range].
@@ -117,7 +117,7 @@ object ComparableOps : TemplateGroupBase() {
sourceFile(SourceFile.Ranges)
since("1.1")
returns("SELF")
typeParam("T: Comparable<T>")
typeParam("T : Comparable<T>")
doc {
"""
Ensures that this value lies in the specified [range].
@@ -147,7 +147,7 @@ object ComparableOps : TemplateGroupBase() {
} builder {
sourceFile(SourceFile.Comparisons)
since("1.1")
typeParam("T: Comparable<T>")
typeParam("T : Comparable<T>")
returns("T")
receiver("")
doc {
@@ -191,7 +191,7 @@ object ComparableOps : TemplateGroupBase() {
} builder {
sourceFile(SourceFile.Comparisons)
since("1.1")
typeParam("T: Comparable<T>")
typeParam("T : Comparable<T>")
returns("T")
receiver("")
specialFor(Primitives) { inlineOnly() }
@@ -261,7 +261,7 @@ object ComparableOps : TemplateGroupBase() {
} builder {
sourceFile(SourceFile.Comparisons)
since("1.1")
typeParam("T: Comparable<T>")
typeParam("T : Comparable<T>")
returns("T")
receiver("")
doc {
@@ -305,7 +305,7 @@ object ComparableOps : TemplateGroupBase() {
} builder {
sourceFile(SourceFile.Comparisons)
since("1.1")
typeParam("T: Comparable<T>")
typeParam("T : Comparable<T>")
returns("T")
receiver("")
specialFor(Primitives) { inlineOnly() }
@@ -377,7 +377,7 @@ object ComparableOps : TemplateGroupBase() {
sourceFile(SourceFile.Ranges)
specialFor(Generic) { signature("coerceIn(minimumValue: SELF?, maximumValue: SELF?)", notForSorting = true) }
typeParam("T: Comparable<T>")
typeParam("T : Comparable<T>")
returns("SELF")
doc {
"""
@@ -99,7 +99,7 @@ object Snapshots : TemplateGroupBase() {
include(CharSequences)
platforms(Platform.JVM)
} builder {
typeParam("T: Comparable<T>")
typeParam("T : Comparable<T>")
doc { "Returns a [SortedSet][java.util.SortedSet] of all ${f.element.pluralize()}." }
returns("java.util.SortedSet<T>")
body { "return toCollection(java.util.TreeSet<T>())" }