diff options
author | Martin Odersky <odersky@gmail.com> | 2012-02-03 07:44:41 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2012-02-03 07:44:41 +0100 |
commit | b4cfd1161e9f549a909d9f563f557c17dbddad00 (patch) | |
tree | 63d64dfdd30322c211e1805df670aec3aeb3659e /src/library | |
parent | e9a70f564a29ec0e2262cc9e6608c990b6b05274 (diff) | |
download | scala-b4cfd1161e9f549a909d9f563f557c17dbddad00.tar.gz scala-b4cfd1161e9f549a909d9f563f557c17dbddad00.tar.bz2 scala-b4cfd1161e9f549a909d9f563f557c17dbddad00.zip |
intermediate work towards a new starr for value classes.
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/Proxy.scala | 10 | ||||
-rw-r--r-- | src/library/scala/collection/GenTraversableOnce.scala | 2 | ||||
-rw-r--r-- | src/library/scala/collection/immutable/StringOps.scala | 2 | ||||
-rw-r--r-- | src/library/scala/math/Ordered.scala | 2 | ||||
-rw-r--r-- | src/library/scala/runtime/ScalaNumberProxy.scala | 2 |
5 files changed, 10 insertions, 8 deletions
diff --git a/src/library/scala/Proxy.scala b/src/library/scala/Proxy.scala index 383ff5b3bb..16c3c3fa56 100644 --- a/src/library/scala/Proxy.scala +++ b/src/library/scala/Proxy.scala @@ -22,13 +22,15 @@ package scala * @author Matthias Zenger * @version 1.0, 26/04/2004 */ -trait Proxy { +trait Proxy extends Any { def self: Any override def hashCode: Int = self.hashCode override def equals(that: Any): Boolean = that match { - case null => false - case x: AnyRef => (x eq this) || (x eq self.asInstanceOf[AnyRef]) || (x equals self) + case null => false + case _ => + val x = that.asInstanceOf[AnyRef] + (x eq this.asInstanceOf[AnyRef]) || (x eq self.asInstanceOf[AnyRef]) || (x equals self) } override def toString = "" + self } @@ -36,7 +38,7 @@ trait Proxy { object Proxy { /** A proxy which exposes the type it is proxying for via a type parameter. */ - trait Typed[T] extends Proxy { + trait Typed[T] extends /*Any with */Proxy { def self: T } } diff --git a/src/library/scala/collection/GenTraversableOnce.scala b/src/library/scala/collection/GenTraversableOnce.scala index 305f8d768d..18b1a96155 100644 --- a/src/library/scala/collection/GenTraversableOnce.scala +++ b/src/library/scala/collection/GenTraversableOnce.scala @@ -41,7 +41,7 @@ package scala.collection * @author Aleksandar Prokopec * @since 2.9 */ -trait GenTraversableOnce[+A] { +trait GenTraversableOnce[+A] extends AnyRef { def foreach[U](f: A => U): Unit diff --git a/src/library/scala/collection/immutable/StringOps.scala b/src/library/scala/collection/immutable/StringOps.scala index 8612357db9..09cbd247e9 100644 --- a/src/library/scala/collection/immutable/StringOps.scala +++ b/src/library/scala/collection/immutable/StringOps.scala @@ -28,7 +28,7 @@ import mutable.StringBuilder * @define Coll StringOps * @define coll string */ -final class StringOps(override val repr: String) extends StringLike[String] { +final class StringOps(override val repr: String) extends AnyRef with StringLike[String] { override protected[this] def thisCollection: WrappedString = new WrappedString(repr) override protected[this] def toCollection(repr: String): WrappedString = new WrappedString(repr) diff --git a/src/library/scala/math/Ordered.scala b/src/library/scala/math/Ordered.scala index 53d618db63..4397f14c94 100644 --- a/src/library/scala/math/Ordered.scala +++ b/src/library/scala/math/Ordered.scala @@ -50,7 +50,7 @@ package scala.math * @author Martin Odersky * @version 1.1, 2006-07-24 */ -trait Ordered[A] extends java.lang.Comparable[A] { +trait Ordered[A] extends /*Any with*/ java.lang.Comparable[A] { /** Result of comparing `this` with operand `that`. * diff --git a/src/library/scala/runtime/ScalaNumberProxy.scala b/src/library/scala/runtime/ScalaNumberProxy.scala index 09e1611dcd..bd19e099e0 100644 --- a/src/library/scala/runtime/ScalaNumberProxy.scala +++ b/src/library/scala/runtime/ScalaNumberProxy.scala @@ -64,7 +64,7 @@ abstract class FractionalProxy[T : Fractional] extends ScalaNumberProxy[T] with def to(end: T, step: T): NumericRange.Inclusive[T] = NumericRange.inclusive(self, end, step) } -trait OrderedProxy[T] extends Typed[T] with Ordered[T] { +trait OrderedProxy[T] extends Ordered[T] with Typed[T] { protected def ord: Ordering[T] def compare(y: T) = ord.compare(self, y) |