Remove redundant clause from 'until' function docs

This commit is contained in:
Ilya Gorbunov
2018-12-22 07:26:39 +03:00
parent 022b21efa0
commit 9289a2c573
3 changed files with 22 additions and 47 deletions
@@ -653,7 +653,7 @@ internal fun Float.toShortExactOrNull(): Short? {
/**
* Returns a range from this value up to but excluding the specified [to] value.
*
* If the [to] value is less than or equal to `this` value the returned range is empty.
* If the [to] value is less than or equal to `this` value, then the returned range is empty.
*/
public infix fun Int.until(to: Byte): IntRange {
return this .. (to.toInt() - 1).toInt()
@@ -662,7 +662,7 @@ public infix fun Int.until(to: Byte): IntRange {
/**
* Returns a range from this value up to but excluding the specified [to] value.
*
* If the [to] value is less than or equal to `this` value the returned range is empty.
* If the [to] value is less than or equal to `this` value, then the returned range is empty.
*/
public infix fun Long.until(to: Byte): LongRange {
return this .. (to.toLong() - 1).toLong()
@@ -671,7 +671,7 @@ public infix fun Long.until(to: Byte): LongRange {
/**
* Returns a range from this value up to but excluding the specified [to] value.
*
* If the [to] value is less than or equal to `this` value the returned range is empty.
* If the [to] value is less than or equal to `this` value, then the returned range is empty.
*/
public infix fun Byte.until(to: Byte): IntRange {
return this.toInt() .. (to.toInt() - 1).toInt()
@@ -680,7 +680,7 @@ public infix fun Byte.until(to: Byte): IntRange {
/**
* Returns a range from this value up to but excluding the specified [to] value.
*
* If the [to] value is less than or equal to `this` value the returned range is empty.
* If the [to] value is less than or equal to `this` value, then the returned range is empty.
*/
public infix fun Short.until(to: Byte): IntRange {
return this.toInt() .. (to.toInt() - 1).toInt()
@@ -689,9 +689,7 @@ public infix fun Short.until(to: Byte): IntRange {
/**
* Returns a range from this value up to but excluding the specified [to] value.
*
* If the [to] value is less than or equal to `this` value the returned range is empty.
*
* If the [to] value is less than or equal to `'\u0000'` the returned range is empty.
* If the [to] value is less than or equal to `this` value, then the returned range is empty.
*/
public infix fun Char.until(to: Char): CharRange {
if (to <= '\u0000') return CharRange.EMPTY
@@ -701,9 +699,7 @@ public infix fun Char.until(to: Char): CharRange {
/**
* Returns a range from this value up to but excluding the specified [to] value.
*
* If the [to] value is less than or equal to `this` value the returned range is empty.
*
* If the [to] value is less than or equal to [Int.MIN_VALUE] the returned range is empty.
* If the [to] value is less than or equal to `this` value, then the returned range is empty.
*/
public infix fun Int.until(to: Int): IntRange {
if (to <= Int.MIN_VALUE) return IntRange.EMPTY
@@ -713,7 +709,7 @@ public infix fun Int.until(to: Int): IntRange {
/**
* Returns a range from this value up to but excluding the specified [to] value.
*
* If the [to] value is less than or equal to `this` value the returned range is empty.
* If the [to] value is less than or equal to `this` value, then the returned range is empty.
*/
public infix fun Long.until(to: Int): LongRange {
return this .. (to.toLong() - 1).toLong()
@@ -722,9 +718,7 @@ public infix fun Long.until(to: Int): LongRange {
/**
* Returns a range from this value up to but excluding the specified [to] value.
*
* If the [to] value is less than or equal to `this` value the returned range is empty.
*
* If the [to] value is less than or equal to [Int.MIN_VALUE] the returned range is empty.
* If the [to] value is less than or equal to `this` value, then the returned range is empty.
*/
public infix fun Byte.until(to: Int): IntRange {
if (to <= Int.MIN_VALUE) return IntRange.EMPTY
@@ -734,9 +728,7 @@ public infix fun Byte.until(to: Int): IntRange {
/**
* Returns a range from this value up to but excluding the specified [to] value.
*
* If the [to] value is less than or equal to `this` value the returned range is empty.
*
* If the [to] value is less than or equal to [Int.MIN_VALUE] the returned range is empty.
* If the [to] value is less than or equal to `this` value, then the returned range is empty.
*/
public infix fun Short.until(to: Int): IntRange {
if (to <= Int.MIN_VALUE) return IntRange.EMPTY
@@ -746,9 +738,7 @@ public infix fun Short.until(to: Int): IntRange {
/**
* Returns a range from this value up to but excluding the specified [to] value.
*
* If the [to] value is less than or equal to `this` value the returned range is empty.
*
* If the [to] value is less than or equal to [Long.MIN_VALUE] the returned range is empty.
* If the [to] value is less than or equal to `this` value, then the returned range is empty.
*/
public infix fun Int.until(to: Long): LongRange {
if (to <= Long.MIN_VALUE) return LongRange.EMPTY
@@ -758,9 +748,7 @@ public infix fun Int.until(to: Long): LongRange {
/**
* Returns a range from this value up to but excluding the specified [to] value.
*
* If the [to] value is less than or equal to `this` value the returned range is empty.
*
* If the [to] value is less than or equal to [Long.MIN_VALUE] the returned range is empty.
* If the [to] value is less than or equal to `this` value, then the returned range is empty.
*/
public infix fun Long.until(to: Long): LongRange {
if (to <= Long.MIN_VALUE) return LongRange.EMPTY
@@ -770,9 +758,7 @@ public infix fun Long.until(to: Long): LongRange {
/**
* Returns a range from this value up to but excluding the specified [to] value.
*
* If the [to] value is less than or equal to `this` value the returned range is empty.
*
* If the [to] value is less than or equal to [Long.MIN_VALUE] the returned range is empty.
* If the [to] value is less than or equal to `this` value, then the returned range is empty.
*/
public infix fun Byte.until(to: Long): LongRange {
if (to <= Long.MIN_VALUE) return LongRange.EMPTY
@@ -782,9 +768,7 @@ public infix fun Byte.until(to: Long): LongRange {
/**
* Returns a range from this value up to but excluding the specified [to] value.
*
* If the [to] value is less than or equal to `this` value the returned range is empty.
*
* If the [to] value is less than or equal to [Long.MIN_VALUE] the returned range is empty.
* If the [to] value is less than or equal to `this` value, then the returned range is empty.
*/
public infix fun Short.until(to: Long): LongRange {
if (to <= Long.MIN_VALUE) return LongRange.EMPTY
@@ -794,7 +778,7 @@ public infix fun Short.until(to: Long): LongRange {
/**
* Returns a range from this value up to but excluding the specified [to] value.
*
* If the [to] value is less than or equal to `this` value the returned range is empty.
* If the [to] value is less than or equal to `this` value, then the returned range is empty.
*/
public infix fun Int.until(to: Short): IntRange {
return this .. (to.toInt() - 1).toInt()
@@ -803,7 +787,7 @@ public infix fun Int.until(to: Short): IntRange {
/**
* Returns a range from this value up to but excluding the specified [to] value.
*
* If the [to] value is less than or equal to `this` value the returned range is empty.
* If the [to] value is less than or equal to `this` value, then the returned range is empty.
*/
public infix fun Long.until(to: Short): LongRange {
return this .. (to.toLong() - 1).toLong()
@@ -812,7 +796,7 @@ public infix fun Long.until(to: Short): LongRange {
/**
* Returns a range from this value up to but excluding the specified [to] value.
*
* If the [to] value is less than or equal to `this` value the returned range is empty.
* If the [to] value is less than or equal to `this` value, then the returned range is empty.
*/
public infix fun Byte.until(to: Short): IntRange {
return this.toInt() .. (to.toInt() - 1).toInt()
@@ -821,7 +805,7 @@ public infix fun Byte.until(to: Short): IntRange {
/**
* Returns a range from this value up to but excluding the specified [to] value.
*
* If the [to] value is less than or equal to `this` value the returned range is empty.
* If the [to] value is less than or equal to `this` value, then the returned range is empty.
*/
public infix fun Short.until(to: Short): IntRange {
return this.toInt() .. (to.toInt() - 1).toInt()
@@ -182,7 +182,7 @@ public infix fun ULongProgression.step(step: Long): ULongProgression {
/**
* Returns a range from this value up to but excluding the specified [to] value.
*
* If the [to] value is less than or equal to `this` value the returned range is empty.
* If the [to] value is less than or equal to `this` value, then the returned range is empty.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@@ -193,9 +193,7 @@ public infix fun UByte.until(to: UByte): UIntRange {
/**
* Returns a range from this value up to but excluding the specified [to] value.
*
* If the [to] value is less than or equal to `this` value the returned range is empty.
*
* If the [to] value is less than or equal to [UInt.MIN_VALUE] the returned range is empty.
* If the [to] value is less than or equal to `this` value, then the returned range is empty.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@@ -207,9 +205,7 @@ public infix fun UInt.until(to: UInt): UIntRange {
/**
* Returns a range from this value up to but excluding the specified [to] value.
*
* If the [to] value is less than or equal to `this` value the returned range is empty.
*
* If the [to] value is less than or equal to [ULong.MIN_VALUE] the returned range is empty.
* If the [to] value is less than or equal to `this` value, then the returned range is empty.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@@ -221,7 +217,7 @@ public infix fun ULong.until(to: ULong): ULongRange {
/**
* Returns a range from this value up to but excluding the specified [to] value.
*
* If the [to] value is less than or equal to `this` value the returned range is empty.
* If the [to] value is less than or equal to `this` value, then the returned range is empty.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@@ -116,17 +116,12 @@ object RangeOps : TemplateGroupBase() {
val progressionType = elementType.name + "Range"
returns(progressionType)
val minValue = if (elementType == PrimitiveType.Char) "'\\u0000'" else "$elementType.MIN_VALUE"
val minValueRef = if (elementType == PrimitiveType.Char) "`$minValue`" else "[$minValue]"
doc {
"""
Returns a range from this value up to but excluding the specified [to] value.
If the [to] value is less than or equal to `this` value the returned range is empty.
${textWhen(elementType == toType) {
"If the [to] value is less than or equal to $minValueRef the returned range is empty."
}}
If the [to] value is less than or equal to `this` value, then the returned range is empty.
"""
}