Skip to content
Permalink
Browse files

Removes @bridge methods.

  • Loading branch information
soc committed Apr 28, 2012
1 parent 399ab16 commit d1460afa09989bcecb306b3cf78880cea39cbdc7
Showing with 5 additions and 214 deletions.
  1. +0 −7 src/library/scala/collection/GenSeqLike.scala
  2. +0 −15 src/library/scala/collection/GenSetLike.scala
  3. +0 −11 src/library/scala/collection/IterableLike.scala
  4. +0 −3 src/library/scala/collection/MapLike.scala
  5. +0 −36 src/library/scala/collection/SeqLike.scala
  6. +0 −4 src/library/scala/collection/SeqViewLike.scala
  7. +0 −9 src/library/scala/collection/SetLike.scala
  8. +0 −6 src/library/scala/collection/Traversable.scala
  9. +0 −4 src/library/scala/collection/TraversableLike.scala
  10. +1 −6 src/library/scala/collection/generic/GenSeqFactory.scala
  11. +1 −9 src/library/scala/collection/generic/GenericSeqCompanion.scala
  12. +0 −5 src/library/scala/collection/generic/GenericTraversableTemplate.scala
  13. +0 −2 src/library/scala/collection/generic/MapFactory.scala
  14. +1 −8 src/library/scala/collection/generic/SetFactory.scala
  15. +0 −3 src/library/scala/collection/generic/Subtractable.scala
  16. +1 −44 src/library/scala/collection/generic/TraversableFactory.scala
  17. +0 −3 src/library/scala/collection/immutable/ListMap.scala
  18. +0 −2 src/library/scala/collection/immutable/ListSet.scala
  19. +0 −2 src/library/scala/collection/immutable/MapLike.scala
  20. +1 −4 src/library/scala/collection/immutable/Range.scala
  21. +0 −2 src/library/scala/collection/immutable/SortedMap.scala
  22. +0 −2 src/library/scala/collection/immutable/TreeMap.scala
  23. +0 −5 src/library/scala/collection/mutable/BufferLike.scala
  24. +0 −4 src/library/scala/collection/mutable/MapLike.scala
  25. +0 −3 src/library/scala/collection/mutable/PriorityQueue.scala
  26. +0 −4 src/library/scala/collection/mutable/SetLike.scala
  27. +0 −5 src/library/scala/package.scala
  28. +0 −6 src/library/scala/runtime/RichInt.scala
@@ -228,9 +228,6 @@ trait GenSeqLike[+A, +Repr] extends Any with GenIterableLike[A, Repr] with Equal
*/
def startsWith[B](that: GenSeq[B]): Boolean = startsWith(that, 0)

@bridge
def startsWith[B](that: Seq[B]): Boolean = startsWith(that: GenSeq[B])

