Skip to content

Commit bab913e

Browse files
Teach the decompiler about the change
1 parent 7f670df commit bab913e

File tree

8 files changed

+16
-14
lines changed

8 files changed

+16
-14
lines changed

compiler/src/dotty/tools/dotc/printing/DecompilerPrinter.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ class DecompilerPrinter(_ctx: Context) extends RefinedPrinter(_ctx) {
5757
def isSynthetic(parent: Tree): Boolean = {
5858
val sym = parent.symbol
5959
sym.maybeOwner == defn.ObjectClass ||
60-
(sym == defn.ProductClass && impl.symbol.owner.is(Case))
60+
(sym == defn.ProductClass && impl.symbol.owner.is(Case)) ||
61+
(sym == defn.SerializableClass && impl.symbol.owner.is(Case))
6162
}
6263
val parents = impl.parents.filterNot(isSynthetic)
6364
val body = impl.body.filterNot(_.symbol.is(ParamAccessor))

library/src/scala/tasty/reflect/Printers.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,7 @@ trait Printers
596596
val parents1 = parents.filter {
597597
case IsTerm(Term.Apply(Term.Select(Term.New(tpt), _), _)) => !Types.JavaLangObject.unapply(tpt.tpe)
598598
case IsTypeTree(TypeTree.Select(Term.Select(Term.Ident("_root_"), "scala"), "Product")) => false
599+
case IsTypeTree(TypeTree.Select(Term.Select(Term.Ident("_root_"), "scala"), "Serializable")) => false
599600
case _ => true
600601
}
601602
if (parents1.nonEmpty)

tests/pos/i2104b.decompiled

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
/** Decompiled from out/posTestFromTasty/pos/i2104b/Cons.class */
1+
/** Decompiled from out/posTestFromTasty/pos/i2104b/Cons.tasty */
22
trait Cons[H, T]() extends java.lang.Object
33
object Cons {
44
def apply[H, T](h: H, t: T): Cons[H, T] = scala.Predef.???
55
def unapply[H, T](t: Cons[H, T]): scala.Option[Pair[H, T]] = scala.Predef.???
66
}
7-
/** Decompiled from out/posTestFromTasty/pos/i2104b/Pair.class */
7+
/** Decompiled from out/posTestFromTasty/pos/i2104b/Pair.tasty */
88
case class Pair[A, B](_1: A, _2: B) {
99
override def hashCode(): scala.Int = {
1010
var acc: scala.Int = 2479866
@@ -32,10 +32,10 @@ case class Pair[A, B](_1: A, _2: B) {
3232
}
3333
}
3434
object Pair extends scala.AnyRef()
35-
/** Decompiled from out/posTestFromTasty/pos/i2104b/Test.class */
35+
/** Decompiled from out/posTestFromTasty/pos/i2104b/Test.tasty */
3636
object Test {
3737
def main(args: scala.Array[scala.Predef.String]): scala.Unit = Cons.apply[scala.Option[scala.Int], scala.None.type](scala.Option.apply[scala.Int](1), scala.None) match {
3838
case Cons(scala.Some(i), scala.None) =>
3939
()
4040
}
41-
}
41+
}

tests/pos/simpleCaseClass-1.decompiled

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** Decompiled from out/posTestFromTasty/pos/simpleCaseClass-1/A.class */
1+
/** Decompiled from out/posTestFromTasty/pos/simpleCaseClass-1/A.tasty */
22
case class A() {
33
override def hashCode(): scala.Int = 1914112431
44
override def equals(x$0: scala.Any): scala.Boolean = A.this.eq(x$0.asInstanceOf[java.lang.Object]).||(x$0 match {
@@ -16,4 +16,4 @@ case class A() {
1616
throw new java.lang.IndexOutOfBoundsException(n.toString())
1717
}
1818
}
19-
object A extends scala.Function0[A]
19+
object A extends scala.Function0[A]

tests/pos/simpleCaseClass-2.decompiled

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** Decompiled from out/posTestFromTasty/pos/simpleCaseClass-2/A.class */
1+
/** Decompiled from out/posTestFromTasty/pos/simpleCaseClass-2/A.tasty */
22
case class A(x: scala.Int) {
33
override def hashCode(): scala.Int = {
44
var acc: scala.Int = 65
@@ -22,4 +22,4 @@ case class A(x: scala.Int) {
2222
throw new java.lang.IndexOutOfBoundsException(n.toString())
2323
}
2424
}
25-
object A extends scala.Function1[scala.Int, A]
25+
object A extends scala.Function1[scala.Int, A]

tests/pos/simpleCaseClass-3.decompiled

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** Decompiled from out/posTestFromTasty/pos/simpleCaseClass-3/A.class */
1+
/** Decompiled from out/posTestFromTasty/pos/simpleCaseClass-3/A.tasty */
22
case class A[T](x: T) {
33
override def hashCode(): scala.Int = {
44
var acc: scala.Int = 65

tests/pos/simpleCaseObject.decompiled

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** Decompiled from out/posTestFromTasty/pos/simpleCaseObject/foo/Foo.class */
1+
/** Decompiled from out/posTestFromTasty/pos/simpleCaseObject/foo/Foo.tasty */
22
package foo {
33
case object Foo {
44
override def hashCode(): scala.Int = 1045991777
@@ -11,4 +11,4 @@ package foo {
1111
throw new java.lang.IndexOutOfBoundsException(n.toString())
1212
}
1313
}
14-
}
14+
}

tests/run/literals.decompiled

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** Decompiled from out/runTestFromTasty/run/literals/Test.class */
1+
/** Decompiled from out/runTestFromTasty/run/literals/Test.tasty */
22
object Test {
33
def αρετη: java.lang.String = "alpha rho epsilon tau eta"
44
case class GGG(i: scala.Int) {
@@ -95,4 +95,4 @@ object Test {
9595
val ggg: scala.Int = Test.GGG.apply(1).αα(Test.GGG.apply(2))
9696
Test.check_success[scala.Int]("ggg == 3", ggg, 3)
9797
}
98-
}
98+
}

0 commit comments

Comments
 (0)