Skip to content

Add more rules to CrossCompile #78

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
Jul 2, 2018
Merged

Conversation

MasseGuillaume
Copy link
Contributor

@MasseGuillaume MasseGuillaume commented Jul 2, 2018

fix #75

@MasseGuillaume
Copy link
Contributor Author

@julienrf ready for review

// At that point we know that *at least one* iterator has no next element
// If *both* of them have no elements then the collections are the same
self.hasNext == those.hasNext
}
Copy link
Contributor

Choose a reason for hiding this comment

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

You can simply delegate to self.sameElements(that.iterator).

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a test for this decorator in compat/src/test/scala/?

@@ -4,6 +4,8 @@ import scalafix._
import scalafix.util._
import scala.meta._

import scala.collection.mutable.{Set => MSet}
Copy link
Contributor

Choose a reason for hiding this comment

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

The recommended practice is to import scala.collection.mutable and then write mutable.Set at use site.

@@ -153,6 +157,8 @@ case class CanBuildFromNothing(param: Name,
body.collect {
case ap @ Term.ApplyType(Term.Select(e, to @ toTpe(_)), List(cc2 @ matchCC(_))) =>

handledTo += to
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this code related to the .sameElements rewrite rule?

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain the list of changes performed by this commit in the commit message?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

CanBuildFrom and .to[C] => .to(C) are now in the same Rule. You need to guard the .to rewrite from the one in CanBuildFrom. This PR fix #75 and does more.

Copy link
Contributor

@julienrf julienrf left a comment

Choose a reason for hiding this comment

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

That looks good! Can you squash the commit and list the changes in the commit message?

@MasseGuillaume
Copy link
Contributor Author

This one is ready for merging.

@julienrf
Copy link
Contributor

julienrf commented Jul 2, 2018

Do you mind adding more information about the changes in the commit message?

It's possible to cross-compile two rewrite rules
to[List] => to(List)
it.sameElements
@MasseGuillaume
Copy link
Contributor Author

Done

@julienrf julienrf merged commit b623281 into scala:master Jul 2, 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.

Iterator#sameElements has a different signature between 2.12 and 2.13
2 participants