-
Notifications
You must be signed in to change notification settings - Fork 224
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
Preserve parent chain's origin when doing Tree.tranform. (fix #1345) #1349
Conversation
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.
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) |
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.
Wow, I can't believe it was this simple!
|
||
class ParentSuite extends FunSuite { | ||
|
||
test("Tree.transform does not preserve parent chain origins") { |
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.
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
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.