diff options
author | Sébastien Doeraene <sjrdoeraene@gmail.com> | 2016-04-13 11:54:47 +0200 |
---|---|---|
committer | Sébastien Doeraene <sjrdoeraene@gmail.com> | 2016-04-13 12:03:45 +0200 |
commit | 6090f53ee9ab2677f732ea5cc7144cb9684b2593 (patch) | |
tree | 283d7922bb9b39480c1ebc0655087e077d191961 /test/files | |
parent | 00050c6bd06928b045e583c7f15f1223faf6fbee (diff) | |
download | scala-6090f53ee9ab2677f732ea5cc7144cb9684b2593.tar.gz scala-6090f53ee9ab2677f732ea5cc7144cb9684b2593.tar.bz2 scala-6090f53ee9ab2677f732ea5cc7144cb9684b2593.zip |
Remove dead-code runtime hash() methods.
ScalaRunTime had a bunch of overloads of the `hash()` method,
but only the `Any` version is ever used by the codegen. Worse,
their implementation was not in sync with the actual
implementations in BoxesRunTime, called by the `Any` version.
For example,
hash(0x80000000L) != hash(0x80000000L: Any)
This commit simply removes all of this dead code.
Similarly, we remove BoxesRunTime.hashFromObject(), which was
never called either.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/pos/t5644/BoxesRunTime.java | 4 | ||||
-rw-r--r-- | test/files/run/hashCodeBoxesRunTime.scala | 5 |
2 files changed, 3 insertions, 6 deletions
diff --git a/test/files/pos/t5644/BoxesRunTime.java b/test/files/pos/t5644/BoxesRunTime.java index 74c4c6b4b9..2b931519aa 100644 --- a/test/files/pos/t5644/BoxesRunTime.java +++ b/test/files/pos/t5644/BoxesRunTime.java @@ -267,10 +267,6 @@ public final class BoxesRunTime else if (n instanceof java.lang.Float) return hashFromFloat((java.lang.Float)n); else return n.hashCode(); } - public static int hashFromObject(Object a) { - if (a instanceof Number) return hashFromNumber((Number)a); - else return a.hashCode(); - } private static int unboxCharOrInt(Object arg1, int code) { if (code == CHAR) diff --git a/test/files/run/hashCodeBoxesRunTime.scala b/test/files/run/hashCodeBoxesRunTime.scala index ba1a30f5fb..8ad94c252a 100644 --- a/test/files/run/hashCodeBoxesRunTime.scala +++ b/test/files/run/hashCodeBoxesRunTime.scala @@ -3,7 +3,8 @@ object Test { import java.{ lang => jl } - import scala.runtime.BoxesRunTime.{ hashFromNumber, hashFromObject } + import scala.runtime.BoxesRunTime.hashFromNumber + import scala.runtime.ScalaRunTime.{ hash => hashFromAny } def allSame[T](xs: List[T]) = assert(xs.distinct.size == 1, "failed: " + xs) @@ -17,7 +18,7 @@ object Test val hashes = mkNumbers(n) map hashFromNumber allSame(hashes) if (n >= 0) { - val charCode = hashFromObject(n.toChar: Character) + val charCode = hashFromAny(n.toChar: Character) assert(charCode == hashes.head) } } |