Skip to content

Print top level packages #4608

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions library/src/scala/tasty/util/ShowSourceCode.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
def printTree(tree: Tree): Buffer = tree match {
case tree @ PackageClause(Term.Ident(name), stats) =>
val stats1 = stats.collect {
case stat@Definition() if !(stat.flags.isObject && stat.flags.isLazy) => stat
case stat@Import(_, _) => stat
case stat @ PackageClause(_, _) => stat
case stat @ Definition() if !(stat.flags.isObject && stat.flags.isLazy) => stat
case stat @ Import(_, _) => stat
}

if (name == "<empty>") {
Expand Down
14 changes: 14 additions & 0 deletions tests/run/simpleClass.decompiled
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/** Decompiled from out/runTestFromTasty/run/simpleClass/Test.class */
object Test {
def main(args: scala.Array[scala.Predef.String]): scala.Unit = {
scala.Predef.println(new foo.A().getClass().getName())
scala.Predef.println(new foo.B().getClass().getName())
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code change doesn't seem to affect object printing. Why this is not needed before?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the tests are in the empty package. Hence where directly inside the root.

}/** Decompiled from out/runTestFromTasty/run/simpleClass/foo/A.class */
package foo {
class A()
}
/** Decompiled from out/runTestFromTasty/run/simpleClass/foo/B.class */
package foo {
class B() extends foo.A
}