-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Print annotation in decompiler #4676
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
Print annotation in decompiler #4676
Conversation
6604693
to
66fea8b
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
printType(tree.tpe) | ||
case tree @ Term.Ident(name) => | ||
tree.tpe match { | ||
case Type.SymRef(_, Types.EmptyPrefix()) | Type.TermRef(_, Types.EmptyPrefix()) => this += name |
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.
It seems SymRef
subsumes TermRef
?
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.
No, both are core.Types.NamedType
s but SymRef
as a symbol as designator
and TermRef
has a TermName
as designator
.
@@ -768,13 +800,35 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty | |||
} | |||
|
|||
def printDefinitionName(sym: Definition): Buffer = sym match { | |||
case ValDef(name, _, _) => this += name | |||
case ValDef(name, _, _) => this += name += ".type" |
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.
why this change?
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'm trying to figure out how to print (x: @annot)
, the issue is that it gets expanded to something like (x: x @annot)
. I was trying to workaround it by printing (x: x.type @annot)
instead. I will now try to print it as (x: @annot)
as it was originally.
66fea8b
to
c5ff0b2
Compare
@liufengyun could you review the changes in the last commit |
@liufengyun last 2 commits |
this += ".type" | ||
case tpe => printType(tpe) | ||
} | ||
printTypeAndAnnots(tree.tpe) |
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.
tests/run-with-compiler/i3947c.scala
failed due to the change, I cannot figure out why.
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.
It was because scala.runtime.Null$
and scala.runtime.Nothing$
where handled as modules. Those are now special cases.
7fa5814
to
40fffc1
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.
LGTM
No description provided.