/** Tests whether this $coll contains the given sequence at a given index.
*
* '''Note''': If the both the receiver object `this` and the argument
@@ -413,10 +410,6 @@ trait GenSeqLike[+A, +Repr] extends Any with GenIterableLike[A, Repr] with Equal
*/
def union[B >: A, That](that: GenSeq[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = this ++ that

@bridge
def union[B >: A, That](that: Seq[B])(implicit bf: CanBuildFrom[Repr, B, That]): That =
union(that: GenSeq[B])(bf)

/** Computes the multiset difference between this $coll and another sequence.
*
* @param that the sequence of elements to remove
@@ -51,9 +51,6 @@ extends GenIterableLike[A, Repr]
*/
def intersect(that: GenSet[A]): Repr = this filter that

@bridge
def intersect(that: Set[A]): Repr = intersect(that: GenSet[A])

/** Computes the intersection between this set and another set.
*
* '''Note:''' Same as `intersect`.
@@ -63,9 +60,6 @@ extends GenIterableLike[A, Repr]
*/
def &(that: GenSet[A]): Repr = this intersect that

@bridge
def &(that: Set[A]): Repr = &(that: GenSet[A])

/** Computes the union between of set and another set.
*
* @param that the set to form the union with.
@@ -83,9 +77,6 @@ extends GenIterableLike[A, Repr]
*/
def | (that: GenSet[A]): Repr = this union that

@bridge
def | (that: Set[A]): Repr = | (that: GenSet[A])

/** Computes the difference of this set and another set.
*
* @param that the set of elements to exclude.
@@ -103,9 +94,6 @@ extends GenIterableLike[A, Repr]
*/
def &~(that: GenSet[A]): Repr = this diff that

@bridge
def &~(that: Set[A]): Repr = &~(that: GenSet[A])

/** Tests whether this set is a subset of another set.
*
* @param that the set to test.
@@ -114,9 +102,6 @@ extends GenIterableLike[A, Repr]
*/
def subsetOf(that: GenSet[A]): Boolean = this forall that

@bridge
def subsetOf(that: Set[A]): Boolean = subsetOf(that: GenSet[A])

/** Compares this set with another object for equality.
*
* '''Note:''' This operation contains an unchecked cast: if `that`
@@ -239,10 +239,6 @@ self =>
b.result
}

@bridge
def zip[A1 >: A, B, That](that: Iterable[B])(implicit bf: CanBuildFrom[Repr, (A1, B), That]): That =
zip(that: GenIterable[B])(bf)

def zipAll[B, A1 >: A, That](that: GenIterable[B], thisElem: A1, thatElem: B)(implicit bf: CanBuildFrom[Repr, (A1, B), That]): That = {
val b = bf(repr)
val these = this.iterator
@@ -256,10 +252,6 @@ self =>
b.result
}

@bridge
def zipAll[B, A1 >: A, That](that: Iterable[B], thisElem: A1, thatElem: B)(implicit bf: CanBuildFrom[Repr, (A1, B), That]): That =
zipAll(that: GenIterable[B], thisElem, thatElem)(bf)

def zipWithIndex[A1 >: A, That](implicit bf: CanBuildFrom[Repr, (A1, Int), That]): That = {
val b = bf(repr)
var i = 0
@@ -280,9 +272,6 @@ self =>
!these.hasNext && !those.hasNext
}

@bridge
def sameElements[B >: A](that: Iterable[B]): Boolean = sameElements(that: GenIterable[B])

override /*TraversableLike*/ def toStream: Stream[A] = iterator.toStream

/** Method called from equality methods, so that user-defined subclasses can
@@ -297,9 +297,6 @@ self =>
def ++[B1 >: B](xs: GenTraversableOnce[(A, B1)]): Map[A, B1] =
((repr: Map[A, B1]) /: xs.seq) (_ + _)

@bridge
def ++[B1 >: B](xs: TraversableOnce[(A, B1)]): Map[A, B1] = ++(xs: GenTraversableOnce[(A, B1)])

/** Returns a new map with all key/value pairs for which the predicate
* `p` returns `true`.
*
@@ -296,9 +296,6 @@ trait SeqLike[+A, +Repr] extends Any with IterableLike[A, Repr] with GenSeqLike[
!j.hasNext
}

@bridge
def startsWith[B](that: Seq[B], offset: Int): Boolean = startsWith(that: GenSeq[B], offset)

def endsWith[B](that: GenSeq[B]): Boolean = {
val i = this.iterator.drop(length - that.length)
val j = that.iterator
@@ -309,10 +306,6 @@ trait SeqLike[+A, +Repr] extends Any with IterableLike[A, Repr] with GenSeqLike[
!j.hasNext
}

@bridge
def endsWith[B](that: Seq[B]): Boolean = endsWith(that: GenSeq[B])


/** Finds first index where this $coll contains a given sequence as a slice.
* $mayNotTerminateInf
* @param that the sequence to test
@@ -321,9 +314,6 @@ trait SeqLike[+A, +Repr] extends Any with IterableLike[A, Repr] with GenSeqLike[
*/
def indexOfSlice[B >: A](that: GenSeq[B]): Int = indexOfSlice(that, 0)

@bridge
def indexOfSlice[B >: A](that: Seq[B]): Int = indexOfSlice(that: GenSeq[B])

/** Finds first index after or at a start index where this $coll contains a given sequence as a slice.
* $mayNotTerminateInf
* @param that the sequence to test
@@ -354,9 +344,6 @@ trait SeqLike[+A, +Repr] extends Any with IterableLike[A, Repr] with GenSeqLike[
-1
}

@bridge
def indexOfSlice[B >: A](that: Seq[B], from: Int): Int = indexOfSlice(that: GenSeq[B], from)

/** Finds last index where this $coll contains a given sequence as a slice.
* $willNotTerminateInf
* @param that the sequence to test
@@ -365,9 +352,6 @@ trait SeqLike[+A, +Repr] extends Any with IterableLike[A, Repr] with GenSeqLike[
*/
def lastIndexOfSlice[B >: A](that: GenSeq[B]): Int = lastIndexOfSlice(that, length)

@bridge
def lastIndexOfSlice[B >: A](that: Seq[B]): Int = lastIndexOfSlice(that: GenSeq[B])

/** Finds last index before or at a given end index where this $coll contains a given sequence as a slice.
* @param that the sequence to test
* @param end the end index
@@ -385,9 +369,6 @@ trait SeqLike[+A, +Repr] extends Any with IterableLike[A, Repr] with GenSeqLike[
else SeqLike.kmpSearch(thisCollection, 0, clippedL+tl, that.seq, 0, tl, false)
}

@bridge
def lastIndexOfSlice[B >: A](that: Seq[B], end: Int): Int = lastIndexOfSlice(that: GenSeq[B], end)

/** Tests whether this $coll contains a given sequence as a slice.
* $mayNotTerminateInf
* @param that the sequence to test
@@ -396,9 +377,6 @@ trait SeqLike[+A, +Repr] extends Any with IterableLike[A, Repr] with GenSeqLike[
*/
def containsSlice[B](that: GenSeq[B]): Boolean = indexOfSlice(that) != -1

@bridge
def containsSlice[B](that: Seq[B]): Boolean = containsSlice(that: GenSeq[B])

/** Tests whether this $coll contains a given value as an element.
* $mayNotTerminateInf
*
@@ -463,9 +441,6 @@ trait SeqLike[+A, +Repr] extends Any with IterableLike[A, Repr] with GenSeqLike[
b.result
}

@bridge
def diff[B >: A](that: Seq[B]): Repr = diff(that: GenSeq[B])

/** Computes the multiset intersection between this $coll and another sequence.
*
* @param that the sequence of elements to intersect with.
@@ -499,9 +474,6 @@ trait SeqLike[+A, +Repr] extends Any with IterableLike[A, Repr] with GenSeqLike[
b.result
}

@bridge
def intersect[B >: A](that: Seq[B]): Repr = intersect(that: GenSeq[B])

private def occCounts[B](sq: Seq[B]): mutable.Map[B, Int] = {
val occ = new mutable.HashMap[B, Int] { override def default(k: B) = 0 }
for (y <- sq.seq) occ(y) += 1
@@ -534,10 +506,6 @@ trait SeqLike[+A, +Repr] extends Any with IterableLike[A, Repr] with GenSeqLike[
b.result
}

@bridge
def patch[B >: A, That](from: Int, patch: Seq[B], replaced: Int)(implicit bf: CanBuildFrom[Repr, B, That]): That =
this.patch(from, patch: GenSeq[B], replaced)(bf)

def updated[B >: A, That](index: Int, elem: B)(implicit bf: CanBuildFrom[Repr, B, That]): That = {
val b = bf(repr)
val (prefix, rest) = this.splitAt(index)
@@ -583,10 +551,6 @@ trait SeqLike[+A, +Repr] extends Any with IterableLike[A, Repr] with GenSeqLike[
!i.hasNext && !j.hasNext
}

@bridge
def corresponds[B](that: Seq[B])(p: (A,B) => Boolean): Boolean =
corresponds(that: GenSeq[B])(p)

/** Sorts this $coll according to a comparison function.
* $willNotTerminateInf
*
@@ -132,13 +132,9 @@ trait SeqViewLike[+A,
override def diff[B >: A](that: GenSeq[B]): This =
newForced(thisSeq diff that).asInstanceOf[This]

@bridge def diff[B >: A](that: Seq[B]): This = diff(that: GenSeq[B])

override def intersect[B >: A](that: GenSeq[B]): This =
newForced(thisSeq intersect that).asInstanceOf[This]

@bridge def intersect[B >: A](that: Seq[B]): This = intersect(that: GenSeq[B])

override def sorted[B >: A](implicit ord: Ordering[B]): This =
newForced(thisSeq sorted ord).asInstanceOf[This]

@@ -127,9 +127,6 @@ self =>
*/
def ++ (elems: GenTraversableOnce[A]): This = (repr /: elems.seq)(_ + _)

@bridge
def ++ (elems: TraversableOnce[A]): This = ++ (elems: GenTraversableOnce[A])

/** Creates a new set with a given element removed from this set.
*
* @param elem the element to be removed
@@ -152,9 +149,6 @@ self =>
*/
def union(that: GenSet[A]): This = this ++ that

@bridge
def union(that: Set[A]): This = union(that: GenSet[A])

/** Computes the difference of this set and another set.
*
* @param that the set of elements to exclude.
@@ -163,9 +157,6 @@ self =>
*/
def diff(that: GenSet[A]): This = this -- that

@bridge
def diff(that: Set[A]): This = diff(that: GenSet[A])

/** An iterator over all subsets of this set of the given size.
* If the requested size is impossible, an empty iterator is returned.
*
@@ -28,12 +28,6 @@ trait Traversable[+A] extends TraversableLike[A, Traversable[A]]

override def seq: Traversable[A] = this

@bridge
def flatten[B](implicit asTraversable: A => /*<:<!!!*/ GenTraversableOnce[B]): Traversable[B] = super.flatten(asTraversable)

@bridge
def transpose[B](implicit asTraversable: A => /*<:<!!!*/ GenTraversableOnce[B]): Traversable[Traversable[B]] = super.transpose(asTraversable)

/* The following methods are inherited from TraversableLike
*
override def isEmpty: Boolean
@@ -155,10 +155,6 @@ trait TraversableLike[+A, +Repr] extends Any
b.result
}

@bridge
def ++[B >: A, That](that: TraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That =
++(that: GenTraversableOnce[B])(bf)

/** As with `++`, returns a new collection containing the elements from the left operand followed by the
* elements from the right operand.
*
@@ -19,9 +19,4 @@ import language.higherKinds
* @since 2.8
*/
abstract class GenSeqFactory[CC[X] <: GenSeq[X] with GenericTraversableTemplate[X, CC]]
extends GenTraversableFactory[CC] {

@bridge
def unapplySeq[A](x: GenSeq[A]): Some[GenSeq[A]] = Some(x)

}
extends GenTraversableFactory[CC]
@@ -14,12 +14,4 @@ import annotation.bridge
import language.higherKinds

trait GenericSeqCompanion[CC[X] <: Traversable[X]]
extends GenericCompanion[CC] {

@bridge
override def empty[A]: CC[A] = super.empty[A]

@bridge
override def apply[A](elems: A*): CC[A] = super.apply(elems: _*)

}
extends GenericCompanion[CC]
@@ -147,11 +147,6 @@ trait GenericTraversableTemplate[+A, +CC[X] <: GenTraversable[X]] extends HasNew
b.result
}

