File tree 5 files changed +37
-43
lines changed
compiler/src/dotty/tools/dotc/printing 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) {
36
36
case _ => toTextGlobal(stats, " \n " )
37
37
}
38
38
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
41
43
}
42
44
43
45
override protected def templateText (tree : TypeDef , impl : Template ): Text = {
Original file line number Diff line number Diff line change 1
1
================================================================================
2
2
out/posTestFromTasty/pos/methodTypes/Foo.class
3
3
--------------------------------------------------------------------------------
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
10
8
}
11
9
--------------------------------------------------------------------------------
Original file line number Diff line number Diff line change 1
1
================================================================================
2
2
out/posTestFromTasty/pos/simpleDoWhile/Foo.class
3
3
--------------------------------------------------------------------------------
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
+ }
16
14
}
17
15
--------------------------------------------------------------------------------
Original file line number Diff line number Diff line change 1
1
================================================================================
2
2
out/posTestFromTasty/pos/simpleWhile/Foo.class
3
3
--------------------------------------------------------------------------------
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
+ }
15
13
}
16
14
--------------------------------------------------------------------------------
Original file line number Diff line number Diff line change 1
1
================================================================================
2
2
out/runTestFromTasty/run/puzzle/Test.class
3
3
--------------------------------------------------------------------------------
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
+ }
16
14
}
17
15
--------------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments