Stabilize unsigned types KT-45653

Deprecate specialized unsigned iterators for removal.

Fix compiler tests:
- drop unsignedLiteralsOn1_2 because apiVersion 1.2 is no longer supported
- drop experimental unsigned literals diagnostic test
This commit is contained in:
Ilya Gorbunov
2021-03-19 20:38:02 +03:00
parent 768c165a72
commit 94240f7b21
63 changed files with 1305 additions and 1461 deletions
@@ -14,8 +14,8 @@ import kotlin.internal.*
/**
* A range of values of type `UInt`.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
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
@@ -47,8 +47,8 @@ public class UIntRange(start: UInt, endInclusive: UInt) : UIntProgression(start,
/**
* A progression of values of type `UInt`.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public open class UIntProgression
internal constructor(
start: UInt,
@@ -75,7 +75,7 @@ internal constructor(
*/
public val step: Int = step
override fun iterator(): UIntIterator = UIntProgressionIterator(first, last, step)
final override fun iterator(): Iterator<UInt> = UIntProgressionIterator(first, last, step)
/**
* Checks if the progression is empty.
@@ -113,7 +113,7 @@ internal constructor(
* @property step the number by which the value is incremented on each step.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@Suppress("DEPRECATION_ERROR")
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