diff options
author | Paul Phillips <paulp@improving.org> | 2010-02-28 14:35:50 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-02-28 14:35:50 +0000 |
commit | ba5dbbd44db2c23c7532cde13453c6a031afb6e5 (patch) | |
tree | 00fbae4846f215cf90efda508f924cb790537e31 /src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala | |
parent | 432e16ce906cb1f03aabe26c0e51674780f44625 (diff) | |
download | scala-ba5dbbd44db2c23c7532cde13453c6a031afb6e5.tar.gz scala-ba5dbbd44db2c23c7532cde13453c6a031afb6e5.tar.bz2 scala-ba5dbbd44db2c23c7532cde13453c6a031afb6e5.zip |
Added ## method to Any as our scala hashCode me...
Added ## method to Any as our scala hashCode method which provides
consistent answers for primitive types. And I'm sure we're all tired of
new starrs, but it's hard to add a method to Any without one. This patch
only brings ## into existence, but nothing calls it yet.
// some true assertions
scala> assert(5.5f.## == 5.5f.hashCode)
scala> assert(5.0f.## != 5.0f.hashCode && 5.0f.## == 5L.##)
No review. (Already reviewed by odersky.)
Diffstat (limited to 'src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala b/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala index d9830f7462..90261288ee 100644 --- a/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala +++ b/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala @@ -94,6 +94,7 @@ abstract class ScalaPrimitives { final val AS = 81 // x.as[y] final val ISERASED = 85 // x.is$erased[y] final val ASERASED = 86 // x.as$erased[y] + final val HASH = 87 // x.## // AnyRef operations final val SYNCHRONIZED = 90 // x.synchronized(y) @@ -215,6 +216,7 @@ abstract class ScalaPrimitives { addPrimitive(Any_!=, NE) addPrimitive(Any_isInstanceOf, IS) addPrimitive(Any_asInstanceOf, AS) + addPrimitive(Any_##, HASH) // java.lang.Object addPrimitive(Object_eq, ID) |