Skip to content
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

Preserve parent chain's origin when doing Tree.tranform. (fix #1345) #1349

Merged

Conversation

MasseGuillaume
Copy link
Collaborator

@MasseGuillaume MasseGuillaume commented Feb 19, 2018

No description provided.

@MasseGuillaume MasseGuillaume changed the title Preserve the origin of the parent chain when doing Tree.tranform. (fi… Preserve parent chain's origin when doing Tree.tranform. (fix #1345) Feb 19, 2018
Copy link
Member

@olafurpg olafurpg left a comment

Choose a reason for hiding this comment

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

Very exciting! This will open up a new era for tree transform refactorings 😄

@@ -88,7 +88,7 @@ class TransformerMacros(val c: Context) extends TransverserMacros {
var same = true
..$transformedFields
if (same) tree
else $constructor(..${transformedFields.map(_.name)})
else $constructor(..${transformedFields.map(_.name)}).withOrigin(tree.origin)
Copy link
Member

Choose a reason for hiding this comment

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

Wow, I can't believe it was this simple!


class ParentSuite extends FunSuite {

test("Tree.transform does not preserve parent chain origins") {
Copy link
Member

Choose a reason for hiding this comment

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

Can we add more detailed tests?

  • validate only Lit.Int(3) is missing pos
  • validate all other nodes have same position as their corresponding node have before

Copy link
Member

@olafurpg olafurpg left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@olafurpg olafurpg merged commit e138a00 into scalameta:master Feb 19, 2018
@olafurpg olafurpg added this to the 3.4.0 milestone Feb 28, 2018
MasseGuillaume added a commit to MasseGuillaume/scalameta that referenced this pull request May 8, 2018
olafurpg added a commit that referenced this pull request Jul 4, 2018
fikovnik pushed a commit to fikovnik/scalameta that referenced this pull request Aug 24, 2018
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.

None yet

2 participants