Skip to content

update to Dotty 0.18.1 Nightly #344

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

Closed
wants to merge 2 commits into from
Closed
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
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ workflows:
- scala_job:
name: dotty
java_version: jdk8
scala_version: 0.17.0-RC1
scala_version: 0.18.1-bin-20190826-26217ce-NIGHTLY
- scala_job:
name: jdk11_2.12.8
java_version: jdk11
Expand All @@ -96,7 +96,7 @@ workflows:
- scala_job:
name: jdk11_dotty
java_version: jdk11
scala_version: 0.17.0-RC1
scala_version: 0.18.1-bin-20190826-26217ce-NIGHTLY
- scalajs_job:
name: sjs0.6_2.12
scala_version: 2.12.8
Expand Down
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ language: scala
scala:
- 2.12.8
- 2.13.0
- 0.17.0-RC1
- 0.18.1-bin-20190826-26217ce-NIGHTLY

env:
global:
Expand All @@ -22,9 +22,9 @@ env:

matrix:
exclude:
- scala: 0.17.0-RC1
- scala: 0.18.1-bin-20190826-26217ce-NIGHTLY
env: SCALAJS_VERSION=0.6.28 ADOPTOPENJDK=8
- scala: 0.17.0-RC1
- scala: 0.18.1-bin-20190826-26217ce-NIGHTLY
env: SCALAJS_VERSION=1.0.0-M8 ADOPTOPENJDK=8

