Skip to content

Commit 898b5c7

Browse files
committed
Change theSeq to immtuable.Seq
1 parent 90fca3f commit 898b5c7

File tree

6 files changed

+11
-5
lines changed

6 files changed

+11
-5
lines changed

build.sbt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform)
8282
ProblemFilters.exclude[ReversedMissingMethodProblem]("scala.xml.Attribute.value"),
8383
ProblemFilters.exclude[ReversedMissingMethodProblem]("scala.xml.MetaData.apply"),
8484
ProblemFilters.exclude[ReversedMissingMethodProblem]("scala.xml.MetaData.value"),
85+
ProblemFilters.exclude[ReversedMissingMethodProblem]("scala.xml.NodeSeq.theSeq"),
8586

8687
// Synthetic static accessors (for Java interop) have a changed return type
8788
ProblemFilters.exclude[IncompatibleResultTypeProblem]("scala.xml.Null.apply"),
@@ -95,6 +96,9 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform)
9596
ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.PrefixedAttribute.value"),
9697
ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.UnprefixedAttribute.apply"),
9798
ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.UnprefixedAttribute.value"),
99+
ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.Document.theSeq"),
100+
ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.Group.theSeq"),
101+
ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.Node.theSeq"),
98102

99103
// Option[c.Seq] => Option[i.Seq] results in a changed generic signature
100104
ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.xml.MetaData.get"),

shared/src/main/scala-2.13+/scala/xml/ScalaVersionSpecific.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ private[xml] trait ScalaVersionSpecificNodeSeq
4848
fromSpecific(new View.Map(this, f))
4949
def flatMap(f: Node => IterableOnce[Node]): NodeSeq =
5050
fromSpecific(new View.FlatMap(this, f))
51+
52+
def theSeq: scala.collection.Seq[Node]
5153
}
5254

5355
private[xml] trait ScalaVersionSpecificNodeBuffer { self: NodeBuffer =>

shared/src/main/scala/scala/xml/Document.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class Document extends NodeSeq with Serializable {
9696

9797
// methods for NodeSeq
9898

99-
override def theSeq: Seq[Node] = this.docElem
99+
override def theSeq: ScalaVersionSpecific.SeqOfNode = this.docElem
100100

101101
override def canEqual(other: Any): Boolean = other match {
102102
case _: Document => true

shared/src/main/scala/scala/xml/Group.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import scala.collection.Seq
2222
*/
2323
// Note: used by the Scala compiler.
2424
final case class Group(nodes: Seq[Node]) extends Node {
25-
override def theSeq: Seq[Node] = nodes
25+
override def theSeq: ScalaVersionSpecific.SeqOfNode = nodes.toSeq
2626

2727
override def canEqual(other: Any): Boolean = other match {
2828
case _: Group => true

shared/src/main/scala/scala/xml/Node.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ abstract class Node extends NodeSeq with ScalaVersionSpecificNode {
166166
/**
167167
* returns a sequence consisting of only this node
168168
*/
169-
override def theSeq: Seq[Node] = this :: Nil
169+
override def theSeq: ScalaVersionSpecific.SeqOfNode = this :: Nil
170170

171171
/**
172172
* String representation of this node

shared/src/main/scala/scala/xml/NodeSeq.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import scala.collection.Seq
2626
object NodeSeq {
2727
final val Empty: NodeSeq = fromSeq(Nil)
2828
def fromSeq(s: Seq[Node]): NodeSeq = new NodeSeq {
29-
override def theSeq: Seq[Node] = s
29+
override def theSeq: ScalaVersionSpecific.SeqOfNode = s.toSeq
3030
}
3131

3232
// ---
@@ -48,7 +48,7 @@ object NodeSeq {
4848
* @author Burak Emir
4949
*/
5050
abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with ScalaVersionSpecificNodeSeq with Equality with Serializable {
51-
def theSeq: Seq[Node]
51+
def theSeq: ScalaVersionSpecific.SeqOfNode
5252
override def length: Int = theSeq.length
5353
override def iterator: Iterator[Node] = theSeq.iterator
5454

0 commit comments

Comments
 (0)