Skip to content

Commit 8e40bef

Browse files
authored
Merge pull request scala#5729 from scala/revert-5658-topic/hashhash
Revert "Fix erasure of the qualifier of ##"
2 parents cbf7daa + 86cd70f commit 8e40bef

File tree

3 files changed

+6
-24
lines changed

3 files changed

+6
-24
lines changed

src/compiler/scala/tools/nsc/transform/Erasure.scala

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,21 +1064,20 @@ abstract class Erasure extends InfoTransform
10641064
}
10651065
else if (args.isEmpty && interceptedMethods(fn.symbol)) {
10661066
if (poundPoundMethods.contains(fn.symbol)) {
1067-
val qual1 = preErase(qual)
10681067
// This is unattractive, but without it we crash here on ().## because after
10691068
// erasure the ScalaRunTime.hash overload goes from Unit => Int to BoxedUnit => Int.
10701069
// This must be because some earlier transformation is being skipped on ##, but so
10711070
// far I don't know what. For null we now define null.## == 0.
10721071
def staticsCall(methodName: TermName): Tree = {
1073-
val newTree = gen.mkMethodCall(RuntimeStaticsModule, methodName, qual1 :: Nil)
1072+
val newTree = gen.mkMethodCall(RuntimeStaticsModule, methodName, qual :: Nil)
10741073
global.typer.typed(newTree)
10751074
}
10761075

1077-
qual1.tpe.typeSymbol match {
1078-
case UnitClass | NullClass => BLOCK(qual1, LIT(0))
1079-
case IntClass => qual1
1080-
case s @ (ShortClass | ByteClass | CharClass) => numericConversion(qual1, s)
1081-
case BooleanClass => If(qual1, LIT(true.##), LIT(false.##))
1076+
qual.tpe.typeSymbol match {
1077+
case UnitClass | NullClass => LIT(0)
1078+
case IntClass => qual
1079+
case s @ (ShortClass | ByteClass | CharClass) => numericConversion(qual, s)
1080+
case BooleanClass => If(qual, LIT(true.##), LIT(false.##))
10821081
case LongClass => staticsCall(nme.longHash)
10831082
case FloatClass => staticsCall(nme.floatHash)
10841083
case DoubleClass => staticsCall(nme.doubleHash)

test/files/run/hash-hash-hash-hash.scala

Lines changed: 0 additions & 5 deletions
This file was deleted.

test/files/run/unit-block-hash-hash.scala

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)