before_install:
Expand Down
3 changes: 2 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ lazy val configSettings: Seq[Setting[_]] = Seq(
Seq(
CrossVersion.partialVersion(sv) match {
case Some((2, 13)) => file(dir.getPath ++ "-2.13+")
case Some((0, _)) => file(dir.getPath ++ "-2.13+")
case _ => file(dir.getPath ++ "-2.13-")
},
CrossVersion.partialVersion(sv) match {
Expand All @@ -30,7 +31,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform)
.settings(scalaModuleSettings)
.jvmSettings(scalaModuleSettingsJVM)
.jvmSettings(
crossScalaVersions += "0.17.0-RC1"
crossScalaVersions += "0.18.1-bin-20190826-26217ce-NIGHTLY"
)
.settings(
name := "scala-xml",
Expand Down
42 changes: 22 additions & 20 deletions jvm/src/test/scala/scala/xml/ReuseNodesTest.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package scala.xml

import language.implicitConversions

import scala.xml.transform._
import scala.collection.Seq
import org.junit.Assert.assertSame
Expand All @@ -9,19 +11,19 @@ import org.junit.experimental.theories.DataPoints
import org.junit.runner.RunWith
/**
* This test verifies that after the transform, the resultant xml node
* uses as many old nodes as possible.
*
* Three transformers class for case -
* One for original, one for modified, and one proposed which shows
* uses as many old nodes as possible.
*
* Three transformers class for case -
* One for original, one for modified, and one proposed which shows
* all are equivalent when it comes to reusing as many nodes as possible
*/
object ReuseNodesTest {

class OriginalTranformr(rules: RewriteRule*) extends RuleTransformer(rules:_*) {
override def transform(ns: Seq[Node]): Seq[Node] = {
val xs = ns.toStream map transform
val (xs1, xs2) = xs zip ns span { case (x, n) => unchanged(n, x) }

if (xs2.isEmpty) ns
else (xs1 map (_._2)) ++ xs2.head._1 ++ transform(ns drop (xs1.length + 1))
}
Expand All @@ -31,7 +33,7 @@ object ReuseNodesTest {
class ModifiedTranformr(rules: RewriteRule*) extends RuleTransformer(rules:_*) {
override def transform(ns: Seq[Node]): Seq[Node] = {
val changed = ns flatMap transform

if (changed.length != ns.length || changed.zip(ns).exists(p => p._1 != p._2)) changed
else ns
}
Expand All @@ -42,13 +44,13 @@ object ReuseNodesTest {
override def transform(ns: Seq[Node]): Seq[Node] = {
val xs = ns.toStream map transform
val (xs1, xs2) = xs zip ns span { case (x, n) => unchanged(n, x) }

if (xs2.isEmpty) ns
else (xs1 map (_._2)) ++ xs2.head._1 ++ transform(ns drop (xs1.length + 1))
}
override def transform(n:Node): Seq[Node] = super.transform(n)
}

def rewriteRule = new RewriteRule {
override def transform(n: Node): NodeSeq = n match {
case n if n.label == "change" => Elem(
Expand All @@ -57,7 +59,7 @@ object ReuseNodesTest {
}
}

@DataPoints
@DataPoints
def tranformers() = Array(
new OriginalTranformr(rewriteRule),
new ModifiedTranformr(rewriteRule),
Expand All @@ -66,34 +68,34 @@ object ReuseNodesTest {

@RunWith(classOf[Theories])
class ReuseNodesTest {

@Theory
def transformReferentialEquality(rt:RuleTransformer) = {
def transformReferentialEquality(rt:RuleTransformer) = {
val original = <p><lost/></p>
val tranformed = rt.transform(original)
assertSame(original, tranformed)
}

@Theory
def transformReferentialEqualityOnly(rt:RuleTransformer) = {
def transformReferentialEqualityOnly(rt:RuleTransformer) = {
val original = <changed><change><lost/><a><b><c/></b></a></change><a><b><c/></b></a></changed>
val transformed = rt.transform(original)
recursiveAssert(original,transformed)
}

def recursiveAssert(original:Seq[Node], transformed:Seq[Node]):Unit = {
original zip transformed foreach {
case (x, y) => recursiveAssert(x, y)
original zip transformed foreach {
case (x, y) => recursiveAssert(x, y)
}
}

def recursiveAssert(original:Node, transformed:Node):Unit = {
transformed.label match {
transformed.label match {
case "changed" => // do nothing expect this node to be changed
recursiveAssert(original.child,transformed.child)
case _ => {
assertSame(original, transformed)
// No need to check for children, node being immuatable
// No need to check for children, node being immuatable
// children can't be different if parents are referentially equal
}
}
Expand Down
6 changes: 5 additions & 1 deletion shared/src/main/scala/scala/xml/dtd/Scanner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ class Scanner extends Tokens with parsing.TokenTests {

final def name = {
val sb = new StringBuilder()
do { sb.append(c); next() } while (isNameChar(c))
while ({
sb.append(c)
next()
isNameChar(c)
}) ()
value = sb.toString()
NAME
}
Expand Down
4 changes: 2 additions & 2 deletions shared/src/main/scala/scala/xml/dtd/impl/Base.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ private[dtd] abstract class Base {
type _regexpT <: RegExp

abstract class RegExp {
val isNullable: Boolean
def isNullable: Boolean
}

object Alt {
Expand Down Expand Up @@ -62,4 +62,4 @@ private[dtd] abstract class Base {
final val isNullable = r1.isNullable
def r = r1
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ private[dtd] abstract class PointedHedgeExp extends Base {
final val isNullable = false
}

}
}
2 changes: 1 addition & 1 deletion shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ private[dtd] abstract class WordExp extends Base {
final lazy val isNullable = false
var pos = -1
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,11 @@ class XIncludeFilter extends XMLFilterImpl {
val reader = new InputStreamReader(in, encoding)
val c = new Array[Char](1024)
var charsRead: Int = 0 // bogus init value
do {
while ({
charsRead = reader.read(c, 0, 1024)
if (charsRead > 0) this.characters(c, 0, charsRead)
} while (charsRead != -1)
charsRead != -1
}) ()
} catch {
case e: UnsupportedEncodingException =>
throw new SAXException("Unsupported encoding: "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,10 @@ private[scala] trait MarkupParserCommon extends TokenTests {

val buf = new StringBuilder

do buf append ch_returning_nextch
while (isNameChar(ch))
while ({
buf append ch_returning_nextch
isNameChar(ch)
}) ()

if (buf.last == ':') {
reportSyntaxError("name cannot end in ':'")
Expand Down