From bf8983bd076fc114e831b6ef40a60789a92e991a Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Tue, 10 Jan 2023 21:40:42 +0100 Subject: [PATCH 01/12] Update sbt to 1.8.2 (#575) --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 8b9a0b0a..46e43a97 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.8.0 +sbt.version=1.8.2 From 42c9451f14347a93d6ead88389a3d712a434044a Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 10 Jan 2023 12:46:31 -0800 Subject: [PATCH 02/12] copyright 2023 (#576) --- NOTICE | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NOTICE b/NOTICE index c743fb86..a4330bc5 100644 --- a/NOTICE +++ b/NOTICE @@ -1,6 +1,6 @@ scala-collection-compat -Copyright (c) 2002-2022 EPFL -Copyright (c) 2011-2022 Lightbend, Inc. +Copyright (c) 2002-2023 EPFL +Copyright (c) 2011-2023 Lightbend, Inc. Scala includes software developed at LAMP/EPFL (https://lamp.epfl.ch/) and From 209491faab6f3ed33bc7f227c562c62568c177fb Mon Sep 17 00:00:00 2001 From: kenji yoshida <6b656e6a69@gmail.com> Date: Mon, 23 Jan 2023 07:59:19 +0900 Subject: [PATCH 03/12] use ScalaNativeJUnitPlugin --- build.sbt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/build.sbt b/build.sbt index d3fa7fba..35a49e2e 100644 --- a/build.sbt +++ b/build.sbt @@ -133,9 +133,6 @@ lazy val compat = new MultiScalaCrossProject( ).jsEnablePlugins(ScalaJSJUnitPlugin), _.nativeSettings( nativeLinkStubs := true, - addCompilerPlugin( - "org.scala-native" % "junit-plugin" % nativeVersion cross CrossVersion.full - ), mimaPreviousArtifacts := (CrossVersion.partialVersion(scalaVersion.value) match { case Some((3, 1)) => mimaPreviousArtifacts.value.filter(_.revision != "2.6.0") case _ => mimaPreviousArtifacts.value @@ -149,9 +146,9 @@ lazy val compat = new MultiScalaCrossProject( jsAndNativeSourcesParent / "scala-2.11_2.12" } }, - libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion, + versionPolicyIntention := Compatibility.None, Test / fork := false // Scala Native cannot run forked tests - ) + ).nativeEnablePlugins(ScalaNativeJUnitPlugin) ) val compat211 = compat(Seq(JSPlatform, JVMPlatform, NativePlatform), scala211) From d27b1a57b183ca3b2810af37c59025ed32d47829 Mon Sep 17 00:00:00 2001 From: Michel Davit Date: Mon, 13 Feb 2023 13:41:35 +0100 Subject: [PATCH 04/12] Make ArraySeq extends IndexedSeqOptimized --- .../scala/collection/compat/immutable/ArraySeq.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compat/src/main/scala-2.11_2.12/scala/collection/compat/immutable/ArraySeq.scala b/compat/src/main/scala-2.11_2.12/scala/collection/compat/immutable/ArraySeq.scala index d70c1d8a..31ac2452 100644 --- a/compat/src/main/scala-2.11_2.12/scala/collection/compat/immutable/ArraySeq.scala +++ b/compat/src/main/scala-2.11_2.12/scala/collection/compat/immutable/ArraySeq.scala @@ -15,7 +15,7 @@ package scala.collection.compat.immutable import java.util.Arrays import scala.annotation.unchecked.uncheckedVariance -import scala.collection.AbstractSeq +import scala.collection.{AbstractSeq, IndexedSeqOptimized} import scala.collection.generic._ import scala.collection.immutable.IndexedSeq import scala.collection.mutable.{ArrayBuilder, Builder, WrappedArrayBuilder} @@ -34,7 +34,7 @@ import scala.util.hashing.MurmurHash3 * @define mayNotTerminateInf * @define willNotTerminateInf */ -abstract class ArraySeq[+T] extends AbstractSeq[T] with IndexedSeq[T] { +abstract class ArraySeq[+T] extends AbstractSeq[T] with IndexedSeq[T] with IndexedSeqOptimized[T, ArraySeq[T]] { override protected[this] def thisCollection: ArraySeq[T] = this From 76f76fdbbe6a670c646c4956af52f3f601c47b61 Mon Sep 17 00:00:00 2001 From: Michel Davit Date: Tue, 14 Feb 2023 11:12:32 +0100 Subject: [PATCH 05/12] Run scalafmt --- .../scala/collection/compat/immutable/ArraySeq.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compat/src/main/scala-2.11_2.12/scala/collection/compat/immutable/ArraySeq.scala b/compat/src/main/scala-2.11_2.12/scala/collection/compat/immutable/ArraySeq.scala index 31ac2452..d3daa1b3 100644 --- a/compat/src/main/scala-2.11_2.12/scala/collection/compat/immutable/ArraySeq.scala +++ b/compat/src/main/scala-2.11_2.12/scala/collection/compat/immutable/ArraySeq.scala @@ -34,7 +34,10 @@ import scala.util.hashing.MurmurHash3 * @define mayNotTerminateInf * @define willNotTerminateInf */ -abstract class ArraySeq[+T] extends AbstractSeq[T] with IndexedSeq[T] with IndexedSeqOptimized[T, ArraySeq[T]] { +abstract class ArraySeq[+T] + extends AbstractSeq[T] + with IndexedSeq[T] + with IndexedSeqOptimized[T, ArraySeq[T]] { override protected[this] def thisCollection: ArraySeq[T] = this From 37d2d5cb382d14994ba1cd13536f75b5200e33dd Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Thu, 16 Feb 2023 03:29:20 +0100 Subject: [PATCH 06/12] Update scala3-library, ... to 3.2.2 (#580) --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 35a49e2e..7933a406 100644 --- a/build.sbt +++ b/build.sbt @@ -53,7 +53,7 @@ lazy val junit = libraryDependencies += "com.github.sbt" % "junit-interface" % " lazy val scala211 = "2.11.12" lazy val scala212 = "2.12.17" lazy val scala213 = "2.13.10" -lazy val scala3 = "3.1.3" +lazy val scala3 = "3.2.2" lazy val compat = new MultiScalaCrossProject( "compat", From 267f2fc2e9d91153d32af4310bfcb08bed6607c1 Mon Sep 17 00:00:00 2001 From: Keith Alcock Date: Fri, 31 Mar 2023 11:28:21 -0700 Subject: [PATCH 07/12] Split up Using.scala into 2.11 and 2.12 versions This is so that a Source can be automatically released in 2.11 --- .../main/scala-2.11/scala/util/Using.scala | 409 ++++++++++++++++++ .../scala/util/Using.scala | 0 .../src/test/scala/scala/util/UsingTest.scala | 8 + 3 files changed, 417 insertions(+) create mode 100644 compat/src/main/scala-2.11/scala/util/Using.scala rename compat/src/main/{scala-2.11_2.12 => scala-2.12}/scala/util/Using.scala (100%) diff --git a/compat/src/main/scala-2.11/scala/util/Using.scala b/compat/src/main/scala-2.11/scala/util/Using.scala new file mode 100644 index 00000000..cc4d1c58 --- /dev/null +++ b/compat/src/main/scala-2.11/scala/util/Using.scala @@ -0,0 +1,409 @@ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ + +package scala.util + +import scala.io.Source +import scala.util.control.{ControlThrowable, NonFatal} + +/** A utility for performing automatic resource management. It can be used to perform an + * operation using resources, after which it releases the resources in reverse order + * of their creation. + * + * ==Usage== + * + * There are multiple ways to automatically manage resources with `Using`. If you only need + * to manage a single resource, the [[Using.apply `apply`]] method is easiest; it wraps the + * resource opening, operation, and resource releasing in a `Try`. + * + * Example: + * {{{ + * import java.io.{BufferedReader, FileReader} + * import scala.util.{Try, Using} + * + * val lines: Try[Seq[String]] = + * Using(new BufferedReader(new FileReader("file.txt"))) { reader => + * Iterator.continually(reader.readLine()).takeWhile(_ != null).toSeq + * } + * }}} + * + * If you need to manage multiple resources, [[Using.Manager$.apply `Using.Manager`]] should + * be used. It allows the managing of arbitrarily many resources, whose creation, use, and + * release are all wrapped in a `Try`. + * + * Example: + * {{{ + * import java.io.{BufferedReader, FileReader} + * import scala.util.{Try, Using} + * + * val lines: Try[Seq[String]] = Using.Manager { use => + * val r1 = use(new BufferedReader(new FileReader("file1.txt"))) + * val r2 = use(new BufferedReader(new FileReader("file2.txt"))) + * val r3 = use(new BufferedReader(new FileReader("file3.txt"))) + * val r4 = use(new BufferedReader(new FileReader("file4.txt"))) + * + * // use your resources here + * def lines(reader: BufferedReader): Iterator[String] = + * Iterator.continually(reader.readLine()).takeWhile(_ != null) + * + * (lines(r1) ++ lines(r2) ++ lines(r3) ++ lines(r4)).toList + * } + * }}} + * + * If you wish to avoid wrapping management and operations in a `Try`, you can use + * [[Using.resource `Using.resource`]], which throws any exceptions that occur. + * + * Example: + * {{{ + * import java.io.{BufferedReader, FileReader} + * import scala.util.Using + * + * val lines: Seq[String] = + * Using.resource(new BufferedReader(new FileReader("file.txt"))) { reader => + * Iterator.continually(reader.readLine()).takeWhile(_ != null).toSeq + * } + * }}} + * + * ==Suppression Behavior== + * + * If two exceptions are thrown (e.g., by an operation and closing a resource), + * one of them is re-thrown, and the other is + * [[java.lang.Throwable#addSuppressed added to it as a suppressed exception]]. + * If the two exceptions are of different 'severities' (see below), the one of a higher + * severity is re-thrown, and the one of a lower severity is added to it as a suppressed + * exception. If the two exceptions are of the same severity, the one thrown first is + * re-thrown, and the one thrown second is added to it as a suppressed exception. + * If an exception is a [[scala.util.control.ControlThrowable `ControlThrowable`]], or + * if it does not support suppression (see + * [[java.lang.Throwable `Throwable`'s constructor with an `enableSuppression` parameter]]), + * an exception that would have been suppressed is instead discarded. + * + * Exceptions are ranked from highest to lowest severity as follows: + * - `java.lang.VirtualMachineError` + * - `java.lang.LinkageError` + * - `java.lang.InterruptedException` and `java.lang.ThreadDeath` + * - [[scala.util.control.NonFatal fatal exceptions]], excluding `scala.util.control.ControlThrowable` + * - `scala.util.control.ControlThrowable` + * - all other exceptions + * + * When more than two exceptions are thrown, the first two are combined and + * re-thrown as described above, and each successive exception thrown is combined + * as it is thrown. + * + * @define suppressionBehavior See the main doc for [[Using `Using`]] for full details of + * suppression behavior. + */ +object Using { + + /** Performs an operation using a resource, and then releases the resource, + * even if the operation throws an exception. + * + * $suppressionBehavior + * + * @return a [[Try]] containing an exception if one or more were thrown, + * or the result of the operation if no exceptions were thrown + */ + def apply[R: Releasable, A](resource: => R)(f: R => A): Try[A] = Try { + Using.resource(resource)(f) + } + + /** A resource manager. + * + * Resources can be registered with the manager by calling [[acquire `acquire`]]; + * such resources will be released in reverse order of their acquisition + * when the manager is closed, regardless of any exceptions thrown + * during use. + * + * $suppressionBehavior + * + * @note It is recommended for API designers to require an implicit `Manager` + * for the creation of custom resources, and to call `acquire` during those + * resources' construction. Doing so guarantees that the resource ''must'' be + * automatically managed, and makes it impossible to forget to do so. + * + * + * Example: + * {{{ + * class SafeFileReader(file: File)(implicit manager: Using.Manager) + * extends BufferedReader(new FileReader(file)) { + * + * def this(fileName: String)(implicit manager: Using.Manager) = this(new File(fileName)) + * + * manager.acquire(this) + * } + * }}} + */ + final class Manager private { + import Manager._ + + private var closed = false + private[this] var resources: List[Resource[_]] = Nil + + /** Registers the specified resource with this manager, so that + * the resource is released when the manager is closed, and then + * returns the (unmodified) resource. + */ + def apply[R: Releasable](resource: R): R = { + acquire(resource) + resource + } + + /** Registers the specified resource with this manager, so that + * the resource is released when the manager is closed. + */ + def acquire[R: Releasable](resource: R): Unit = { + if (resource == null) throw new NullPointerException("null resource") + if (closed) throw new IllegalStateException("Manager has already been closed") + resources = new Resource(resource) :: resources + } + + private def manage[A](op: Manager => A): A = { + var toThrow: Throwable = null + try { + op(this) + } catch { + case t: Throwable => + toThrow = t + null.asInstanceOf[A] // compiler doesn't know `finally` will throw + } finally { + closed = true + var rs = resources + resources = null // allow GC, in case something is holding a reference to `this` + while (rs.nonEmpty) { + val resource = rs.head + rs = rs.tail + try resource.release() + catch { + case t: Throwable => + if (toThrow == null) toThrow = t + else toThrow = preferentiallySuppress(toThrow, t) + } + } + if (toThrow != null) throw toThrow + } + } + } + + object Manager { + + /** Performs an operation using a `Manager`, then closes the `Manager`, + * releasing its resources (in reverse order of acquisition). + * + * Example: + * {{{ + * val lines = Using.Manager { use => + * use(new BufferedReader(new FileReader("file.txt"))).lines() + * } + * }}} + * + * If using resources which require an implicit `Manager` as a parameter, + * this method should be invoked with an `implicit` modifier before the function + * parameter: + * + * Example: + * {{{ + * val lines = Using.Manager { implicit use => + * new SafeFileReader("file.txt").lines() + * } + * }}} + * + * See the main doc for [[Using `Using`]] for full details of suppression behavior. + * + * @param op the operation to perform using the manager + * @tparam A the return type of the operation + * @return a [[Try]] containing an exception if one or more were thrown, + * or the result of the operation if no exceptions were thrown + */ + def apply[A](op: Manager => A): Try[A] = Try { (new Manager).manage(op) } + + private final class Resource[R](resource: R)(implicit releasable: Releasable[R]) { + def release(): Unit = releasable.release(resource) + } + } + + private def preferentiallySuppress(primary: Throwable, secondary: Throwable): Throwable = { + def score(t: Throwable): Int = t match { + case _: VirtualMachineError => 4 + case _: LinkageError => 3 + case _: InterruptedException | _: ThreadDeath => 2 + case _: ControlThrowable => 0 + case e if !NonFatal(e) => 1 // in case this method gets out of sync with NonFatal + case _ => -1 + } + // special-case `ControlThrowable`, which incorrectly suppresses exceptions + // before 2.13 + @inline def suppress(t: Throwable, suppressed: Throwable): Throwable = { + if (!t.isInstanceOf[ControlThrowable]) t.addSuppressed(suppressed); t + } + + if (score(secondary) > score(primary)) suppress(secondary, primary) + else suppress(primary, secondary) + } + + /** Performs an operation using a resource, and then releases the resource, + * even if the operation throws an exception. This method behaves similarly + * to Java's try-with-resources. + * + * $suppressionBehavior + * + * @param resource the resource + * @param body the operation to perform with the resource + * @tparam R the type of the resource + * @tparam A the return type of the operation + * @return the result of the operation, if neither the operation nor + * releasing the resource throws + */ + def resource[R, A](resource: R)(body: R => A)(implicit releasable: Releasable[R]): A = { + if (resource == null) throw new NullPointerException("null resource") + + var toThrow: Throwable = null + try { + body(resource) + } catch { + case t: Throwable => + toThrow = t + null.asInstanceOf[A] // compiler doesn't know `finally` will throw + } finally { + if (toThrow eq null) releasable.release(resource) + else { + try releasable.release(resource) + catch { + case other: Throwable => toThrow = preferentiallySuppress(toThrow, other) + } finally throw toThrow + } + } + } + + /** Performs an operation using two resources, and then releases the resources + * in reverse order, even if the operation throws an exception. This method + * behaves similarly to Java's try-with-resources. + * + * $suppressionBehavior + * + * @param resource1 the first resource + * @param resource2 the second resource + * @param body the operation to perform using the resources + * @tparam R1 the type of the first resource + * @tparam R2 the type of the second resource + * @tparam A the return type of the operation + * @return the result of the operation, if neither the operation nor + * releasing the resources throws + */ + def resources[R1: Releasable, R2: Releasable, A]( + resource1: R1, + resource2: => R2 + )(body: (R1, R2) => A): A = + resource(resource1) { r1 => + resource(resource2) { r2 => + body(r1, r2) + } + } + + /** Performs an operation using three resources, and then releases the resources + * in reverse order, even if the operation throws an exception. This method + * behaves similarly to Java's try-with-resources. + * + * $suppressionBehavior + * + * @param resource1 the first resource + * @param resource2 the second resource + * @param resource3 the third resource + * @param body the operation to perform using the resources + * @tparam R1 the type of the first resource + * @tparam R2 the type of the second resource + * @tparam R3 the type of the third resource + * @tparam A the return type of the operation + * @return the result of the operation, if neither the operation nor + * releasing the resources throws + */ + def resources[R1: Releasable, R2: Releasable, R3: Releasable, A]( + resource1: R1, + resource2: => R2, + resource3: => R3 + )(body: (R1, R2, R3) => A): A = + resource(resource1) { r1 => + resource(resource2) { r2 => + resource(resource3) { r3 => + body(r1, r2, r3) + } + } + } + + /** Performs an operation using four resources, and then releases the resources + * in reverse order, even if the operation throws an exception. This method + * behaves similarly to Java's try-with-resources. + * + * $suppressionBehavior + * + * @param resource1 the first resource + * @param resource2 the second resource + * @param resource3 the third resource + * @param resource4 the fourth resource + * @param body the operation to perform using the resources + * @tparam R1 the type of the first resource + * @tparam R2 the type of the second resource + * @tparam R3 the type of the third resource + * @tparam R4 the type of the fourth resource + * @tparam A the return type of the operation + * @return the result of the operation, if neither the operation nor + * releasing the resources throws + */ + def resources[R1: Releasable, R2: Releasable, R3: Releasable, R4: Releasable, A]( + resource1: R1, + resource2: => R2, + resource3: => R3, + resource4: => R4 + )(body: (R1, R2, R3, R4) => A): A = + resource(resource1) { r1 => + resource(resource2) { r2 => + resource(resource3) { r3 => + resource(resource4) { r4 => + body(r1, r2, r3, r4) + } + } + } + } + + /** A typeclass describing how to release a particular type of resource. + * + * A resource is anything which needs to be released, closed, or otherwise cleaned up + * in some way after it is finished being used, and for which waiting for the object's + * garbage collection to be cleaned up would be unacceptable. For example, an instance of + * [[java.io.OutputStream]] would be considered a resource, because it is important to close + * the stream after it is finished being used. + * + * An instance of `Releasable` is needed in order to automatically manage a resource + * with [[Using `Using`]]. An implicit instance is provided for all types extending + * [[java.lang.AutoCloseable]]. + * + * @tparam R the type of the resource + */ + trait Releasable[-R] { + + /** Releases the specified resource. */ + def release(resource: R): Unit + } + + object Releasable { + + /** An implicit `Releasable` for [[java.lang.AutoCloseable `AutoCloseable`s]]. */ + implicit object AutoCloseableIsReleasable extends Releasable[AutoCloseable] { + def release(resource: AutoCloseable): Unit = resource.close() + } + + /** An implicit `Releasable` for [[scala.io.Source `Source`s]] which aren't [[java.lang.AutoCloseable `AutoCloseable`s]] in Scala 2.11. */ + implicit object SourceReleasable extends Releasable[Source] { + def release(resource: Source): Unit = resource.close() + } + } + +} diff --git a/compat/src/main/scala-2.11_2.12/scala/util/Using.scala b/compat/src/main/scala-2.12/scala/util/Using.scala similarity index 100% rename from compat/src/main/scala-2.11_2.12/scala/util/Using.scala rename to compat/src/main/scala-2.12/scala/util/Using.scala diff --git a/compat/src/test/scala/scala/util/UsingTest.scala b/compat/src/test/scala/scala/util/UsingTest.scala index e401ed28..fef31cbe 100644 --- a/compat/src/test/scala/scala/util/UsingTest.scala +++ b/compat/src/test/scala/scala/util/UsingTest.scala @@ -15,6 +15,7 @@ package scala.util import org.junit.Test import org.junit.Assert._ +import scala.io.Source import scala.reflect.ClassTag import scala.runtime.NonLocalReturnControl @@ -758,6 +759,13 @@ class UsingTest { .get assertThrowableClass[RuntimeException](ex) } + + @Test + def usingSource(): Unit = { + Using(Source.fromString("Hello, Source!")) { source => + // If this simply compiles, then mission accomplished. + } + } } object UsingTest { From 4fbfad2e158729f5832d3dd126a61655daea6dbb Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 7 Apr 2023 17:02:59 +0000 Subject: [PATCH 08/12] Update sbt-scala-native-crossproject, ... to 1.3.0 --- project/plugins.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 42d92f24..0d82daed 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,7 @@ addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.12.0") -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.0") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.9") -addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0") +addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.0") addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.1") addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.4") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0") From 9d64f5c21764f664ab8a92bd88f50caa4dd7cb8a Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Wed, 12 Apr 2023 11:27:47 +0200 Subject: [PATCH 09/12] test --- .../test/scala/test/scala/collection/ArraySeqTest.scala | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/compat/src/test/scala/test/scala/collection/ArraySeqTest.scala b/compat/src/test/scala/test/scala/collection/ArraySeqTest.scala index f2d8204a..23b4c581 100644 --- a/compat/src/test/scala/test/scala/collection/ArraySeqTest.scala +++ b/compat/src/test/scala/test/scala/collection/ArraySeqTest.scala @@ -72,4 +72,11 @@ class ArraySeqTest { Assert.assertEquals(ArraySeq[T](), array.slice(1, 1)) Assert.assertEquals(ArraySeq[T](), array.slice(2, 1)) } + + @Test def ArraySeqIndexedSeqOptimized(): Unit = { + val x = ArraySeq(1, 2) + val y = ArraySeq(3, 4) + val z: ArraySeq[Int] = x ++ y + assert(z.toList == List(1, 2, 3, 4)) + } } From 5b8e92541f198be50b757fa43087706659aa74dc Mon Sep 17 00:00:00 2001 From: Keith Alcock Date: Wed, 12 Apr 2023 15:53:43 -0700 Subject: [PATCH 10/12] Run scalafmt --- compat/src/main/scala-2.11/scala/util/Using.scala | 2 +- compat/src/test/scala/scala/util/UsingTest.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compat/src/main/scala-2.11/scala/util/Using.scala b/compat/src/main/scala-2.11/scala/util/Using.scala index cc4d1c58..ffc17a1a 100644 --- a/compat/src/main/scala-2.11/scala/util/Using.scala +++ b/compat/src/main/scala-2.11/scala/util/Using.scala @@ -403,7 +403,7 @@ object Using { /** An implicit `Releasable` for [[scala.io.Source `Source`s]] which aren't [[java.lang.AutoCloseable `AutoCloseable`s]] in Scala 2.11. */ implicit object SourceReleasable extends Releasable[Source] { def release(resource: Source): Unit = resource.close() - } + } } } diff --git a/compat/src/test/scala/scala/util/UsingTest.scala b/compat/src/test/scala/scala/util/UsingTest.scala index fef31cbe..84ce92a1 100644 --- a/compat/src/test/scala/scala/util/UsingTest.scala +++ b/compat/src/test/scala/scala/util/UsingTest.scala @@ -765,7 +765,7 @@ class UsingTest { Using(Source.fromString("Hello, Source!")) { source => // If this simply compiles, then mission accomplished. } - } + } } object UsingTest { From be0267f357d8c5ce9fcbdf888cdd1f6c5e63856b Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 17 Apr 2023 20:17:23 +0000 Subject: [PATCH 11/12] Update sbt-scala-native-crossproject, ... to 1.3.1 --- project/plugins.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 0d82daed..408d5faa 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,7 @@ addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.12.0") -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.0") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.1") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.9") -addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.0") +addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.1") addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.1") addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.4") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0") From 159bd218cf49de9c7bfb28a90db46590d39f1c05 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Mon, 24 Apr 2023 11:28:22 -0700 Subject: [PATCH 12/12] disable versionCheck for Scala Native (#592) --- build.sbt | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sbt b/build.sbt index 7933a406..94358e35 100644 --- a/build.sbt +++ b/build.sbt @@ -147,6 +147,7 @@ lazy val compat = new MultiScalaCrossProject( } }, versionPolicyIntention := Compatibility.None, + versionCheck := {}, // I don't understand why this fails otherwise?! oh well Test / fork := false // Scala Native cannot run forked tests ).nativeEnablePlugins(ScalaNativeJUnitPlugin) )