From eedd60285bf445b27320fe3b88bcf88379ce93e2 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Thu, 19 Nov 2020 15:36:17 +0100 Subject: [PATCH] Upgrade to Scala 2.13.4, switch CI to JDK 15 2.13.4 brings JDK 15 support with https://github.com/scala/scala/pull/9292 --- .github/workflows/ci.yaml | 30 +++++++++---------- .../src/dotty/tools/dotc/core/NameOps.scala | 14 +++++---- .../dotty/tools/dotc/typer/Applications.scala | 2 +- project/Build.scala | 4 +-- .../sbt-test/scala2-compat/i8847/build.sbt | 2 +- .../sbt-test/scala2-compat/i9916a/build.sbt | 2 +- .../sbt-test/scala2-compat/i9916b/build.sbt | 2 +- 7 files changed, 29 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f3c3d6b7e22c..89501ed6c9d1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,7 +13,7 @@ jobs: test: runs-on: [self-hosted, Linux] container: - image: lampepfl/dotty:2020-09-08 + image: lampepfl/dotty:2020-11-19 volumes: - ${{ github.workspace }}/../../cache/sbt:/root/.sbt - ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache @@ -22,8 +22,8 @@ jobs: startsWith(github.event.ref, 'refs/tags/sbt-dotty-'))" steps: - - name: Set JDK 14 as default - run: echo "/usr/lib/jvm/java-14-openjdk-amd64/bin" >> $GITHUB_PATH + - name: Set JDK 15 as default + run: echo "/usr/lib/jvm/java-15-openjdk-amd64/bin" >> $GITHUB_PATH - name: Checkout cleanup script uses: actions/checkout@v2 @@ -45,7 +45,7 @@ jobs: test_bootstrapped: runs-on: [self-hosted, Linux] container: - image: lampepfl/dotty:2020-09-08 + image: lampepfl/dotty:2020-11-19 volumes: - ${{ github.workspace }}/../../cache/sbt:/root/.sbt - ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache @@ -54,8 +54,8 @@ jobs: startsWith(github.event.ref, 'refs/tags/sbt-dotty-'))" steps: - - name: Set JDK 14 as default - run: echo "/usr/lib/jvm/java-14-openjdk-amd64/bin" >> $GITHUB_PATH + - name: Set JDK 15 as default + run: echo "/usr/lib/jvm/java-15-openjdk-amd64/bin" >> $GITHUB_PATH - name: Checkout cleanup script uses: actions/checkout@v2 @@ -110,7 +110,7 @@ jobs: community_build_a: runs-on: [self-hosted, Linux] container: - image: lampepfl/dotty:2020-09-08 + image: lampepfl/dotty:2020-11-19 volumes: - ${{ github.workspace }}/../../cache/sbt:/root/.sbt - ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache @@ -138,7 +138,7 @@ jobs: community_build_b: runs-on: [self-hosted, Linux] container: - image: lampepfl/dotty:2020-09-08 + image: lampepfl/dotty:2020-11-19 volumes: - ${{ github.workspace }}/../../cache/sbt:/root/.sbt - ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache @@ -166,7 +166,7 @@ jobs: test_sbt: runs-on: [self-hosted, Linux] container: - image: lampepfl/dotty:2020-09-08 + image: lampepfl/dotty:2020-11-19 volumes: - ${{ github.workspace }}/../../cache/sbt:/root/.sbt - ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache @@ -196,7 +196,7 @@ jobs: test_java8: runs-on: [self-hosted, Linux] container: - image: lampepfl/dotty:2020-09-08 + image: lampepfl/dotty:2020-11-19 volumes: - ${{ github.workspace }}/../../cache/sbt:/root/.sbt - ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache @@ -231,7 +231,7 @@ jobs: publish_nightly: runs-on: [self-hosted, Linux] container: - image: lampepfl/dotty:2020-09-08 + image: lampepfl/dotty:2020-11-19 volumes: - ${{ github.workspace }}/../../cache/sbt:/root/.sbt - ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache @@ -265,7 +265,7 @@ jobs: nightly_documentation: runs-on: [self-hosted, Linux] container: - image: lampepfl/dotty:2020-09-08 + image: lampepfl/dotty:2020-11-19 volumes: - ${{ github.workspace }}/../../cache/sbt:/root/.sbt - ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache @@ -306,7 +306,7 @@ jobs: publish_release: runs-on: [self-hosted, Linux] container: - image: lampepfl/dotty:2020-09-08 + image: lampepfl/dotty:2020-11-19 volumes: - ${{ github.workspace }}/../../cache/sbt:/root/.sbt - ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache @@ -388,7 +388,7 @@ jobs: release_documentation: runs-on: [self-hosted, Linux] container: - image: lampepfl/dotty:2020-09-08 + image: lampepfl/dotty:2020-11-19 volumes: - ${{ github.workspace }}/../../cache/sbt:/root/.sbt - ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache @@ -432,7 +432,7 @@ jobs: publish_sbt_release: runs-on: [self-hosted, Linux] container: - image: lampepfl/dotty:2020-09-08 + image: lampepfl/dotty:2020-11-19 volumes: - ${{ github.workspace }}/../../cache/sbt:/root/.sbt - ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache diff --git a/compiler/src/dotty/tools/dotc/core/NameOps.scala b/compiler/src/dotty/tools/dotc/core/NameOps.scala index 26ccc5c87932..ed6e54ab9deb 100644 --- a/compiler/src/dotty/tools/dotc/core/NameOps.scala +++ b/compiler/src/dotty/tools/dotc/core/NameOps.scala @@ -2,6 +2,7 @@ package dotty.tools.dotc package core import java.security.MessageDigest +import java.nio.CharBuffer import scala.io.Codec import Int.MaxValue import Names._, StdNames._, Contexts._, Symbols._, Flags._, NameKinds._, Types._ @@ -32,17 +33,18 @@ object NameOps { def apply(s: String): String = { val marker = "$$$$" - val MaxNameLength = (CLASSFILE_NAME_CHAR_LIMIT - 6) min + val MaxNameLength = (CLASSFILE_NAME_CHAR_LIMIT - 6).min( 2 * (CLASSFILE_NAME_CHAR_LIMIT - 6 - 2 * marker.length - 32) + ) def toMD5(s: String, edge: Int): String = { - val prefix = s take edge - val suffix = s takeRight edge + val prefix = s.take(edge) + val suffix = s.takeRight(edge) val cs = s.toArray - val bytes = Codec toUTF8 cs - md5 update bytes - val md5chars = (md5.digest() map (b => (b & 0xFF).toHexString)).mkString + val bytes = Codec.toUTF8(CharBuffer.wrap(cs)) + md5.update(bytes) + val md5chars = md5.digest().map(b => (b & 0xFF).toHexString).mkString prefix + marker + md5chars + marker + suffix } diff --git a/compiler/src/dotty/tools/dotc/typer/Applications.scala b/compiler/src/dotty/tools/dotc/typer/Applications.scala index 051451cffd55..3960ac1a37bb 100644 --- a/compiler/src/dotty/tools/dotc/typer/Applications.scala +++ b/compiler/src/dotty/tools/dotc/typer/Applications.scala @@ -724,7 +724,7 @@ trait Applications extends Compatibility { def makeVarArg(n: Int, elemFormal: Type): Unit = { val args = typedArgBuf.takeRight(n).toList - typedArgBuf.trimEnd(n) + typedArgBuf.dropRightInPlace(n) val elemtpt = TypeTree(elemFormal) typedArgBuf += seqToRepeated(SeqLiteral(args, elemtpt)) } diff --git a/project/Build.scala b/project/Build.scala index 25ecac0a125b..88f4a6cb419c 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -72,8 +72,8 @@ object Build { * scala-library. */ def stdlibVersion(implicit mode: Mode): String = mode match { - case NonBootstrapped => "2.13.3" - case Bootstrapped => "2.13.3" + case NonBootstrapped => "2.13.4" + case Bootstrapped => "2.13.4" } val dottyOrganization = "org.scala-lang" diff --git a/sbt-dotty/sbt-test/scala2-compat/i8847/build.sbt b/sbt-dotty/sbt-test/scala2-compat/i8847/build.sbt index 3f24e1d347aa..7b620f9a7694 100644 --- a/sbt-dotty/sbt-test/scala2-compat/i8847/build.sbt +++ b/sbt-dotty/sbt-test/scala2-compat/i8847/build.sbt @@ -1,5 +1,5 @@ val scala3Version = sys.props("plugin.scalaVersion") -val scala2Version = "2.13.3" +val scala2Version = "2.13.4" lazy val `i8847-lib` = (project in file ("lib")) .settings(scalaVersion := scala2Version) diff --git a/sbt-dotty/sbt-test/scala2-compat/i9916a/build.sbt b/sbt-dotty/sbt-test/scala2-compat/i9916a/build.sbt index e9c732d4853a..480bb5e1193b 100644 --- a/sbt-dotty/sbt-test/scala2-compat/i9916a/build.sbt +++ b/sbt-dotty/sbt-test/scala2-compat/i9916a/build.sbt @@ -1,5 +1,5 @@ val scala3Version = sys.props("plugin.scalaVersion") -val scala2Version = "2.13.3" +val scala2Version = "2.13.4" lazy val `i9916a-lib` = (project in file ("lib")) .settings(scalaVersion := scala2Version) diff --git a/sbt-dotty/sbt-test/scala2-compat/i9916b/build.sbt b/sbt-dotty/sbt-test/scala2-compat/i9916b/build.sbt index 51a2d056ddad..1b7022040009 100644 --- a/sbt-dotty/sbt-test/scala2-compat/i9916b/build.sbt +++ b/sbt-dotty/sbt-test/scala2-compat/i9916b/build.sbt @@ -1,5 +1,5 @@ val scala3Version = sys.props("plugin.scalaVersion") -val scala2Version = "2.13.3" +val scala2Version = "2.13.4" lazy val `i9916b-lib` = (project in file ("lib")) .settings(scalaVersion := scala2Version)