Skip to content

Commit e32f248

Browse files
SethTisueashawley
authored andcommitted
Name-based pattern matching dropped for unapplySeq in 2.13
1 parent 8ffdb97 commit e32f248

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

Diff for: shared/src/main/scala/scala/xml/Elem.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ object Elem {
3636

3737
def unapplySeq(n: Node) = n match {
3838
case _: SpecialNode | _: Group => None
39-
case _ => Some((n.prefix, n.label, n.attributes, n.scope, n.child))
39+
case _ => Some((n.prefix, n.label, n.attributes, n.scope, n.child.toSeq))
4040
}
4141

4242
import scala.sys.process._

Diff for: shared/src/main/scala/scala/xml/Node.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ object Node {
2424
/** the empty namespace */
2525
val EmptyNamespace = ""
2626

27-
def unapplySeq(n: Node) = Some((n.label, n.attributes, n.child))
27+
def unapplySeq(n: Node) = Some((n.label, n.attributes, n.child.toSeq))
2828
}
2929

3030
/**

Diff for: shared/src/main/scala/scala/xml/QNode.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ package xml
1616
* @author Burak Emir
1717
*/
1818
object QNode {
19-
def unapplySeq(n: Node) = Some((n.scope.getURI(n.prefix), n.label, n.attributes, n.child))
19+
def unapplySeq(n: Node) = Some((n.scope.getURI(n.prefix), n.label, n.attributes, n.child.toSeq))
2020
}

Diff for: shared/src/test/scala/scala/xml/PatternMatching.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ class PatternMatching extends {
5757
}
5858

5959
object SafeNodeSeq {
60-
def unapplySeq(any: Any): Option[Seq[Node]] = any match {
61-
case s: Seq[_] => Some(s flatMap (_ match {
60+
def unapplySeq(any: Any): Option[collection.immutable.Seq[Node]] = any match {
61+
case s: Seq[_] => Some((s flatMap (_ match {
6262
case n: Node => n case _ => NodeSeq.Empty
63-
})) case _ => None
63+
})).toSeq) case _ => None
6464
}
6565
}
6666

0 commit comments

Comments
 (0)