diff --git a/compiler/src/dotty/tools/dotc/printing/DecompilerPrinter.scala b/compiler/src/dotty/tools/dotc/printing/DecompilerPrinter.scala index 13ec0f15cfdc..af3c1c46f3ac 100644 --- a/compiler/src/dotty/tools/dotc/printing/DecompilerPrinter.scala +++ b/compiler/src/dotty/tools/dotc/printing/DecompilerPrinter.scala @@ -38,7 +38,7 @@ class DecompilerPrinter(_ctx: Context) extends RefinedPrinter(_ctx) { } val statsText = stats match { case (pdef: PackageDef) :: Nil => toText(pdef) - case _ => toTextGlobal(stats, "\n") + case _ => Fluid(toTextGlobal(stats, "\n") :: Nil) } val bodyText = if (tree.pid.symbol.isEmptyPackage) statsText diff --git a/tests/pos/classWithCompObj.decompiled b/tests/pos/classWithCompObj.decompiled new file mode 100644 index 000000000000..819bd7c90943 --- /dev/null +++ b/tests/pos/classWithCompObj.decompiled @@ -0,0 +1,3 @@ +/** Decompiled from out/posTestFromTasty/pos/classWithCompObj/Foo.class */ +class Foo() {} +object Foo {} \ No newline at end of file diff --git a/tests/pos/classWithCompObj.scala b/tests/pos/classWithCompObj.scala new file mode 100644 index 000000000000..f7bb36eefd81 --- /dev/null +++ b/tests/pos/classWithCompObj.scala @@ -0,0 +1,2 @@ +class Foo +object Foo \ No newline at end of file