KT-53778 Remove experimental annotations from open ranges

This commit is contained in:
Ilya Gorbunov
2023-04-11 18:42:07 +02:00
committed by Space Team
parent 9953991c4c
commit b35b727d73
42 changed files with 516 additions and 540 deletions
@@ -467,7 +467,7 @@ abstract class BasePrimitivesGenerator(private val writer: PrintWriter) : BuiltI
If the [other] value is less than or equal to `this` value, then the returned range is empty.
""".trimIndent()
)
annotations += mutableListOf("SinceKotlin(\"1.7\")", "ExperimentalStdlibApi")
annotations += mutableListOf("SinceKotlin(\"1.9\")", "WasExperimental(ExperimentalStdlibApi::class)")
signature {
isOperator = true
methodName = "rangeUntil"
+4 -16
View File
@@ -1,17 +1,6 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2010-2023 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.
*/
package org.jetbrains.kotlin.generators.builtins.ranges
@@ -54,14 +43,13 @@ class GenerateRanges(out: PrintWriter) : BuiltInsSourceGenerator(out) {
"""/**
* A range of values of type `$t`.
*/
@OptIn(ExperimentalStdlibApi::class)
public class $range(start: $t, endInclusive: $t) : ${t}Progression(start, endInclusive, $increment), ClosedRange<$t>, OpenEndRange<$t> {
override val start: $t get() = first
override val endInclusive: $t get() = last
@Deprecated("Can throw an exception when it's impossible to represent the value with $t type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.")
@SinceKotlin("1.7")
@ExperimentalStdlibApi
@SinceKotlin("1.9")
@WasExperimental(ExperimentalStdlibApi::class)
override val endExclusive: $t get() {
if (last == $t.MAX_VALUE) error("Cannot return the exclusive upper bound of a range that includes MAX_VALUE.")
return last + 1
+5 -6
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2023 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.
*/
@@ -230,8 +230,8 @@ class UnsignedTypeGenerator(val type: UnsignedType, out: PrintWriter) : BuiltIns
out.println(" *")
out.println(" * If the [other] value is less than or equal to `this` value, then the returned range is empty.")
out.println(" */")
out.println(" @SinceKotlin(\"1.7\")")
out.println(" @ExperimentalStdlibApi")
out.println(" @SinceKotlin(\"1.9\")")
out.println(" @WasExperimental(ExperimentalStdlibApi::class)")
out.println(" @kotlin.internal.InlineOnly")
out.println(" public inline operator fun rangeUntil(other: $className): $rangeType = ${convert("this")} until ${convert("other")}")
out.println()
@@ -569,14 +569,13 @@ import kotlin.internal.*
*/
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
@OptIn(ExperimentalStdlibApi::class)
public class ${elementType}Range(start: $elementType, endInclusive: $elementType) : ${elementType}Progression(start, endInclusive, 1), ClosedRange<${elementType}>, OpenEndRange<${elementType}> {
override val start: $elementType get() = first
override val endInclusive: $elementType get() = last
@SinceKotlin("1.7")
@ExperimentalStdlibApi
@Deprecated("Can throw an exception when it's impossible to represent the value with $elementType type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.")
@SinceKotlin("1.9")
@WasExperimental(ExperimentalStdlibApi::class)
override val endExclusive: $elementType get() {
if (last == $elementType.MAX_VALUE) error("Cannot return the exclusive upper bound of a range that includes MAX_VALUE.")
return last + 1u