Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library/src/scala/Array.scala
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ object Array {
def apply[T: ClassTag](xs: T*): Array[T] = {
val len = xs.length
xs match {
case wa: immutable.ArraySeq[_] if wa.unsafeArray.getClass.getComponentType == classTag[T].runtimeClass =>
case wa: immutable.ArraySeq[?] if wa.unsafeArray.getClass.getComponentType == classTag[T].runtimeClass =>
// We get here in test/files/run/sd760a.scala, `Array[T](t)` for
// a specialized type parameter `T`. While we still pay for two
// copies of the array it is better than before when we also boxed
Expand Down
4 changes: 2 additions & 2 deletions library/src/scala/NamedTuple.scala
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ object NamedTupleDecomposition:

/** The names of a named tuple, represented as a tuple of literal string values. */
type Names[X <: AnyNamedTuple] <: Tuple = X match
case NamedTuple[n, _] => n
case NamedTuple[n, ?] => n

/** The value types of a named tuple represented as a regular tuple. */
type DropNames[NT <: AnyNamedTuple] <: Tuple = NT match
case NamedTuple[_, x] => x
case NamedTuple[?, x] => x
4 changes: 2 additions & 2 deletions library/src/scala/collection/ArrayOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -994,10 +994,10 @@ final class ArrayOps[A](private val xs: Array[A]) extends AnyVal {
var i = 0
while(i < len) {
xs(i) match {
case it: IterableOnce[_] =>
case it: IterableOnce[?] =>
val k = it.knownSize
if(k > 0) size += k
case a: Array[_] => size += a.length
case a: Array[?] => size += a.length
case _ =>
}
i += 1
Expand Down
4 changes: 2 additions & 2 deletions library/src/scala/collection/IndexedSeq.scala
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ transparent trait IndexedSeqOps[+A, +CC[_], +C] extends Any with SeqOps[A, CC, C
if (!isEmpty) apply(0)
else throw new NoSuchElementException(s"head of empty ${
self match {
case self: IndexedSeq[_] => self.collectionClassName
case self: IndexedSeq[?] => self.collectionClassName
case _ => toString
}
}")
Expand All @@ -115,7 +115,7 @@ transparent trait IndexedSeqOps[+A, +CC[_], +C] extends Any with SeqOps[A, CC, C
if (!isEmpty) apply(length - 1)
else throw new NoSuchElementException(s"last of empty ${
self match {
case self: IndexedSeq[_] => self.collectionClassName
case self: IndexedSeq[?] => self.collectionClassName
case _ => toString
}
}")
Expand Down
2 changes: 1 addition & 1 deletion library/src/scala/collection/Iterable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ trait MapFactoryDefaults[K, +V,
override protected def newSpecificBuilder: mutable.Builder[(K, V @uncheckedVariance), CC[K, V @uncheckedVariance]] = mapFactory.newBuilder[K, V]
override def empty: CC[K, V @uncheckedVariance] = (this: AnyRef) match {
// Implemented here instead of in TreeSeqMap since overriding empty in TreeSeqMap is not forwards compatible (should be moved)
case self: immutable.TreeSeqMap[_, _] => immutable.TreeSeqMap.empty(self.orderedBy).asInstanceOf[CC[K, V]]
case self: immutable.TreeSeqMap[?, ?] => immutable.TreeSeqMap.empty(self.orderedBy).asInstanceOf[CC[K, V]]
case _ => mapFactory.empty
}

Expand Down
2 changes: 1 addition & 1 deletion library/src/scala/collection/LinearSeq.scala
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ transparent trait LinearSeqOps[+A, +CC[X] <: LinearSeq[X], +C <: LinearSeq[A] &

if (thatKnownSize >= 0) this lengthCompare thatKnownSize
else that match {
case that: LinearSeq[_] =>
case that: LinearSeq[?] =>
var thisSeq = this
var thatSeq = that
while (thisSeq.nonEmpty && thatSeq.nonEmpty) {
Expand Down
2 changes: 1 addition & 1 deletion library/src/scala/collection/Map.scala
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ trait Map[K, +V]
*/
override def equals(o: Any): Boolean =
(this eq o.asInstanceOf[AnyRef]) || (o match {
case map: Map[K @unchecked, _] if map.canEqual(this) =>
case map: Map[K @unchecked, ?] if map.canEqual(this) =>
(this.size == map.size) && {
try this.forall(kv => map.getOrElse(kv._1, Map.DefaultSentinelFn()) == kv._2)
catch { case _: ClassCastException => false } // PR #9565 / scala/bug#12228
Expand Down
2 changes: 1 addition & 1 deletion library/src/scala/collection/Seq.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ object SeqOps {
}
// Now we know we actually need KMP search, so do it
else S match {
case xs: scala.collection.IndexedSeq[_] =>
case xs: scala.collection.IndexedSeq[?] =>
// We can index into S directly; it should be adequately fast
val Wopt = kmpOptimizeWord(W, n0, n1, forward)
val T = kmpJumpTable(Wopt, n1-n0)
Expand Down
2 changes: 1 addition & 1 deletion library/src/scala/collection/SortedMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ trait SortedMap[K, +V]

override def equals(that: Any): Boolean = that match {
case _ if this eq that.asInstanceOf[AnyRef] => true
case sm: SortedMap[K @unchecked, _] if sm.ordering == this.ordering =>
case sm: SortedMap[K @unchecked, ?] if sm.ordering == this.ordering =>
(sm canEqual this) &&
(this.size == sm.size) && {
val i1 = this.iterator
Expand Down
16 changes: 8 additions & 8 deletions library/src/scala/collection/concurrent/TrieMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ private[collection] final class INode[K, V](bn: MainNode[K, V] | Null, g: Gen, e
prev match {
case null =>
m
case fn: FailedNode[_, _] => // try to commit to previous value
case fn: FailedNode[?, ?] => // try to commit to previous value
if (CAS(m, fn.prev)) fn.prev
else GCAS_Complete(/*READ*/mainnode, ct)
case vn: MainNode[_, _] =>
case vn: MainNode[?, ?] =>
// Assume that you've read the root from the generation G.
// Assume that the snapshot algorithm is correct.
// ==> you can only reach nodes in generations <= G.
Expand Down Expand Up @@ -284,7 +284,7 @@ private[collection] final class INode[K, V](bn: MainNode[K, V] | Null, g: Gen, e
case basicNode => throw new MatchError(basicNode)
}
}
case tn: TNode[_, _] => // 3) non-live node
case tn: TNode[?, ?] => // 3) non-live node
def cleanReadOnly(tn: TNode[K, V]) = if (ct.nonReadOnly) {
clean(parent.nn, ct, lev - 5)
RESTART
Expand Down Expand Up @@ -412,9 +412,9 @@ private[collection] final class INode[K, V](bn: MainNode[K, V] | Null, g: Gen, e
/* this is a quiescent method! */
def string(lev: Int): String = "%sINode -> %s".format(" " * lev, mainnode match {
case null => "<null>"
case tn: TNode[_, _] => "TNode(%s, %s, %d, !)".format(tn.k, tn.v, tn.hc)
case cn: CNode[_, _] => cn.string(lev)
case ln: LNode[_, _] => ln.string(lev)
case tn: TNode[?, ?] => "TNode(%s, %s, %d, !)".format(tn.k, tn.v, tn.hc)
case cn: CNode[?, ?] => cn.string(lev)
case ln: LNode[?, ?] => ln.string(lev)
case x => "<elem: %s>".format(x)
})

Expand Down Expand Up @@ -549,7 +549,7 @@ private[collection] final class CNode[K, V](val bitmap: Int, val array: Array[Ba
while (i < array.length) {
val pos = (i + offset) % array.length
array(pos) match {
case sn: SNode[_, _] => sz += 1
case sn: SNode[?, ?] => sz += 1
case in: INode[K, V] @uc => sz += in.cachedSize(ct)
case basicNode => throw new MatchError(basicNode)
}
Expand Down Expand Up @@ -604,7 +604,7 @@ private[collection] final class CNode[K, V](val bitmap: Int, val array: Array[Ba
}

private def resurrect(inode: INode[K, V], inodemain: AnyRef): BasicNode = inodemain match {
case tn: TNode[_, _] => tn.copyUntombed
case tn: TNode[?, ?] => tn.copyUntombed
case _ => inode
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private[collection] object JavaCollectionWrappers extends Serializable {
def nextElement(): A = underlying.next()
override def remove(): Nothing = throw new UnsupportedOperationException
override def equals(other: Any): Boolean = other match {
case that: IteratorWrapper[_] => this.underlying == that.underlying
case that: IteratorWrapper[?] => this.underlying == that.underlying
case _ => false
}
override def hashCode(): Int = underlying.hashCode()
Expand All @@ -49,7 +49,7 @@ private[collection] object JavaCollectionWrappers extends Serializable {
def hasNext = underlying.hasNext
def next(): A = underlying.next
override def equals(other: Any): Boolean = other match {
case that: JIteratorWrapper[_] => this.underlying == that.underlying
case that: JIteratorWrapper[?] => this.underlying == that.underlying
case _ => false
}
override def hashCode(): Int = underlying.hashCode()
Expand All @@ -60,7 +60,7 @@ private[collection] object JavaCollectionWrappers extends Serializable {
def hasNext = underlying.hasMoreElements
def next(): A = underlying.nextElement
override def equals(other: Any): Boolean = other match {
case that: JEnumerationWrapper[_] => this.underlying == that.underlying
case that: JEnumerationWrapper[?] => this.underlying == that.underlying
case _ => false
}
override def hashCode(): Int = underlying.hashCode()
Expand All @@ -76,7 +76,7 @@ private[collection] object JavaCollectionWrappers extends Serializable {
@SerialVersionUID(3L)
class IterableWrapper[A](val underlying: Iterable[A]^) extends ju.AbstractCollection[A] with IterableWrapperTrait[A] with Serializable {
override def equals(other: Any): Boolean = other match {
case that: IterableWrapper[_] => this.underlying == that.underlying
case that: IterableWrapper[?] => this.underlying == that.underlying
case _ => false
}
override def hashCode(): Int = underlying.hashCode()
Expand All @@ -91,7 +91,7 @@ private[collection] object JavaCollectionWrappers extends Serializable {
override def iterableFactory: mutable.ArrayBuffer.type = mutable.ArrayBuffer
override def isEmpty: Boolean = !underlying.iterator().hasNext
override def equals(other: Any): Boolean = other match {
case that: JIterableWrapper[_] => this.underlying == that.underlying
case that: JIterableWrapper[?] => this.underlying == that.underlying
case _ => false
}
override def hashCode(): Int = underlying.hashCode()
Expand All @@ -108,7 +108,7 @@ private[collection] object JavaCollectionWrappers extends Serializable {
override def isEmpty = underlying.isEmpty
override def iterableFactory: mutable.ArrayBuffer.type = mutable.ArrayBuffer
override def equals(other: Any): Boolean = other match {
case that: JCollectionWrapper[_] => this.underlying == that.underlying
case that: JCollectionWrapper[?] => this.underlying == that.underlying
case _ => false
}
override def hashCode(): Int = underlying.hashCode()
Expand Down Expand Up @@ -291,7 +291,7 @@ private[collection] object JavaCollectionWrappers extends Serializable {
}

override def equals(other: Any) = other match {
case e: ju.Map.Entry[_, _] => k == e.getKey && v == e.getValue
case e: ju.Map.Entry[?, ?] => k == e.getKey && v == e.getValue
case _ => false
}
}
Expand All @@ -301,7 +301,7 @@ private[collection] object JavaCollectionWrappers extends Serializable {
prev match {
case Some(k) =>
underlying match {
case mm: mutable.Map[a, _] =>
case mm: mutable.Map[a, ?] =>
mm -= k
prev = None
case _ =>
Expand Down Expand Up @@ -548,7 +548,7 @@ private[collection] object JavaCollectionWrappers extends Serializable {
}

override def equals(other: Any): Boolean = other match {
case that: DictionaryWrapper[_, _] => this.underlying == that.underlying
case that: DictionaryWrapper[?, ?] => this.underlying == that.underlying
case _ => false
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ private[collection] case object SerializeEnd
transparent trait DefaultSerializable extends Serializable { this: scala.collection.Iterable[?]^ =>
protected def writeReplace(): AnyRef^{this} = {
val f: Factory[Any, Any] = this match {
case it: scala.collection.SortedMap[_, _] => it.sortedMapFactory.sortedMapFactory[Any, Any](using it.ordering.asInstanceOf[Ordering[Any]]).asInstanceOf[Factory[Any, Any]]
case it: scala.collection.Map[_, _] => it.mapFactory.mapFactory[Any, Any].asInstanceOf[Factory[Any, Any]]
case it: scala.collection.SortedSet[_] => it.sortedIterableFactory.evidenceIterableFactory[Any](using it.ordering.asInstanceOf[Ordering[Any]])
case it: scala.collection.SortedMap[?, ?] => it.sortedMapFactory.sortedMapFactory[Any, Any](using it.ordering.asInstanceOf[Ordering[Any]]).asInstanceOf[Factory[Any, Any]]
case it: scala.collection.Map[?, ?] => it.mapFactory.mapFactory[Any, Any].asInstanceOf[Factory[Any, Any]]
case it: scala.collection.SortedSet[?] => it.sortedIterableFactory.evidenceIterableFactory[Any](using it.ordering.asInstanceOf[Ordering[Any]])
case it => it.iterableFactory.iterableFactory
}
new DefaultSerializationProxy(f, this)
Expand Down
6 changes: 3 additions & 3 deletions library/src/scala/collection/immutable/ArraySeq.scala
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ sealed abstract class ArraySeq[+A]
}

suffix match {
case that: ArraySeq[_] =>
case that: ArraySeq[?] =>
val result = appendedAllArraySeq(that.asInstanceOf[ArraySeq[B]])
if (result == null) genericResult
else result
Expand All @@ -165,7 +165,7 @@ sealed abstract class ArraySeq[+A]
}

prefix match {
case that: ArraySeq[_] =>
case that: ArraySeq[?] =>
val result = that.asInstanceOf[ArraySeq[B]].appendedAllArraySeq(this)
if (result == null) genericResult
else result
Expand Down Expand Up @@ -334,7 +334,7 @@ object ArraySeq extends StrictOptimizedClassTagSeqFactory[ArraySeq] { self =>
def apply(i: Int): T = unsafeArray(i)
override def hashCode() = MurmurHash3.arraySeqHash(unsafeArray)
override def equals(that: Any): Boolean = that match {
case that: ofRef[_] =>
case that: ofRef[?] =>
Array.equals(
this.unsafeArray.asInstanceOf[Array[AnyRef]],
that.unsafeArray.asInstanceOf[Array[AnyRef]])
Expand Down
8 changes: 4 additions & 4 deletions library/src/scala/collection/immutable/HashMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ final class HashMap[K, +V] private[immutable] (private[immutable] val rootNode:

override def equals(that: Any): Boolean =
that match {
case map: HashMap[_, _] => (this eq map) || (this.rootNode == map.rootNode)
case map: HashMap[?, ?] => (this eq map) || (this.rootNode == map.rootNode)
case _ => super.equals(that)
}

Expand Down Expand Up @@ -1313,13 +1313,13 @@ private final class BitmapIndexedMapNode[K, +V](
index += 1
}
}
case _: HashCollisionMapNode[_, _] =>
case _: HashCollisionMapNode[?, ?] =>
throw new RuntimeException("Cannot merge BitmapIndexedMapNode with HashCollisionMapNode")
}

override def equals(that: Any): Boolean =
that match {
case node: BitmapIndexedMapNode[_, _] =>
case node: BitmapIndexedMapNode[?, ?] =>
(this eq node) ||
(this.cachedJavaKeySetHashCode == node.cachedJavaKeySetHashCode) &&
(this.nodeMap == node.nodeMap) &&
Expand Down Expand Up @@ -1989,7 +1989,7 @@ private final class HashCollisionMapNode[K, +V ](

override def equals(that: Any): Boolean =
that match {
case node: HashCollisionMapNode[_, _] =>
case node: HashCollisionMapNode[?, ?] =>
(this eq node) ||
(this.hash == node.hash) &&
(this.content.length == node.content.length) && {
Expand Down
6 changes: 3 additions & 3 deletions library/src/scala/collection/immutable/HashSet.scala
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ final class HashSet[A] private[immutable](private[immutable] val rootNode: Bitma

override def equals(that: Any): Boolean =
that match {
case set: HashSet[_] => (this eq set) || (this.rootNode == set.rootNode)
case set: HashSet[?] => (this eq set) || (this.rootNode == set.rootNode)
case _ => super.equals(that)
}

Expand Down Expand Up @@ -1394,7 +1394,7 @@ private final class BitmapIndexedSetNode[A](

override def equals(that: Any): Boolean =
that match {
case node: BitmapIndexedSetNode[_] =>
case node: BitmapIndexedSetNode[?] =>
(this eq node) ||
(this.cachedJavaKeySetHashCode == node.cachedJavaKeySetHashCode) &&
(this.nodeMap == node.nodeMap) &&
Expand Down Expand Up @@ -1824,7 +1824,7 @@ private final class HashCollisionSetNode[A](val originalHash: Int, val hash: Int

override def equals(that: Any): Boolean =
that match {
case node: HashCollisionSetNode[_] =>
case node: HashCollisionSetNode[?] =>
(this eq node) ||
(this.hash == node.hash) &&
(this.content.size == node.content.size) &&
Expand Down
2 changes: 1 addition & 1 deletion library/src/scala/collection/immutable/IntMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ object IntMap {
// careful handling.
override def equals(that : Any) = that match {
case _: this.type => true
case _: IntMap[_] => false // The only empty IntMaps are eq Nil
case _: IntMap[?] => false // The only empty IntMaps are eq Nil
case _ => super.equals(that)
}
}
Expand Down
2 changes: 1 addition & 1 deletion library/src/scala/collection/immutable/List.scala
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ sealed abstract class List[+A]
}

o match {
case that: List[_] => listEq(this, that)
case that: List[?] => listEq(this, that)
case _ => super.equals(o)
}
}
Expand Down
2 changes: 1 addition & 1 deletion library/src/scala/collection/immutable/LongMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ object LongMap {
// Important, don't remove this! See IntMap for explanation.
override def equals(that : Any) = that match {
case _: this.type => true
case _: LongMap[_] => false // The only empty LongMaps are eq Nil
case _: LongMap[?] => false // The only empty LongMaps are eq Nil
case _ => super.equals(that)
}
}
Expand Down
2 changes: 1 addition & 1 deletion library/src/scala/collection/immutable/Map.scala
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ object Map extends MapFactory[Map] {

def from[K, V](it: IterableOnce[(K, V)]^): Map[K, V] =
(it: @unchecked) match {
case it: Iterable[_] if it.isEmpty => empty[K, V]
case it: Iterable[?] if it.isEmpty => empty[K, V]
// Since IterableOnce[(K, V)] launders the variance of K,
// identify only our implementations which can be soundly substituted.
// For example, the ordering used by sorted maps would fail on widened key type. (scala/bug#12745)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ sealed class NumericRange[T](
override protected final def applyPreferredMaxLength: Int = Int.MaxValue

override def equals(other: Any): Boolean = other match {
case x: NumericRange[_] =>
case x: NumericRange[?] =>
(x canEqual this) && (length == x.length) && (
(isEmpty) || // all empty sequences are equal
(start == x.start && last == x.last) // same length and same endpoints implies equality
Expand Down
4 changes: 2 additions & 2 deletions library/src/scala/collection/immutable/Seq.scala
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ trait IndexedSeq[+A] extends Seq[A]
final override def toIndexedSeq: IndexedSeq[A] = this

override def canEqual(that: Any): Boolean = that match {
case otherIndexedSeq: IndexedSeq[_] => length == otherIndexedSeq.length && super.canEqual(that)
case otherIndexedSeq: IndexedSeq[?] => length == otherIndexedSeq.length && super.canEqual(that)
case _ => super.canEqual(that)
}


override def sameElements[B >: A](o: IterableOnce[B]^): Boolean = o match {
case that: IndexedSeq[_] =>
case that: IndexedSeq[?] =>
(this eq that) || {
val length = this.length
var equal = length == that.length
Expand Down
Loading
Loading