summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/transform/Erasure.scala13
-rw-r--r--test/files/run/hash-hash-hash-hash.scala5
-rw-r--r--test/files/run/unit-block-hash-hash.scala12
3 files changed, 6 insertions, 24 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala
index f8f0c193e2..e327a6658c 100644
--- a/src/compiler/scala/tools/nsc/transform/Erasure.scala
+++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala
@@ -1064,21 +1064,20 @@ abstract class Erasure extends InfoTransform
}
else if (args.isEmpty && interceptedMethods(fn.symbol)) {
if (poundPoundMethods.contains(fn.symbol)) {
- val qual1 = preErase(qual)
// This is unattractive, but without it we crash here on ().## because after
// erasure the ScalaRunTime.hash overload goes from Unit => Int to BoxedUnit => Int.
// This must be because some earlier transformation is being skipped on ##, but so
// far I don't know what. For null we now define null.## == 0.
def staticsCall(methodName: TermName): Tree = {
- val newTree = gen.mkMethodCall(RuntimeStaticsModule, methodName, qual1 :: Nil)
+ val newTree = gen.mkMethodCall(RuntimeStaticsModule, methodName, qual :: Nil)
global.typer.typed(newTree)
}
- qual1.tpe.typeSymbol match {
- case UnitClass | NullClass => BLOCK(qual1, LIT(0))
- case IntClass => qual1
- case s @ (ShortClass | ByteClass | CharClass) => numericConversion(qual1, s)
- case BooleanClass => If(qual1, LIT(true.##), LIT(false.##))
+ qual.tpe.typeSymbol match {
+ case UnitClass | NullClass => LIT(0)
+ case IntClass => qual
+ case s @ (ShortClass | ByteClass | CharClass) => numericConversion(qual, s)
+ case BooleanClass => If(qual, LIT(true.##), LIT(false.##))
case LongClass => staticsCall(nme.longHash)
case FloatClass => staticsCall(nme.floatHash)
case DoubleClass => staticsCall(nme.doubleHash)
diff --git a/test/files/run/hash-hash-hash-hash.scala b/test/files/run/hash-hash-hash-hash.scala
deleted file mode 100644
index 08793871a7..0000000000
--- a/test/files/run/hash-hash-hash-hash.scala
+++ /dev/null
@@ -1,5 +0,0 @@
-object Test {
- def main(args: Array[String]): Unit = {
- assert(1.##.## == 1) // was java.lang.NoSuchMethodError: java.lang.Object.$hash$hash()I
- }
-}
diff --git a/test/files/run/unit-block-hash-hash.scala b/test/files/run/unit-block-hash-hash.scala
deleted file mode 100644
index 2708810a71..0000000000
--- a/test/files/run/unit-block-hash-hash.scala
+++ /dev/null
@@ -1,12 +0,0 @@
-object Ex extends Exception
-object Test {
- def ex: Any = throw Ex
- def main(args: Array[String]): Unit = {
- try {
- { ex; () }.##
- sys.error("no exception was thrown")
- } catch {
- case `Ex` =>
- }
- }
-} \ No newline at end of file