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

[11041] Deprecate .zipped method on tuples #7025

Merged
merged 1 commit into from
Aug 9, 2018

Conversation

joshlemer
Copy link
Contributor

@scala-jenkins scala-jenkins added this to the 2.13.0-RC1 milestone Aug 8, 2018
[11041] Deprecate Tuple2Zipped, Tuple3Zipped, ZippedIterable2, ZippedIterable3

[11041] Replace usages of .zipped with .lazyZip

[11041] Replace usages of .zipped (3 way) with .lazyZip.lazyZip
@@ -303,7 +303,7 @@ trait MatchApproximation extends TreeAndTypeAnalysis with ScalaLogic with MatchT
// debug.patmat ("normalize subst: "+ normalize)

val okSubst = Substitution(unboundFrom.toList, unboundTo.toList) // it's important substitution does not duplicate trees here -- it helps to keep hash consing simple, anyway
pointsToBound ++= ((okSubst.from, okSubst.to).zipped filter { (f, t) => pointsToBound exists (sym => t.exists(_.symbol == sym)) })._1
pointsToBound ++= okSubst.from.lazyZip(okSubst.to).collect { case (f, t) if pointsToBound.exists(sym => t.exists(_.symbol == sym)) => f }
Copy link
Contributor

Choose a reason for hiding this comment

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

Why replacing filter with collect?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The original code is filtering and then at the end, takes only the left iterable. I took liberty of replacing it with a collect which just collects the left elements when the predicate holds.

@@ -25,7 +25,7 @@ class ArraySortingTest {
java.util.Arrays.sort(test)
scala.util.Sorting.quickSort(cant)(CanOrder)
assert( test(6) == 1 )
assert( (test,cant).zipped.forall(_ == _.i) )
assert( test.toIterable.lazyZip(cant).forall(_ == _.i) )
Copy link
Contributor

Choose a reason for hiding this comment

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

We should add lazyZip to ArrayOps so that users don’t have to convert it to an Iterable. We could do the same with StringOps, btw. I’ve created scala/bug#11063 for that. You don’t have to do it in that PR.

@SethTisue SethTisue modified the milestones: 2.13.0-RC1, 2.13.0-M5 Aug 9, 2018
@SethTisue SethTisue merged commit d38b175 into scala:2.13.x Aug 9, 2018
@SethTisue
Copy link
Member

thank you Josh!

@joshlemer joshlemer deleted the issue/11041-2.13 branch August 9, 2018 20:02
@SethTisue SethTisue added the release-notes worth highlighting in next release notes label Aug 21, 2018
@SethTisue SethTisue changed the title [11041] Deprecate Predef.{tuple2ToZippedOps,tuple3ToZippedOps} [11041] Deprecate .zipped method on tuples Aug 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes worth highlighting in next release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants