Skip to content
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

use new wildcard syntax #704

Merged
merged 1 commit into from
Jan 3, 2024
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 jvm/src/test/scala/scala/xml/XMLTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ class XMLTestJVM {

@UnitTest
def t5115(): Unit = {
def assertHonorsIterableContract(i: Iterable[_]): Unit = assertEquals(i.size.toLong, i.iterator.size.toLong)
def assertHonorsIterableContract(i: Iterable[?]): Unit = assertEquals(i.size.toLong, i.iterator.size.toLong)

assertHonorsIterableContract(<a/>.attributes)
assertHonorsIterableContract(<a x=""/>.attributes)
Expand Down
4 changes: 2 additions & 2 deletions shared/src/main/scala/scala/xml/Atom.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ class Atom[+A](val data: A) extends SpecialNode with Serializable {
override protected def basisForHashCode: Seq[Any] = Seq(data)

override def strict_==(other: Equality): Boolean = other match {
case x: Atom[_] => data == x.data
case x: Atom[?] => data == x.data
case _ => false
}

override def canEqual(other: Any): Boolean = other match {
case _: Atom[_] => true
case _: Atom[?] => true
case _ => false
}

Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/scala/xml/Equality.scala
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ object Equality {
* Note - these functions assume strict equality has already failed.
*/
def compareBlithely(x1: AnyRef, x2: String): Boolean = x1 match {
case x: Atom[_] => x.data == x2
case x: Atom[?] => x.data == x2
case x: NodeSeq => x.text == x2
case _ => false
}
Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/scala/xml/Node.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ abstract class Node extends NodeSeq {
/**
* used internally. Atom/Molecule = -1 PI = -2 Comment = -3 EntityRef = -5
*/
def isAtom: Boolean = this.isInstanceOf[Atom[_]]
def isAtom: Boolean = this.isInstanceOf[Atom[?]]

/** The logic formerly found in typeTag$, as best I could infer it. */
def doCollectNamespaces: Boolean = true // if (tag >= 0) DO collect namespaces
Expand Down
6 changes: 3 additions & 3 deletions shared/src/main/scala/scala/xml/NodeBuffer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ class NodeBuffer extends scala.collection.mutable.ArrayBuffer[Node] with ScalaVe
def &+(o: Any): NodeBuffer = {
o match {
case null | _: Unit | Text("") => // ignore
case it: Iterator[_] => it.foreach(&+)
case it: Iterator[?] => it.foreach(&+)
case n: Node => super.+=(n)
case ns: Iterable[_] => this &+ ns.iterator
case ns: Array[_] => this &+ ns.iterator
case ns: Iterable[?] => this &+ ns.iterator
case ns: Array[?] => this &+ ns.iterator
case d => super.+=(new Atom(d))
}
this
Expand Down
4 changes: 2 additions & 2 deletions shared/src/main/scala/scala/xml/PrettyPrinter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) {

protected def childrenAreLeaves(n: Node): Boolean = {
def isLeaf(l: Node): Boolean = l match {
case _: Atom[_] | _: Comment | _: EntityRef | _: ProcInstr => true
case _: Atom[?] | _: Comment | _: EntityRef | _: ProcInstr => true
case _ => false
}
n.child.forall(isLeaf)
Expand All @@ -152,7 +152,7 @@ class PrettyPrinter(width: Int, step: Int, minimizeEmpty: Boolean) {

case Text(s) if s.trim.isEmpty =>

case _: Atom[_] | _: Comment | _: EntityRef | _: ProcInstr =>
case _: Atom[?] | _: Comment | _: EntityRef | _: ProcInstr =>
makeBox(ind, node.toString.trim)
case Group(xs) =>
traverse(xs.iterator, pscope, ind)
Expand Down
2 changes: 1 addition & 1 deletion shared/src/test/scala/scala/xml/PatternMatchingTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class PatternMatchingTest {

object SafeNodeSeq {
def unapplySeq(any: Any): Option[Seq[Node]] = any match {
case s: Seq[_] => Some(s.flatMap {
case s: Seq[?] => Some(s.flatMap {
case n: Node => n
case _ => NodeSeq.Empty
})
Expand Down
2 changes: 1 addition & 1 deletion shared/src/test/scala/scala/xml/XMLTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ Ours is the portal of hope, come as you are."

@UnitTest
def t5115(): Unit = {
def assertHonorsIterableContract(i: Iterable[_]): Unit = assertEquals(i.size.toLong, i.iterator.size.toLong)
def assertHonorsIterableContract(i: Iterable[?]): Unit = assertEquals(i.size.toLong, i.iterator.size.toLong)

assertHonorsIterableContract(<a/>.attributes)
assertHonorsIterableContract(<a x=""/>.attributes)
Expand Down