Skip to content
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

Possible Scala 2.13 regression - Seq semantics changed #218

Sciss opened this issue Dec 14, 2018 · 2 comments

Possible Scala 2.13 regression - Seq semantics changed #218

Sciss opened this issue Dec 14, 2018 · 2 comments


Copy link

@Sciss Sciss commented Dec 14, 2018

So now unqualified

def parse(args: Seq[String], init: C): Option[C]

suddently means

def parse(args: scala.collection.immutable.Seq[String], init: C): Option[C]

And consequently the standard case of passing in the Array[String] from main creates a problem:

Warning:(61, 30) method copyArrayToImmutableIndexedSeq in class LowPriorityImplicits2 is deprecated (since 2.13.0): Implicit conversions from Array to immutable.IndexedSeq are implemented by copying; Use the more efficient non-copying ArraySeq.unsafeWrapArray or an explicit toIndexedSeq call
  val config  = parser.parse(args, Config()) getOrElse sys.exit(1)

So it should probably be qualified as scala.collection.Seq to match Scala 2.11 and 2.12 behaviour.

Copy link

@eed3si9n eed3si9n commented Dec 14, 2018

Sounds good. Would you like to send a PR for this?


Copy link

@eed3si9n eed3si9n commented Dec 17, 2018

I just sent #221


Sciss added a commit to Sciss/scallop that referenced this issue Jun 9, 2019
- change versions from 2.13.0-RC3 to 2.13.0
- use ScalaTest 2.13.0-RC3 while new version is not yet published
  (tests succeed, this is not an issue)
- in Scala 2.13, `scala.Seq` means `scala.collection.immutable.Seq`,
  unlike Scala 2.11 and 2.12, where the alias points to
  `sala.collection.Seq`. In general, we want to keep `scala.Seq`
  because immutable is better, however for Scallop, command line
  options typically come from `def main(args: Array[String])`, and
  here Scala will start to unnecessarily convert the array to an
  immutable seq in Scala 2.13, also giving a compiler warning.
  The solution proposed here is to explicitly use `s.c.Seq` so
  that an `Array[String]` can still be used without defense copying.
  Note that import `s.c.{Seq => CSeq}` has no consequence for Scala
  2.11 and 2.12 (and thus scala native and scala js), because the
  type is still the same. See also
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants