-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Conversation
[11041] Deprecate Tuple2Zipped, Tuple3Zipped, ZippedIterable2, ZippedIterable3 [11041] Replace usages of .zipped with .lazyZip [11041] Replace usages of .zipped (3 way) with .lazyZip.lazyZip
b569aa7
to
3e7d0af
Compare
@@ -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 } |
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.
Why replacing filter
with collect
?
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.
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) ) |
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.
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.
thank you Josh! |
Fixes scala/bug#11041