Fix errors and indent in built-ins sources

This commit is contained in:
Alexander Udalov
2016-10-20 14:42:48 +03:00
parent 2076a31094
commit 3f5d3e5dbc
9 changed files with 263 additions and 235 deletions
+7 -7
View File
@@ -134,13 +134,13 @@ public final class Char : kotlin.Comparable<kotlin.Char> {
public final operator fun minus(/*0*/ other: kotlin.Int): kotlin.Char
public final operator fun plus(/*0*/ other: kotlin.Int): kotlin.Char
public final operator fun rangeTo(/*0*/ other: kotlin.Char): kotlin.ranges.CharRange
public open fun toByte(): kotlin.Byte
public open fun toChar(): kotlin.Char
public open fun toDouble(): kotlin.Double
public open fun toFloat(): kotlin.Float
public open fun toInt(): kotlin.Int
public open fun toLong(): kotlin.Long
public open fun toShort(): kotlin.Short
public final fun toByte(): kotlin.Byte
public final fun toChar(): kotlin.Char
public final fun toDouble(): kotlin.Double
public final fun toFloat(): kotlin.Float
public final fun toInt(): kotlin.Int
public final fun toLong(): kotlin.Long
public final fun toShort(): kotlin.Short
public companion object Companion {
/*primary*/ private constructor Companion()
+7 -7
View File
@@ -134,13 +134,13 @@ public final class Char : kotlin.Comparable<kotlin.Char>, java.io.Serializable {
public final operator fun minus(/*0*/ other: kotlin.Int): kotlin.Char
public final operator fun plus(/*0*/ other: kotlin.Int): kotlin.Char
public final operator fun rangeTo(/*0*/ other: kotlin.Char): kotlin.ranges.CharRange
public open fun toByte(): kotlin.Byte
public open fun toChar(): kotlin.Char
public open fun toDouble(): kotlin.Double
public open fun toFloat(): kotlin.Float
public open fun toInt(): kotlin.Int
public open fun toLong(): kotlin.Long
public open fun toShort(): kotlin.Short
public final fun toByte(): kotlin.Byte
public final fun toChar(): kotlin.Char
public final fun toDouble(): kotlin.Double
public final fun toFloat(): kotlin.Float
public final fun toInt(): kotlin.Int
public final fun toLong(): kotlin.Long
public final fun toShort(): kotlin.Short
public companion object Companion {
/*primary*/ private constructor Companion()
+7 -7
View File
@@ -134,13 +134,13 @@ public final class Char : kotlin.Comparable<kotlin.Char>, java.io.Serializable {
public final operator fun minus(/*0*/ other: kotlin.Int): kotlin.Char
public final operator fun plus(/*0*/ other: kotlin.Int): kotlin.Char
public final operator fun rangeTo(/*0*/ other: kotlin.Char): kotlin.ranges.CharRange
public open fun toByte(): kotlin.Byte
public open fun toChar(): kotlin.Char
public open fun toDouble(): kotlin.Double
public open fun toFloat(): kotlin.Float
public open fun toInt(): kotlin.Int
public open fun toLong(): kotlin.Long
public open fun toShort(): kotlin.Short
public final fun toByte(): kotlin.Byte
public final fun toChar(): kotlin.Char
public final fun toDouble(): kotlin.Double
public final fun toFloat(): kotlin.Float
public final fun toInt(): kotlin.Int
public final fun toLong(): kotlin.Long
public final fun toShort(): kotlin.Short
public companion object Companion {
/*primary*/ private constructor Companion()
+7 -7
View File
@@ -134,13 +134,13 @@ public final class Char : kotlin.Comparable<kotlin.Char>, java.io.Serializable {
public final operator fun minus(/*0*/ other: kotlin.Int): kotlin.Char
public final operator fun plus(/*0*/ other: kotlin.Int): kotlin.Char
public final operator fun rangeTo(/*0*/ other: kotlin.Char): kotlin.ranges.CharRange
public open fun toByte(): kotlin.Byte
public open fun toChar(): kotlin.Char
public open fun toDouble(): kotlin.Double
public open fun toFloat(): kotlin.Float
public open fun toInt(): kotlin.Int
public open fun toLong(): kotlin.Long
public open fun toShort(): kotlin.Short
public final fun toByte(): kotlin.Byte
public final fun toChar(): kotlin.Char
public final fun toDouble(): kotlin.Double
public final fun toFloat(): kotlin.Float
public final fun toInt(): kotlin.Int
public final fun toLong(): kotlin.Long
public final fun toShort(): kotlin.Short
public companion object Companion {
/*primary*/ private constructor Companion()
+1 -1
View File
@@ -20,7 +20,7 @@ package kotlin
* Represents a value which is either `true` or `false`. On the JVM, non-nullable values of this type are
* represented as values of the primitive type `boolean`.
*/
public class Boolean private () : Comparable<Boolean> {
public class Boolean private constructor() : Comparable<Boolean> {
/**
* Returns the inverse of this boolean.
*/
+8 -9
View File
@@ -20,8 +20,7 @@ package kotlin
* Represents a 16-bit Unicode character.
* On the JVM, non-nullable values of this type are represented as values of the primitive type `char`.
*/
public class Char private () : Comparable<Char> {
public class Char private constructor() : Comparable<Char> {
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
@@ -46,19 +45,19 @@ public class Char private () : Comparable<Char> {
public operator fun rangeTo(other: Char): CharRange
/** Returns the value of this character as a `Byte`. */
public override fun toByte(): Byte
public fun toByte(): Byte
/** Returns the value of this character as a `Char`. */
public override fun toChar(): Char
public fun toChar(): Char
/** Returns the value of this character as a `Short`. */
public override fun toShort(): Short
public fun toShort(): Short
/** Returns the value of this character as a `Int`. */
public override fun toInt(): Int
public fun toInt(): Int
/** Returns the value of this character as a `Long`. */
public override fun toLong(): Long
public fun toLong(): Long
/** Returns the value of this character as a `Float`. */
public override fun toFloat(): Float
public fun toFloat(): Float
/** Returns the value of this character as a `Double`. */
public override fun toDouble(): Double
public fun toDouble(): Double
companion object {
/**
+1 -1
View File
@@ -20,4 +20,4 @@ package kotlin
* Nothing has no instances. You can use Nothing to represent "a value that never exists": for example,
* if a function has the return type of Nothing, it means that it never returns (always throws an exception).
*/
public class Nothing private () {}
public class Nothing private constructor()
+216 -186
View File
@@ -22,7 +22,7 @@ package kotlin
* Represents a 8-bit signed integer.
* On the JVM, non-nullable values of this type are represented as values of the primitive type `byte`.
*/
public class Byte private () : Number, Comparable<Byte> {
public class Byte private constructor() : Number(), Comparable<Byte> {
companion object {
/**
* A constant holding the minimum value an instance of Byte can have.
@@ -35,41 +35,46 @@ public class Byte private () : Number, Comparable<Byte> {
public const val MAX_VALUE: Byte = 127
}
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public override operator fun compareTo(other: Byte): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Short): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Int): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Long): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Float): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Double): Int
/** Adds the other value to this value. */
@@ -168,7 +173,7 @@ public class Byte private () : Number, Comparable<Byte> {
* Represents a 16-bit signed integer.
* On the JVM, non-nullable values of this type are represented as values of the primitive type `short`.
*/
public class Short private () : Number, Comparable<Short> {
public class Short private constructor() : Number(), Comparable<Short> {
companion object {
/**
* A constant holding the minimum value an instance of Short can have.
@@ -181,41 +186,46 @@ public class Short private () : Number, Comparable<Short> {
public const val MAX_VALUE: Short = 32767
}
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Byte): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public override operator fun compareTo(other: Short): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Int): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Long): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Float): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Double): Int
/** Adds the other value to this value. */
@@ -314,7 +324,7 @@ public class Short private () : Number, Comparable<Short> {
* Represents a 32-bit signed integer.
* On the JVM, non-nullable values of this type are represented as values of the primitive type `int`.
*/
public class Int private () : Number, Comparable<Int> {
public class Int private constructor() : Number(), Comparable<Int> {
companion object {
/**
* A constant holding the minimum value an instance of Int can have.
@@ -327,41 +337,46 @@ public class Int private () : Number, Comparable<Int> {
public const val MAX_VALUE: Int = 2147483647
}
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Byte): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Short): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public override operator fun compareTo(other: Int): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Long): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Float): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Double): Int
/** Adds the other value to this value. */
@@ -475,7 +490,7 @@ public class Int private () : Number, Comparable<Int> {
* Represents a 64-bit signed integer.
* On the JVM, non-nullable values of this type are represented as values of the primitive type `long`.
*/
public class Long private () : Number, Comparable<Long> {
public class Long private constructor() : Number(), Comparable<Long> {
companion object {
/**
* A constant holding the minimum value an instance of Long can have.
@@ -488,41 +503,46 @@ public class Long private () : Number, Comparable<Long> {
public const val MAX_VALUE: Long = 9223372036854775807L
}
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Byte): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Short): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Int): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public override operator fun compareTo(other: Long): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Float): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Double): Int
/** Adds the other value to this value. */
@@ -636,7 +656,7 @@ public class Long private () : Number, Comparable<Long> {
* Represents a single-precision 32-bit IEEE 754 floating point number.
* On the JVM, non-nullable values of this type are represented as values of the primitive type `float`.
*/
public class Float private () : Number, Comparable<Float> {
public class Float private constructor() : Number(), Comparable<Float> {
companion object {
/**
* A constant holding the smallest *positive* nonzero value of Float.
@@ -664,41 +684,46 @@ public class Float private () : Number, Comparable<Float> {
public val NaN: Float
}
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Byte): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Short): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Int): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Long): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public override operator fun compareTo(other: Float): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Double): Int
/** Adds the other value to this value. */
@@ -789,7 +814,7 @@ public class Float private () : Number, Comparable<Float> {
* Represents a double-precision 64-bit IEEE 754 floating point number.
* On the JVM, non-nullable values of this type are represented as values of the primitive type `double`.
*/
public class Double private () : Number, Comparable<Double> {
public class Double private constructor() : Number(), Comparable<Double> {
companion object {
/**
* A constant holding the smallest *positive* nonzero value of Double.
@@ -817,41 +842,46 @@ public class Double private () : Number, Comparable<Double> {
public val NaN: Double
}
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Byte): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Short): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Int): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Long): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public operator fun compareTo(other: Float): Int
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/
public override operator fun compareTo(other: Double): Int
/** Adds the other value to this value. */
@@ -65,7 +65,7 @@ class GeneratePrimitives(out: PrintWriter) : BuiltInsSourceGenerator(out) {
for (kind in PrimitiveType.onlyNumeric) {
val className = kind.capitalized
generateDoc(kind)
out.println("public class $className private () : Number, Comparable<$className> {")
out.println("public class $className private constructor() : Number(), Comparable<$className> {")
out.print(" companion object ")
if (kind == PrimitiveType.FLOAT || kind == PrimitiveType.DOUBLE) {
@@ -95,8 +95,7 @@ class GeneratePrimitives(out: PrintWriter) : BuiltInsSourceGenerator(out) {
* A constant holding the "not a number" value of $className.
*/
public val NaN: $className
}
""")
}""")
}
if (kind == PrimitiveType.INT || kind == PrimitiveType.LONG || kind == PrimitiveType.SHORT || kind == PrimitiveType.BYTE) {
val (minValue, maxValue) = primitiveConstants(kind)
@@ -110,8 +109,7 @@ class GeneratePrimitives(out: PrintWriter) : BuiltInsSourceGenerator(out) {
* A constant holding the maximum value an instance of $className can have.
*/
public const val MAX_VALUE: $className = $maxValue
}
""")
}""")
}
generateCompareTo(kind)
@@ -139,11 +137,12 @@ class GeneratePrimitives(out: PrintWriter) : BuiltInsSourceGenerator(out) {
private fun generateCompareTo(thisKind: PrimitiveType) {
for (otherKind in PrimitiveType.onlyNumeric) {
out.println("/**")
out.println(" * Compares this value with the specified value for order.")
out.println(" * Returns zero if this value is equal to the specified other value, a negative number if its less than other, ")
out.println(" * or a positive number if its greater than other.")
out.println(" */")
out.println("""
/**
* Compares this value with the specified value for order.
* Returns zero if this value is equal to the specified other value, a negative number if its less than other,
* or a positive number if its greater than other.
*/""")
out.print(" public ")
if (otherKind == thisKind) out.print("override ")
out.println("operator fun compareTo(other: ${otherKind.capitalized}): Int")