-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix case class decompilation #4633
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
Fix case class decompilation #4633
Conversation
d6f0dd3
to
820c3d8
Compare
820c3d8
to
f84d017
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise, LGTM
tp match { | ||
case Type.SymRef(cdef @ ClassDef(_, _, _, _, _), _) if !cdef.flags.isObject => this += ".this" | ||
case _ => this | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain why special case object here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When refering to the this type of a module we just refere directly to the module itself. For example scala.Predef
and not scala.Predef.this
.
@@ -112,8 +112,24 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty | |||
} | |||
} | |||
|
|||
def keepDefinition(d: Definition): Boolean = { | |||
val flags = d.flags | |||
import flags._ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think import flags._
doesn't help in terms of readability: it takes me some time to realize that isParam
is a method on d.flags
. In isCaseUnOverridableMethod
, it still uses d.flags
.
A short doc can help better understand the motivation for the method isCaseUnOverridableMethod
. A naive question: why not just ignore all synthetic definitions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will improve code and add docs.
I decided to print the synthetic methods to allow users to see what was generated. I will add some /* synthetic */
comment on them later. And I'm considering adding a mode that those not print them. I started printing them because I can test more code, therefore more of the Tasty reflect API.
No description provided.