rangeUntil member operator in builtins #KT-52933
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@@ -53,6 +53,16 @@ internal constructor(private val value: Int) : Comparable<Char> {
|
||||
/** Creates a range from this value to the specified [other] value. */
|
||||
public operator fun rangeTo(other: Char): CharRange = CharRange(this, other)
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
*
|
||||
* If the [other] value is less than or equal to `this` value, then the returned range is empty.
|
||||
*/
|
||||
@SinceKotlin("1.7")
|
||||
@ExperimentalStdlibApi
|
||||
public operator fun rangeUntil(other: Char): CharRange = this until other
|
||||
|
||||
|
||||
/** Returns the value of this character as a `Byte`. */
|
||||
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code.toByte()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@@ -202,6 +202,42 @@ public class Byte private constructor() : Number(), Comparable<Byte> {
|
||||
/** Creates a range from this value to the specified [other] value. */
|
||||
public operator fun rangeTo(other: Long): LongRange
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
*
|
||||
* If the [other] value is less than or equal to `this` value, then the returned range is empty.
|
||||
*/
|
||||
@SinceKotlin("1.7")
|
||||
@ExperimentalStdlibApi
|
||||
public operator fun rangeUntil(other: Byte): IntRange
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
*
|
||||
* If the [other] value is less than or equal to `this` value, then the returned range is empty.
|
||||
*/
|
||||
@SinceKotlin("1.7")
|
||||
@ExperimentalStdlibApi
|
||||
public operator fun rangeUntil(other: Short): IntRange
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
*
|
||||
* If the [other] value is less than or equal to `this` value, then the returned range is empty.
|
||||
*/
|
||||
@SinceKotlin("1.7")
|
||||
@ExperimentalStdlibApi
|
||||
public operator fun rangeUntil(other: Int): IntRange
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
*
|
||||
* If the [other] value is less than or equal to `this` value, then the returned range is empty.
|
||||
*/
|
||||
@SinceKotlin("1.7")
|
||||
@ExperimentalStdlibApi
|
||||
public operator fun rangeUntil(other: Long): LongRange
|
||||
|
||||
/** Returns this value. */
|
||||
public override fun toByte(): Byte
|
||||
/**
|
||||
@@ -454,6 +490,42 @@ public class Short private constructor() : Number(), Comparable<Short> {
|
||||
/** Creates a range from this value to the specified [other] value. */
|
||||
public operator fun rangeTo(other: Long): LongRange
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
*
|
||||
* If the [other] value is less than or equal to `this` value, then the returned range is empty.
|
||||
*/
|
||||
@SinceKotlin("1.7")
|
||||
@ExperimentalStdlibApi
|
||||
public operator fun rangeUntil(other: Byte): IntRange
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
*
|
||||
* If the [other] value is less than or equal to `this` value, then the returned range is empty.
|
||||
*/
|
||||
@SinceKotlin("1.7")
|
||||
@ExperimentalStdlibApi
|
||||
public operator fun rangeUntil(other: Short): IntRange
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
*
|
||||
* If the [other] value is less than or equal to `this` value, then the returned range is empty.
|
||||
*/
|
||||
@SinceKotlin("1.7")
|
||||
@ExperimentalStdlibApi
|
||||
public operator fun rangeUntil(other: Int): IntRange
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
*
|
||||
* If the [other] value is less than or equal to `this` value, then the returned range is empty.
|
||||
*/
|
||||
@SinceKotlin("1.7")
|
||||
@ExperimentalStdlibApi
|
||||
public operator fun rangeUntil(other: Long): LongRange
|
||||
|
||||
/**
|
||||
* Converts this [Short] value to [Byte].
|
||||
*
|
||||
@@ -703,6 +775,42 @@ public class Int private constructor() : Number(), Comparable<Int> {
|
||||
/** Creates a range from this value to the specified [other] value. */
|
||||
public operator fun rangeTo(other: Long): LongRange
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
*
|
||||
* If the [other] value is less than or equal to `this` value, then the returned range is empty.
|
||||
*/
|
||||
@SinceKotlin("1.7")
|
||||
@ExperimentalStdlibApi
|
||||
public operator fun rangeUntil(other: Byte): IntRange = this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
*
|
||||
* If the [other] value is less than or equal to `this` value, then the returned range is empty.
|
||||
*/
|
||||
@SinceKotlin("1.7")
|
||||
@ExperimentalStdlibApi
|
||||
public operator fun rangeUntil(other: Short): IntRange = this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
*
|
||||
* If the [other] value is less than or equal to `this` value, then the returned range is empty.
|
||||
*/
|
||||
@SinceKotlin("1.7")
|
||||
@ExperimentalStdlibApi
|
||||
public operator fun rangeUntil(other: Int): IntRange = this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
*
|
||||
* If the [other] value is less than or equal to `this` value, then the returned range is empty.
|
||||
*/
|
||||
@SinceKotlin("1.7")
|
||||
@ExperimentalStdlibApi
|
||||
public operator fun rangeUntil(other: Long): LongRange = this until other
|
||||
|
||||
/**
|
||||
* Shifts this value left by the [bitCount] number of bits.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@@ -233,6 +233,42 @@ public class Long internal constructor(
|
||||
/** Creates a range from this value to the specified [other] value. */
|
||||
public operator fun rangeTo(other: Long): LongRange = LongRange(this, other)
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
*
|
||||
* If the [other] value is less than or equal to `this` value, then the returned range is empty.
|
||||
*/
|
||||
@SinceKotlin("1.7")
|
||||
@ExperimentalStdlibApi
|
||||
public operator fun rangeUntil(other: Byte): LongRange = this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
*
|
||||
* If the [other] value is less than or equal to `this` value, then the returned range is empty.
|
||||
*/
|
||||
@SinceKotlin("1.7")
|
||||
@ExperimentalStdlibApi
|
||||
public operator fun rangeUntil(other: Short): LongRange = this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
*
|
||||
* If the [other] value is less than or equal to `this` value, then the returned range is empty.
|
||||
*/
|
||||
@SinceKotlin("1.7")
|
||||
@ExperimentalStdlibApi
|
||||
public operator fun rangeUntil(other: Int): LongRange = this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
*
|
||||
* If the [other] value is less than or equal to `this` value, then the returned range is empty.
|
||||
*/
|
||||
@SinceKotlin("1.7")
|
||||
@ExperimentalStdlibApi
|
||||
public operator fun rangeUntil(other: Long): LongRange = this until other
|
||||
|
||||
/**
|
||||
* Shifts this value left by the [bitCount] number of bits.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user