Skip to content

Rewrite retain to filterInPlace #34

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 3 commits into from
Jun 11, 2018

Conversation

MasseGuillaume
Copy link
Contributor

@MasseGuillaume MasseGuillaume commented Jun 11, 2018

@julienrf
Copy link
Contributor

There is a subtlety: in 2.12 retain takes a Function2[K, V, Boolean], whereas in 2.13 filterInPlace takes a Function1[(K, V), Boolean].

@julienrf
Copy link
Contributor

The code generated by the rewrite should compile with -Yno-adapted-args.

@julienrf
Copy link
Contributor

Then I guess it becomes a bit complicated, you will have to transform a (x, y) => e expression into { case (x, y) => e }. Is it possible to achieve?

@julienrf julienrf merged commit 431d2fa into scala:master Jun 11, 2018
@@ -30,6 +30,28 @@ case class Scalacollectioncompat_NewCollections(index: SemanticdbIndex)
Symbol("_root_.scala.runtime.Tuple3Zipped.Ops.zipped.")
)

val retain =
SymbolMatcher.normalized(
Symbol("_root_.scala.collection.mutable.MapLike.retain.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Oops, I’ve just noticed that this operation is also on mutable.Set. We should support that use case too…

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#36

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.

Rewrite retain to filterInPlace
2 participants