Skip to content

Rule for symbolic foldLeft(/:) and foldRight(:/) (fix #27) #35

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 1 commit into from
Jun 12, 2018

Conversation

MasseGuillaume
Copy link
Contributor

No description provided.

def replaceSymbolicFold(ctx: RuleCtx) =
ctx.tree.collect {
case Term.Apply(ap @ Term.ApplyInfix(rhs, foldRightSymbol(_), _, List(lhs)), _) =>
ctx.replaceTree(ap, s"$rhs.foldRight($lhs)")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@julienrf this would remove formatting and delete comments inside the parenthesis of the infix apply.

ex:

/*1*/(/*2*/ 0 /*3*/ /: /*4*/ xs /*5*/)/*6*/(f)
/*1*/xs.foldLeft(0)/*6*/(f)

the best we can achieve is to preserve one side, since this refactoring swap them.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don’t think lot of people write comments at those places anyway. If someone raises the issue we should address it, but for now let’s stick to this simple solution.

@julienrf julienrf merged commit bdb2197 into scala:master Jun 12, 2018
martijnhoekstra pushed a commit to martijnhoekstra/scala-collection-compat that referenced this pull request Nov 9, 2022
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