Skip to content

Move to Scala 2.13.0-M5 #260

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

Merged
merged 6 commits into from
Nov 28, 2018
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
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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")
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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