Skip to content

Do not print class fields #4532

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
May 15, 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
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 = {
Expand Down
2 changes: 2 additions & 0 deletions tests/pos/i4526-2.decompiled
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/** Decompiled from out/posTestFromTasty/pos/i4526-2/Foo.class */
class Foo(x: Int, y: Int) {}
1 change: 1 addition & 0 deletions tests/pos/i4526-2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
class Foo(x: Int, y: Int)