Skip to content

Commit 45da54e

Browse files
authored
Merge pull request scala#8996 from ganchurin/scala-bug/issue-12010
2 parents a8a7261 + 8deb959 commit 45da54e

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/library/scala/collection/ArrayOps.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -559,8 +559,8 @@ final class ArrayOps[A](private val xs: Array[A]) extends AnyVal {
559559

560560
/** Selects all elements of this array which do not satisfy a predicate.
561561
*
562-
* @param pred the predicate used to test elements.
563-
* @return a new array consisting of all elements of this array that do not satisfy the given predicate `pred`.
562+
* @param p the predicate used to test elements.
563+
* @return a new array consisting of all elements of this array that do not satisfy the given predicate `p`.
564564
*/
565565
def filterNot(p: A => Boolean): Array[A] = filter(x => !p(x))
566566

@@ -678,10 +678,10 @@ final class ArrayOps[A](private val xs: Array[A]) extends AnyVal {
678678
* @return the index `>= from` of the first element of this array that satisfies the predicate `p`,
679679
* or `-1`, if none exists.
680680
*/
681-
def indexWhere(f: A => Boolean, from: Int = 0): Int = {
681+
def indexWhere(@deprecatedName("f", "2.13.3") p: A => Boolean, from: Int = 0): Int = {
682682
var i = from
683683
while(i < xs.length) {
684-
if(f(xs(i))) return i
684+
if(p(xs(i))) return i
685685
i += 1
686686
}
687687
-1
@@ -724,8 +724,8 @@ final class ArrayOps[A](private val xs: Array[A]) extends AnyVal {
724724
* @return an option value containing the first element in the array
725725
* that satisfies `p`, or `None` if none exists.
726726
*/
727-
def find(f: A => Boolean): Option[A] = {
728-
val idx = indexWhere(f)
727+
def find(@deprecatedName("f", "2.13.3") p: A => Boolean): Option[A] = {
728+
val idx = indexWhere(p)
729729
if(idx == -1) None else Some(xs(idx))
730730
}
731731

@@ -734,18 +734,18 @@ final class ArrayOps[A](private val xs: Array[A]) extends AnyVal {
734734
* @param p the predicate used to test elements.
735735
* @return `true` if the given predicate `p` is satisfied by at least one element of this array, otherwise `false`
736736
*/
737-
def exists(f: A => Boolean): Boolean = indexWhere(f) >= 0
737+
def exists(@deprecatedName("f", "2.13.3") p: A => Boolean): Boolean = indexWhere(p) >= 0
738738

739739
/** Tests whether a predicate holds for all elements of this array.
740740
*
741741
* @param p the predicate used to test elements.
742742
* @return `true` if this array is empty or the given predicate `p`
743743
* holds for all elements of this array, otherwise `false`.
744744
*/
745-
def forall(f: A => Boolean): Boolean = {
745+
def forall(@deprecatedName("f", "2.13.3") p: A => Boolean): Boolean = {
746746
var i = 0
747747
while(i < xs.length) {
748-
if(!f(xs(i))) return false
748+
if(!p(xs(i))) return false
749749
i += 1
750750
}
751751
true

src/library/scala/collection/StringOps.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,11 +1026,11 @@ final class StringOps(private val s: String) extends AnyVal {
10261026
* @return `true` if this string is empty or the given predicate `p`
10271027
* holds for all chars of this string, otherwise `false`.
10281028
*/
1029-
def forall(f: Char => Boolean): Boolean = {
1029+
def forall(@deprecatedName("f", "2.13.3") p: Char => Boolean): Boolean = {
10301030
var i = 0
10311031
val len = s.length
10321032
while(i < len) {
1033-
if(!f(s.charAt(i))) return false
1033+
if(!p(s.charAt(i))) return false
10341034
i += 1
10351035
}
10361036
true

0 commit comments

Comments
 (0)