diff options
author | Paul Phillips <paulp@improving.org> | 2012-06-04 12:05:57 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-06-06 14:23:45 -0700 |
commit | 241c7606d0bf5f3209b9d549fb751dbbc5b8e514 (patch) | |
tree | 1a9ce60b92f37cf6ca58f69a7fdcaecd90e532bb /src/library/scala/Double.scala | |
parent | a43e070e232ce35ef14fce34458ee3ea6e823078 (diff) | |
download | scala-241c7606d0bf5f3209b9d549fb751dbbc5b8e514.tar.gz scala-241c7606d0bf5f3209b9d549fb751dbbc5b8e514.tar.bz2 scala-241c7606d0bf5f3209b9d549fb751dbbc5b8e514.zip |
Generate abstract methods in scala.Byte and friends.
Rather than stub implementations. This saves over 50K of bytecode.
I also added the necessary imports to silence the feature warnings.
Diffstat (limited to 'src/library/scala/Double.scala')
-rw-r--r-- | src/library/scala/Double.scala | 182 |
1 files changed, 92 insertions, 90 deletions
diff --git a/src/library/scala/Double.scala b/src/library/scala/Double.scala index bb659b963a..2ff46c433d 100644 --- a/src/library/scala/Double.scala +++ b/src/library/scala/Double.scala @@ -10,6 +10,8 @@ package scala +import language.implicitConversions + /** `Double`, a 64-bit IEEE-754 floating point number (equivalent to Java's `double` primitive type) is a * subtype of [[scala.AnyVal]]. Instances of `Double` are not * represented by an object in the underlying runtime system. @@ -17,349 +19,349 @@ package scala * There is an implicit conversion from [[scala.Double]] => [[scala.runtime.RichDouble]] * which provides useful non-primitive operations. */ -final class Double private extends AnyVal { - def toByte: Byte = sys.error("stub") - def toShort: Short = sys.error("stub") - def toChar: Char = sys.error("stub") - def toInt: Int = sys.error("stub") - def toLong: Long = sys.error("stub") - def toFloat: Float = sys.error("stub") - def toDouble: Double = sys.error("stub") +final abstract class Double private extends AnyVal { + def toByte: Byte + def toShort: Short + def toChar: Char + def toInt: Int + def toLong: Long + def toFloat: Float + def toDouble: Double /** * Returns this value, unmodified. */ - def unary_+ : Double = sys.error("stub") + def unary_+ : Double /** * Returns the negation of this value. */ - def unary_- : Double = sys.error("stub") + def unary_- : Double - def +(x: String): String = sys.error("stub") + def +(x: String): String /** * Returns `true` if this value is equal to x, `false` otherwise. */ - def ==(x: Byte): Boolean = sys.error("stub") + def ==(x: Byte): Boolean /** * Returns `true` if this value is equal to x, `false` otherwise. */ - def ==(x: Short): Boolean = sys.error("stub") + def ==(x: Short): Boolean /** * Returns `true` if this value is equal to x, `false` otherwise. */ - def ==(x: Char): Boolean = sys.error("stub") + def ==(x: Char): Boolean /** * Returns `true` if this value is equal to x, `false` otherwise. */ - def ==(x: Int): Boolean = sys.error("stub") + def ==(x: Int): Boolean /** * Returns `true` if this value is equal to x, `false` otherwise. */ - def ==(x: Long): Boolean = sys.error("stub") + def ==(x: Long): Boolean /** * Returns `true` if this value is equal to x, `false` otherwise. */ - def ==(x: Float): Boolean = sys.error("stub") + def ==(x: Float): Boolean /** * Returns `true` if this value is equal to x, `false` otherwise. */ - def ==(x: Double): Boolean = sys.error("stub") + def ==(x: Double): Boolean /** * Returns `true` if this value is not equal to x, `false` otherwise. */ - def !=(x: Byte): Boolean = sys.error("stub") + def !=(x: Byte): Boolean /** * Returns `true` if this value is not equal to x, `false` otherwise. */ - def !=(x: Short): Boolean = sys.error("stub") + def !=(x: Short): Boolean /** * Returns `true` if this value is not equal to x, `false` otherwise. */ - def !=(x: Char): Boolean = sys.error("stub") + def !=(x: Char): Boolean /** * Returns `true` if this value is not equal to x, `false` otherwise. */ - def !=(x: Int): Boolean = sys.error("stub") + def !=(x: Int): Boolean /** * Returns `true` if this value is not equal to x, `false` otherwise. */ - def !=(x: Long): Boolean = sys.error("stub") + def !=(x: Long): Boolean /** * Returns `true` if this value is not equal to x, `false` otherwise. */ - def !=(x: Float): Boolean = sys.error("stub") + def !=(x: Float): Boolean /** * Returns `true` if this value is not equal to x, `false` otherwise. */ - def !=(x: Double): Boolean = sys.error("stub") + def !=(x: Double): Boolean /** * Returns `true` if this value is less than x, `false` otherwise. */ - def <(x: Byte): Boolean = sys.error("stub") + def <(x: Byte): Boolean /** * Returns `true` if this value is less than x, `false` otherwise. */ - def <(x: Short): Boolean = sys.error("stub") + def <(x: Short): Boolean /** * Returns `true` if this value is less than x, `false` otherwise. */ - def <(x: Char): Boolean = sys.error("stub") + def <(x: Char): Boolean /** * Returns `true` if this value is less than x, `false` otherwise. */ - def <(x: Int): Boolean = sys.error("stub") + def <(x: Int): Boolean /** * Returns `true` if this value is less than x, `false` otherwise. */ - def <(x: Long): Boolean = sys.error("stub") + def <(x: Long): Boolean /** * Returns `true` if this value is less than x, `false` otherwise. */ - def <(x: Float): Boolean = sys.error("stub") + def <(x: Float): Boolean /** * Returns `true` if this value is less than x, `false` otherwise. */ - def <(x: Double): Boolean = sys.error("stub") + def <(x: Double): Boolean /** * Returns `true` if this value is less than or equal to x, `false` otherwise. */ - def <=(x: Byte): Boolean = sys.error("stub") + def <=(x: Byte): Boolean /** * Returns `true` if this value is less than or equal to x, `false` otherwise. */ - def <=(x: Short): Boolean = sys.error("stub") + def <=(x: Short): Boolean /** * Returns `true` if this value is less than or equal to x, `false` otherwise. */ - def <=(x: Char): Boolean = sys.error("stub") + def <=(x: Char): Boolean /** * Returns `true` if this value is less than or equal to x, `false` otherwise. */ - def <=(x: Int): Boolean = sys.error("stub") + def <=(x: Int): Boolean /** * Returns `true` if this value is less than or equal to x, `false` otherwise. */ - def <=(x: Long): Boolean = sys.error("stub") + def <=(x: Long): Boolean /** * Returns `true` if this value is less than or equal to x, `false` otherwise. */ - def <=(x: Float): Boolean = sys.error("stub") + def <=(x: Float): Boolean /** * Returns `true` if this value is less than or equal to x, `false` otherwise. */ - def <=(x: Double): Boolean = sys.error("stub") + def <=(x: Double): Boolean /** * Returns `true` if this value is greater than x, `false` otherwise. */ - def >(x: Byte): Boolean = sys.error("stub") + def >(x: Byte): Boolean /** * Returns `true` if this value is greater than x, `false` otherwise. */ - def >(x: Short): Boolean = sys.error("stub") + def >(x: Short): Boolean /** * Returns `true` if this value is greater than x, `false` otherwise. */ - def >(x: Char): Boolean = sys.error("stub") + def >(x: Char): Boolean /** * Returns `true` if this value is greater than x, `false` otherwise. */ - def >(x: Int): Boolean = sys.error("stub") + def >(x: Int): Boolean /** * Returns `true` if this value is greater than x, `false` otherwise. */ - def >(x: Long): Boolean = sys.error("stub") + def >(x: Long): Boolean /** * Returns `true` if this value is greater than x, `false` otherwise. */ - def >(x: Float): Boolean = sys.error("stub") + def >(x: Float): Boolean /** * Returns `true` if this value is greater than x, `false` otherwise. */ - def >(x: Double): Boolean = sys.error("stub") + def >(x: Double): Boolean /** * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ - def >=(x: Byte): Boolean = sys.error("stub") + def >=(x: Byte): Boolean /** * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ - def >=(x: Short): Boolean = sys.error("stub") + def >=(x: Short): Boolean /** * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ - def >=(x: Char): Boolean = sys.error("stub") + def >=(x: Char): Boolean /** * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ - def >=(x: Int): Boolean = sys.error("stub") + def >=(x: Int): Boolean /** * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ - def >=(x: Long): Boolean = sys.error("stub") + def >=(x: Long): Boolean /** * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ - def >=(x: Float): Boolean = sys.error("stub") + def >=(x: Float): Boolean /** * Returns `true` if this value is greater than or equal to x, `false` otherwise. */ - def >=(x: Double): Boolean = sys.error("stub") + def >=(x: Double): Boolean /** * Returns the sum of this value and `x`. */ - def +(x: Byte): Double = sys.error("stub") + def +(x: Byte): Double /** * Returns the sum of this value and `x`. */ - def +(x: Short): Double = sys.error("stub") + def +(x: Short): Double /** * Returns the sum of this value and `x`. */ - def +(x: Char): Double = sys.error("stub") + def +(x: Char): Double /** * Returns the sum of this value and `x`. */ - def +(x: Int): Double = sys.error("stub") + def +(x: Int): Double /** * Returns the sum of this value and `x`. */ - def +(x: Long): Double = sys.error("stub") + def +(x: Long): Double /** * Returns the sum of this value and `x`. */ - def +(x: Float): Double = sys.error("stub") + def +(x: Float): Double /** * Returns the sum of this value and `x`. */ - def +(x: Double): Double = sys.error("stub") + def +(x: Double): Double /** * Returns the difference of this value and `x`. */ - def -(x: Byte): Double = sys.error("stub") + def -(x: Byte): Double /** * Returns the difference of this value and `x`. */ - def -(x: Short): Double = sys.error("stub") + def -(x: Short): Double /** * Returns the difference of this value and `x`. */ - def -(x: Char): Double = sys.error("stub") + def -(x: Char): Double /** * Returns the difference of this value and `x`. */ - def -(x: Int): Double = sys.error("stub") + def -(x: Int): Double /** * Returns the difference of this value and `x`. */ - def -(x: Long): Double = sys.error("stub") + def -(x: Long): Double /** * Returns the difference of this value and `x`. */ - def -(x: Float): Double = sys.error("stub") + def -(x: Float): Double /** * Returns the difference of this value and `x`. */ - def -(x: Double): Double = sys.error("stub") + def -(x: Double): Double /** * Returns the product of this value and `x`. */ - def *(x: Byte): Double = sys.error("stub") + def *(x: Byte): Double /** * Returns the product of this value and `x`. */ - def *(x: Short): Double = sys.error("stub") + def *(x: Short): Double /** * Returns the product of this value and `x`. */ - def *(x: Char): Double = sys.error("stub") + def *(x: Char): Double /** * Returns the product of this value and `x`. */ - def *(x: Int): Double = sys.error("stub") + def *(x: Int): Double /** * Returns the product of this value and `x`. */ - def *(x: Long): Double = sys.error("stub") + def *(x: Long): Double /** * Returns the product of this value and `x`. */ - def *(x: Float): Double = sys.error("stub") + def *(x: Float): Double /** * Returns the product of this value and `x`. */ - def *(x: Double): Double = sys.error("stub") + def *(x: Double): Double /** * Returns the quotient of this value and `x`. */ - def /(x: Byte): Double = sys.error("stub") + def /(x: Byte): Double /** * Returns the quotient of this value and `x`. */ - def /(x: Short): Double = sys.error("stub") + def /(x: Short): Double /** * Returns the quotient of this value and `x`. */ - def /(x: Char): Double = sys.error("stub") + def /(x: Char): Double /** * Returns the quotient of this value and `x`. */ - def /(x: Int): Double = sys.error("stub") + def /(x: Int): Double /** * Returns the quotient of this value and `x`. */ - def /(x: Long): Double = sys.error("stub") + def /(x: Long): Double /** * Returns the quotient of this value and `x`. */ - def /(x: Float): Double = sys.error("stub") + def /(x: Float): Double /** * Returns the quotient of this value and `x`. */ - def /(x: Double): Double = sys.error("stub") + def /(x: Double): Double /** * Returns the remainder of the division of this value by `x`. */ - def %(x: Byte): Double = sys.error("stub") + def %(x: Byte): Double /** * Returns the remainder of the division of this value by `x`. */ - def %(x: Short): Double = sys.error("stub") + def %(x: Short): Double /** * Returns the remainder of the division of this value by `x`. */ - def %(x: Char): Double = sys.error("stub") + def %(x: Char): Double /** * Returns the remainder of the division of this value by `x`. */ - def %(x: Int): Double = sys.error("stub") + def %(x: Int): Double /** * Returns the remainder of the division of this value by `x`. */ - def %(x: Long): Double = sys.error("stub") + def %(x: Long): Double /** * Returns the remainder of the division of this value by `x`. */ - def %(x: Float): Double = sys.error("stub") + def %(x: Float): Double /** * Returns the remainder of the division of this value by `x`. */ - def %(x: Double): Double = sys.error("stub") + def %(x: Double): Double - override def getClass(): Class[Double] = sys.error("stub") + override def getClass(): Class[Double] = null } -object Double extends AnyValCompanion { +object Double extends AnyValCompanion { /** The smallest positive value greater than 0.0d which is * representable as a Double. */ |