// cannot have a bridge, because it would have the same signature as the target method after erasure
// @bridge
// def flatten[B](implicit asTraversable: A => /*<:<!!!*/ TraversableOnce[B]): CC[B] =
// flatten[B](asTraversable: A => GenTraversableOnce[B])

/** Transposes this $coll of traversable collections into
* a $coll of ${coll}s.
*
@@ -36,6 +36,4 @@ abstract class MapFactory[CC[A, B] <: Map[A, B] with MapLike[A, B, CC[A, B]]] ex

def empty[A, B]: CC[A, B]

@bridge
override def apply[A, B](elems: (A, B)*): CC[A, B] = super.apply(elems: _*)
}
@@ -16,11 +16,4 @@ import annotation.bridge
import language.higherKinds

abstract class SetFactory[CC[X] <: Set[X] with SetLike[X, CC[X]]]
extends GenSetFactory[CC] with GenericSeqCompanion[CC] {

@bridge
override def empty[A]: CC[A] = super.empty[A]

@bridge
override def apply[A](elems: A*): CC[A] = super.apply(elems: _*)
}
extends GenSetFactory[CC] with GenericSeqCompanion[CC]
@@ -58,7 +58,4 @@ trait Subtractable[A, +Repr <: Subtractable[A, Repr]] { self =>
* except one less occurrence of each of the elements of `elems`.
*/
def --(xs: GenTraversableOnce[A]): Repr = (repr /: xs.seq) (_ - _)

@bridge
def --(xs: TraversableOnce[A]): Repr = --(xs: GenTraversableOnce[A])
}

0 comments on commit d1460af

Please sign in to comment.
You can’t perform that action at this time.