[stdlib] Explicit visibility and return types: builtins

This commit is contained in:
Ilya Gorbunov
2023-09-19 14:24:45 +02:00
committed by Space Team
parent df190b1265
commit ab7c2f2196
15 changed files with 30 additions and 30 deletions
+1 -1
View File
@@ -20,5 +20,5 @@ package kotlin
* The type with only one value: the `Unit` object. This type corresponds to the `void` type in Java.
*/
public object Unit {
override fun toString() = "kotlin.Unit"
override fun toString(): String = "kotlin.Unit"
}
+1 -1
View File
@@ -27,7 +27,7 @@ class GenerateIterators(out: PrintWriter) : BuiltInsSourceGenerator(out) {
val s = kind.capitalized
out.println("/** An iterator over a sequence of values of type `$s`. */")
out.println("public abstract class ${s}Iterator : Iterator<$s> {" )
out.println(" override final fun next() = next$s()")
out.println(" final override fun next(): $s = next$s()")
out.println()
out.println(" /** Returns the next value in the sequence without boxing. */")
out.println(" public abstract fun next$s(): $s")
+1 -1
View File
@@ -106,7 +106,7 @@ public open class $progression
override fun toString(): String = ${"if (step > 0) \"\$first..\$last step \$step\" else \"\$first downTo \$last step \${-step}\""}
companion object {
public companion object {
/**
* Creates $progression within the specified bounds of a closed range.
*
+1 -1
View File
@@ -72,7 +72,7 @@ public class $range(start: $t, endInclusive: $t) : ${t}Progression(start, endInc
override fun toString(): String = $toString
companion object {
public companion object {
/** An empty range of values of type $t. */
public val EMPTY: $range = $range($emptyBounds)
}
+3 -3
View File
@@ -70,7 +70,7 @@ class UnsignedTypeGenerator(val type: UnsignedType, out: PrintWriter) : BuiltIns
out.println("@JvmInline")
out.println("public value class $className @kotlin.internal.IntrinsicConstEvaluation @PublishedApi internal constructor(@PublishedApi internal val data: $storageType) : Comparable<$className> {")
out.println()
out.println(""" companion object {
out.println(""" public companion object {
/**
* A constant holding the minimum value an instance of $className can have.
*/
@@ -599,7 +599,7 @@ public class ${elementType}Range(start: $elementType, endInclusive: $elementType
override fun toString(): String = "${'$'}first..${'$'}last"
companion object {
public companion object {
/** An empty range of values of type $elementType. */
public val EMPTY: ${elementType}Range = ${elementType}Range($elementType.MAX_VALUE, $elementType.MIN_VALUE)
}
@@ -655,7 +655,7 @@ internal constructor(
override fun toString(): String = if (step > 0) "${'$'}first..${'$'}last step ${'$'}step" else "${'$'}first downTo ${'$'}last step ${'$'}{-step}"
companion object {
public companion object {
/**
* Creates ${elementType}Progression within the specified bounds of a closed range.
@@ -10,7 +10,7 @@ package kotlin.collections
/** An iterator over a sequence of values of type `Byte`. */
public abstract class ByteIterator : Iterator<Byte> {
override final fun next() = nextByte()
final override fun next(): Byte = nextByte()
/** Returns the next value in the sequence without boxing. */
public abstract fun nextByte(): Byte
@@ -18,7 +18,7 @@ public abstract class ByteIterator : Iterator<Byte> {
/** An iterator over a sequence of values of type `Char`. */
public abstract class CharIterator : Iterator<Char> {
override final fun next() = nextChar()
final override fun next(): Char = nextChar()
/** Returns the next value in the sequence without boxing. */
public abstract fun nextChar(): Char
@@ -26,7 +26,7 @@ public abstract class CharIterator : Iterator<Char> {
/** An iterator over a sequence of values of type `Short`. */
public abstract class ShortIterator : Iterator<Short> {
override final fun next() = nextShort()
final override fun next(): Short = nextShort()
/** Returns the next value in the sequence without boxing. */
public abstract fun nextShort(): Short
@@ -34,7 +34,7 @@ public abstract class ShortIterator : Iterator<Short> {
/** An iterator over a sequence of values of type `Int`. */
public abstract class IntIterator : Iterator<Int> {
override final fun next() = nextInt()
final override fun next(): Int = nextInt()
/** Returns the next value in the sequence without boxing. */
public abstract fun nextInt(): Int
@@ -42,7 +42,7 @@ public abstract class IntIterator : Iterator<Int> {
/** An iterator over a sequence of values of type `Long`. */
public abstract class LongIterator : Iterator<Long> {
override final fun next() = nextLong()
final override fun next(): Long = nextLong()
/** Returns the next value in the sequence without boxing. */
public abstract fun nextLong(): Long
@@ -50,7 +50,7 @@ public abstract class LongIterator : Iterator<Long> {
/** An iterator over a sequence of values of type `Float`. */
public abstract class FloatIterator : Iterator<Float> {
override final fun next() = nextFloat()
final override fun next(): Float = nextFloat()
/** Returns the next value in the sequence without boxing. */
public abstract fun nextFloat(): Float
@@ -58,7 +58,7 @@ public abstract class FloatIterator : Iterator<Float> {
/** An iterator over a sequence of values of type `Double`. */
public abstract class DoubleIterator : Iterator<Double> {
override final fun next() = nextDouble()
final override fun next(): Double = nextDouble()
/** Returns the next value in the sequence without boxing. */
public abstract fun nextDouble(): Double
@@ -66,7 +66,7 @@ public abstract class DoubleIterator : Iterator<Double> {
/** An iterator over a sequence of values of type `Boolean`. */
public abstract class BooleanIterator : Iterator<Boolean> {
override final fun next() = nextBoolean()
final override fun next(): Boolean = nextBoolean()
/** Returns the next value in the sequence without boxing. */
public abstract fun nextBoolean(): Boolean
@@ -41,7 +41,7 @@ public class CharRange(start: Char, endInclusive: Char) : CharProgression(start,
override fun toString(): String = "$first..$last"
companion object {
public companion object {
/** An empty range of values of type Char. */
public val EMPTY: CharRange = CharRange(1.toChar(), 0.toChar())
}
@@ -80,7 +80,7 @@ public class IntRange(start: Int, endInclusive: Int) : IntProgression(start, end
override fun toString(): String = "$first..$last"
companion object {
public companion object {
/** An empty range of values of type Int. */
public val EMPTY: IntRange = IntRange(1, 0)
}
@@ -119,7 +119,7 @@ public class LongRange(start: Long, endInclusive: Long) : LongProgression(start,
override fun toString(): String = "$first..$last"
companion object {
public companion object {
/** An empty range of values of type Long. */
public val EMPTY: LongRange = LongRange(1, 0)
}
@@ -59,7 +59,7 @@ public open class CharProgression
override fun toString(): String = if (step > 0) "$first..$last step $step" else "$first downTo $last step ${-step}"
companion object {
public companion object {
/**
* Creates CharProgression within the specified bounds of a closed range.
*
@@ -121,7 +121,7 @@ public open class IntProgression
override fun toString(): String = if (step > 0) "$first..$last step $step" else "$first downTo $last step ${-step}"
companion object {
public companion object {
/**
* Creates IntProgression within the specified bounds of a closed range.
*
@@ -183,7 +183,7 @@ public open class LongProgression
override fun toString(): String = if (step > 0) "$first..$last step $step" else "$first downTo $last step ${-step}"
companion object {
public companion object {
/**
* Creates LongProgression within the specified bounds of a closed range.
*
+1 -1
View File
@@ -82,7 +82,7 @@ public interface ClosedFloatingPointRange<T : Comparable<T>> : ClosedRange<T> {
/**
* Compares two values of range domain type and returns true if first is less than or equal to second.
*/
fun lessThanOrEquals(a: T, b: T): Boolean
public fun lessThanOrEquals(a: T, b: T): Boolean
}
@@ -16,7 +16,7 @@ import kotlin.jvm.*
@JvmInline
public value class UByte @kotlin.internal.IntrinsicConstEvaluation @PublishedApi internal constructor(@PublishedApi internal val data: Byte) : Comparable<UByte> {
companion object {
public companion object {
/**
* A constant holding the minimum value an instance of UByte can have.
*/
+1 -1
View File
@@ -16,7 +16,7 @@ import kotlin.jvm.*
@JvmInline
public value class UInt @kotlin.internal.IntrinsicConstEvaluation @PublishedApi internal constructor(@PublishedApi internal val data: Int) : Comparable<UInt> {
companion object {
public companion object {
/**
* A constant holding the minimum value an instance of UInt can have.
*/
@@ -47,7 +47,7 @@ public class UIntRange(start: UInt, endInclusive: UInt) : UIntProgression(start,
override fun toString(): String = "$first..$last"
companion object {
public companion object {
/** An empty range of values of type UInt. */
public val EMPTY: UIntRange = UIntRange(UInt.MAX_VALUE, UInt.MIN_VALUE)
}
@@ -103,7 +103,7 @@ internal constructor(
override fun toString(): String = if (step > 0) "$first..$last step $step" else "$first downTo $last step ${-step}"
companion object {
public companion object {
/**
* Creates UIntProgression within the specified bounds of a closed range.
@@ -16,7 +16,7 @@ import kotlin.jvm.*
@JvmInline
public value class ULong @kotlin.internal.IntrinsicConstEvaluation @PublishedApi internal constructor(@PublishedApi internal val data: Long) : Comparable<ULong> {
companion object {
public companion object {
/**
* A constant holding the minimum value an instance of ULong can have.
*/
@@ -47,7 +47,7 @@ public class ULongRange(start: ULong, endInclusive: ULong) : ULongProgression(st
override fun toString(): String = "$first..$last"
companion object {
public companion object {
/** An empty range of values of type ULong. */
public val EMPTY: ULongRange = ULongRange(ULong.MAX_VALUE, ULong.MIN_VALUE)
}
@@ -103,7 +103,7 @@ internal constructor(
override fun toString(): String = if (step > 0) "$first..$last step $step" else "$first downTo $last step ${-step}"
companion object {
public companion object {
/**
* Creates ULongProgression within the specified bounds of a closed range.
@@ -16,7 +16,7 @@ import kotlin.jvm.*
@JvmInline
public value class UShort @kotlin.internal.IntrinsicConstEvaluation @PublishedApi internal constructor(@PublishedApi internal val data: Short) : Comparable<UShort> {
companion object {
public companion object {
/**
* A constant holding the minimum value an instance of UShort can have.
*/