Skip to content

Print decompiled refinements #4698

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 5 commits into from
Jun 21, 2018

Conversation

nicolasstucki
Copy link
Contributor

No description provided.

Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

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

Otherwise, LGTM

@@ -74,6 +74,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty

if (flags.isObject) this += "object " += name.stripSuffix("$")
else if (flags.isTrait) this += "trait " += name
else if (flags.isAbstract) this += "abstract class " += name
else this += "class " += name
Copy link
Contributor

Choose a reason for hiding this comment

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

sealed, final and access modifiers are missing here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

final is a few lines above. I will add sealed .

if (!sym.flags.isLocal) {
printType(prefix)
this += "."
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems it is also OK to print the prefix here? For hygiene, we do need to print the prefix for local members as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is to not print prefixes in references inside the parents of a class.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please explain what do you mean by prefixes in references inside the parents of a class? I see in the code C.this.T becomes T, which may be unhygienic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will reprint the prefix and add test cases where this fails

this += ": "
printType(tp)
}
printMethodicType(info)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd refactor the case Refinement into a method, as it's too fat.

It seems to be neater if printMethodicType is only called from the first case of patmat on info.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will refactor

printMethodicTypeParams(paramNames, params)
this += ") => "
printTypeOrBound(body)

Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this necessary? I assume method types are handled already in refinement case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I can see we do not need it. I will remove it.

@nicolasstucki nicolasstucki merged commit fc6db4b into scala:master Jun 21, 2018
@liufengyun liufengyun deleted the print-refinements branch June 21, 2018 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants