Make unsigned types experimental (with warning if not opted-in)

This commit is contained in:
Ilya Gorbunov
2018-07-03 14:56:26 +03:00
parent 71292bd681
commit b5fabf3f72
15 changed files with 78 additions and 0 deletions
@@ -15,6 +15,7 @@ import kotlin.internal.*
* A range of values of type `UInt`.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
public class UIntRange(start: UInt, endInclusive: UInt) : UIntProgression(start, endInclusive, 1), ClosedRange<UInt> {
override val start: UInt get() = first
override val endInclusive: UInt get() = last
@@ -42,6 +43,7 @@ public class UIntRange(start: UInt, endInclusive: UInt) : UIntProgression(start,
* A progression of values of type `UInt`.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
public open class UIntProgression
internal constructor(
start: UInt,
@@ -98,6 +100,7 @@ internal constructor(
* @property step the number by which the value is incremented on each step.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
private class UIntProgressionIterator(first: UInt, last: UInt, step: Int) : UIntIterator() {
private val finalElement = last
private var hasNext: Boolean = if (step > 0) first <= last else first >= last