File tree Expand file tree Collapse file tree 5 files changed +37
-43
lines changed
compiler/src/dotty/tools/dotc/printing Expand file tree Collapse file tree 5 files changed +37
-43
lines changed Original file line number Diff line number Diff line change @@ -36,8 +36,10 @@ class DecompilerPrinter(_ctx: Context) extends RefinedPrinter(_ctx) {
3636 case _ => toTextGlobal(stats, " \n " )
3737 }
3838 val bodyText =
39- if (currentPrecedence == TopLevelPrec ) " \n " ~ statsText else " {" ~ statsText ~ " }"
40- keywordStr(" package " ) ~ toTextPackageId(tree.pid) ~ bodyText
39+ if (tree.pid.symbol.isEmptyPackage) statsText
40+ else if (currentPrecedence == TopLevelPrec ) " \n " ~ statsText
41+ else " {" ~ statsText ~ " }"
42+ (keywordStr(" package " ) ~ toTextPackageId(tree.pid)).provided(! tree.pid.symbol.isEmptyPackage) ~ bodyText
4143 }
4244
4345 override protected def templateText (tree : TypeDef , impl : Template ): Text = {
Original file line number Diff line number Diff line change 11================================================================================
22out/posTestFromTasty/pos/methodTypes/Foo.class
33--------------------------------------------------------------------------------
4- package <empty> {
5- class Foo() extends Object() {
6- val x: Int = 1
7- def y: Int = 2
8- def z(): Int = 3
9- }
4+ class Foo() extends Object() {
5+ val x: Int = 1
6+ def y: Int = 2
7+ def z(): Int = 3
108}
119--------------------------------------------------------------------------------
Original file line number Diff line number Diff line change 11================================================================================
22out/posTestFromTasty/pos/simpleDoWhile/Foo.class
33--------------------------------------------------------------------------------
4- package <empty> {
5- class Foo() extends Object() {
6- def foo: Unit =
7- {
8- var i: Int = 1
9- do
10- {
11- i = 0
12- }
13- while (i.!=(0))
14- }
15- }
4+ class Foo() extends Object() {
5+ def foo: Unit =
6+ {
7+ var i: Int = 1
8+ do
9+ {
10+ i = 0
11+ }
12+ while (i.!=(0))
13+ }
1614}
1715--------------------------------------------------------------------------------
Original file line number Diff line number Diff line change 11================================================================================
22out/posTestFromTasty/pos/simpleWhile/Foo.class
33--------------------------------------------------------------------------------
4- package <empty> {
5- class Foo() extends Object() {
6- def foo: Unit =
7- {
8- var i: Int = 1
9- while (i.!=(0))
10- {
11- i = 0
12- }
13- }
14- }
4+ class Foo() extends Object() {
5+ def foo: Unit =
6+ {
7+ var i: Int = 1
8+ while (i.!=(0))
9+ {
10+ i = 0
11+ }
12+ }
1513}
1614--------------------------------------------------------------------------------
Original file line number Diff line number Diff line change 11================================================================================
22out/runTestFromTasty/run/puzzle/Test.class
33--------------------------------------------------------------------------------
4- package <empty> {
5- object Test() extends Object() { this: Test.type =>
6- def main(args: Array[String]): Unit =
7- {
8- println(if false then 5.0 else 53.0)
9- val x: Double = if false then 5.0 else 53.0
10- println(x)
11- val z: Long = 1L
12- val y: Float = Long.long2float(z)
13- ()
14- }
15- }
4+ object Test() extends Object() { this: Test.type =>
5+ def main(args: Array[String]): Unit =
6+ {
7+ println(if false then 5.0 else 53.0)
8+ val x: Double = if false then 5.0 else 53.0
9+ println(x)
10+ val z: Long = 1L
11+ val y: Float = Long.long2float(z)
12+ ()
13+ }
1614}
1715--------------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments