Skip to content

Commit

Permalink
Merge pull request #260 from scala/newCollectionsBootstrap
Browse files Browse the repository at this point in the history
Move to Scala 2.13.0-M5
  • Loading branch information
ashawley committed Nov 28, 2018
2 parents 246634d + 270e9cd commit 9df73b9
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 17 deletions.
10 changes: 5 additions & 5 deletions .travis.yml
Expand Up @@ -16,7 +16,7 @@ jdk:
scala:
- 2.11.12
- 2.12.6
- 2.13.0-M4
- 2.13.0-M5

env:
global:
Expand All @@ -30,23 +30,23 @@ env:
# The empty SCALAJS_VERSION will only compile for the JVM
- SCALAJS_VERSION=
- SCALAJS_VERSION=0.6.25
- SCALAJS_VERSION=1.0.0-M5
- SCALAJS_VERSION=1.0.0-M6

matrix:
exclude:
- jdk: openjdk11
env: SCALAJS_VERSION=0.6.25
- jdk: openjdk11
env: SCALAJS_VERSION=1.0.0-M5
env: SCALAJS_VERSION=1.0.0-M6
- scala: 2.11.12
env: SCALAJS_VERSION=1.0.0-M5
env: SCALAJS_VERSION=1.0.0-M6
- scala: 2.11.12
jdk: oraclejdk8
- scala: 2.11.12
jdk: openjdk11
- scala: 2.12.6
jdk: openjdk6
- scala: 2.13.0-M4
- scala: 2.13.0-M5
jdk: openjdk6

script:
Expand Down
4 changes: 2 additions & 2 deletions build.sbt
@@ -1,7 +1,7 @@
import sbtcrossproject.{crossProject, CrossType}
import ScalaModulePlugin._

crossScalaVersions in ThisBuild := List("2.12.6", "2.11.12", "2.13.0-M4")
crossScalaVersions in ThisBuild := List("2.12.6", "2.11.12", "2.13.0-M5")

lazy val xml = crossProject(JSPlatform, JVMPlatform)
.withoutSuffixFor(JVMPlatform)
Expand All @@ -19,7 +19,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform)
scalacOptions in Test += "-Xxml:coalescing",

mimaPreviousVersion := {
if (System.getenv("SCALAJS_VERSION") == "1.0.0-M5") None // No such release yet
if (System.getenv("SCALAJS_VERSION") == "1.0.0-M6") None // No such release yet
else Some("1.1.1")
},

Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Expand Up @@ -9,5 +9,5 @@ val scalaJSVersion =
Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.25")

addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion)
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.5.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0")
addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.14")
Expand Up @@ -20,3 +20,7 @@ private[xml] trait ScalaVersionSpecificNodeSeq extends SeqLike[Node, NodeSeq] {
private[xml] trait ScalaVersionSpecificNodeBuffer { self: NodeBuffer =>
override def stringPrefix: String = "NodeBuffer"
}

private[xml] trait ScalaVersionSpecificIterableSerializable[+A] { // extends Iterable[A] {
// protected[this] override def writeReplace(): AnyRef = this
}
10 changes: 7 additions & 3 deletions shared/src/main/scala-2.13/scala/xml/ScalaVersionSpecific.scala
@@ -1,7 +1,7 @@
package scala.xml

import scala.collection.immutable.StrictOptimizedSeqOps
import scala.collection.{SeqOps, immutable, mutable}
import scala.collection.{SeqOps, IterableOnce, immutable, mutable}
import scala.collection.BuildFrom
import scala.collection.mutable.Builder

Expand All @@ -10,17 +10,21 @@ private[xml] object ScalaVersionSpecific {
type CBF[-From, -A, +C] = BuildFrom[From, A, C]
object NodeSeqCBF extends BuildFrom[Coll, Node, NodeSeq] {
def newBuilder(from: Coll): Builder[Node, NodeSeq] = NodeSeq.newBuilder
def fromSpecificIterable(from: Coll)(it: Iterable[Node]): NodeSeq = (NodeSeq.newBuilder ++= from).result()
def fromSpecific(from: Coll)(it: IterableOnce[Node]): NodeSeq = (NodeSeq.newBuilder ++= from).result()
}
}

private[xml] trait ScalaVersionSpecificNodeSeq
extends SeqOps[Node, immutable.Seq, NodeSeq]
with StrictOptimizedSeqOps[Node, immutable.Seq, NodeSeq] { self: NodeSeq =>
override def fromSpecificIterable(coll: Iterable[Node]): NodeSeq = (NodeSeq.newBuilder ++= coll).result()
override def fromSpecific(coll: IterableOnce[Node]): NodeSeq = (NodeSeq.newBuilder ++= coll).result()
override def newSpecificBuilder: mutable.Builder[Node, NodeSeq] = NodeSeq.newBuilder
}

private[xml] trait ScalaVersionSpecificNodeBuffer { self: NodeBuffer =>
override def className: String = "NodeBuffer"
}

private[xml] trait ScalaVersionSpecificIterableSerializable[+A] extends Iterable[A] {
protected[this] override def writeReplace(): AnyRef = this
}
2 changes: 1 addition & 1 deletion shared/src/main/scala/scala/xml/Elem.scala
Expand Up @@ -36,7 +36,7 @@ object Elem {

def unapplySeq(n: Node) = n match {
case _: SpecialNode | _: Group => None
case _ => Some((n.prefix, n.label, n.attributes, n.scope, n.child))
case _ => Some((n.prefix, n.label, n.attributes, n.scope, n.child.toSeq))
}

import scala.sys.process._
Expand Down
1 change: 1 addition & 0 deletions shared/src/main/scala/scala/xml/MetaData.scala
Expand Up @@ -82,6 +82,7 @@ abstract class MetaData
extends AbstractIterable[MetaData]
with Iterable[MetaData]
with Equality
with ScalaVersionSpecificIterableSerializable[MetaData]
with Serializable {

/**
Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/scala/xml/Node.scala
Expand Up @@ -24,7 +24,7 @@ object Node {
/** the empty namespace */
val EmptyNamespace = ""

def unapplySeq(n: Node) = Some((n.label, n.attributes, n.child))
def unapplySeq(n: Node) = Some((n.label, n.attributes, n.child.toSeq))
}

/**
Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/scala/xml/NodeSeq.scala
Expand Up @@ -44,7 +44,7 @@ object NodeSeq {
*
* @author Burak Emir
*/
abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with ScalaVersionSpecificNodeSeq with Equality with Serializable {
abstract class NodeSeq extends AbstractSeq[Node] with immutable.Seq[Node] with ScalaVersionSpecificNodeSeq with Equality with ScalaVersionSpecificIterableSerializable[Node] with Serializable {
def theSeq: Seq[Node]
def length = theSeq.length
override def iterator = theSeq.iterator
Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/scala/xml/QNode.scala
Expand Up @@ -16,5 +16,5 @@ package xml
* @author Burak Emir
*/
object QNode {
def unapplySeq(n: Node) = Some((n.scope.getURI(n.prefix), n.label, n.attributes, n.child))
def unapplySeq(n: Node) = Some((n.scope.getURI(n.prefix), n.label, n.attributes, n.child.toSeq))
}
4 changes: 2 additions & 2 deletions shared/src/test/scala/scala/xml/PatternMatching.scala
Expand Up @@ -58,9 +58,9 @@ class PatternMatching extends {

object SafeNodeSeq {
def unapplySeq(any: Any): Option[Seq[Node]] = any match {
case s: Seq[_] => Some(s flatMap (_ match {
case s: Seq[_] => Some((s flatMap (_ match {
case n: Node => n case _ => NodeSeq.Empty
})) case _ => None
})).toSeq) case _ => None
}
}

Expand Down

0 comments on commit 9df73b9

Please sign in to comment.