Skip to content

Commit 57a8c47

Browse files
committed
[nomerge] Use foldLeft instead of /:
Ref scala/bug#11411 Ref scala/scala#6646 This backports the /: deprecation to aid the transition from 2.12.x to 2.13.x.
1 parent e117a39 commit 57a8c47

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

library/src/scala/collection/GenTraversableOnce.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ trait GenTraversableOnce[+A] extends Any {
199199
* }}}
200200
* where `x,,1,,, ..., x,,n,,` are the elements of this $coll.
201201
*/
202+
@deprecated("Use foldLeft instead of /:", "2.12.10")
202203
def /:[B](z: B)(op: (B, A) => B): B
203204

204205
/** Applies a binary operator to all elements of this $coll and a start value,
@@ -234,6 +235,7 @@ trait GenTraversableOnce[+A] extends Any {
234235
* }}}
235236
* where `x,,1,,, ..., x,,n,,` are the elements of this $coll.
236237
*/
238+
@deprecated("Use foldRight instead of :\\", "2.12.10")
237239
def :\[B](z: B)(op: (A, B) => B): B
238240

239241
/** Applies a binary operator to a start value and all elements of this $coll,

library/src/scala/collection/TraversableOnce.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,10 @@ trait TraversableOnce[+A] extends Any with GenTraversableOnce[A] {
151151
None
152152
}
153153

154+
@deprecated("Use foldLeft instead of /:", "2.12.10")
154155
def /:[B](z: B)(op: (B, A) => B): B = foldLeft(z)(op)
155156

157+
@deprecated("Use foldRight instead of :\\", "2.12.10")
156158
def :\[B](z: B)(op: (A, B) => B): B = foldRight(z)(op)
157159

158160
def foldLeft[B](z: B)(op: (B, A) => B): B = {

library/src/scala/collection/parallel/ParIterableLike.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,8 +1472,10 @@ self: ParIterableLike[T, Repr, Sequential] =>
14721472

14731473
/* alias methods */
14741474

1475+
@deprecated("Use foldLeft instead of /:", "2.12.10")
14751476
def /:[S](z: S)(op: (S, T) => S): S = foldLeft(z)(op)
14761477

1478+
@deprecated("Use foldRight instead of :\\", "2.12.10")
14771479
def :\[S](z: S)(op: (T, S) => S): S = foldRight(z)(op)
14781480

14791481
/* debug information */

0 commit comments

Comments
 (0)