diff --git a/compiler/src/dotty/tools/dotc/printing/DecompilerPrinter.scala b/compiler/src/dotty/tools/dotc/printing/DecompilerPrinter.scala index 13ec0f15cfdc..7d2eb82be166 100644 --- a/compiler/src/dotty/tools/dotc/printing/DecompilerPrinter.scala +++ b/compiler/src/dotty/tools/dotc/printing/DecompilerPrinter.scala @@ -61,6 +61,7 @@ class DecompilerPrinter(_ctx: Context) extends RefinedPrinter(_ctx) { (sym == defn.ProductClass && impl.symbol.owner.is(Case)) } val parents = impl.parents.filterNot(isSynthetic) + val body = impl.body.filterNot(_.symbol.is(ParamAccessor)) // We don't print self type and constructor for objects val isObject = impl.constr.symbol.owner.is(Module) @@ -69,7 +70,7 @@ class DecompilerPrinter(_ctx: Context) extends RefinedPrinter(_ctx) { val bodyText = " {" ~~ toTextGlobal(impl.body, "\n") ~ "}" parentsText.provided(parents.nonEmpty) ~ bodyText } - else super.toTextTemplate(impl.copy(parents = parents), ofNew) + else super.toTextTemplate(impl.copy(parents = parents, preBody = body), ofNew) } override protected def typeApplyText[T >: Untyped](tree: TypeApply[T]): Text = { diff --git a/tests/pos/i4526-2.decompiled b/tests/pos/i4526-2.decompiled new file mode 100644 index 000000000000..b53220574bf5 --- /dev/null +++ b/tests/pos/i4526-2.decompiled @@ -0,0 +1,2 @@ +/** Decompiled from out/posTestFromTasty/pos/i4526-2/Foo.class */ +class Foo(x: Int, y: Int) {} diff --git a/tests/pos/i4526-2.scala b/tests/pos/i4526-2.scala new file mode 100644 index 000000000000..4ea1f545bf71 --- /dev/null +++ b/tests/pos/i4526-2.scala @@ -0,0 +1 @@ +class Foo(x: Int, y: Int)